Repository: fronzbot/blinkpy

Issue:
Backup login url incorrect
**Describe the bug**
Backup login url in the `helpers/constants.py` module contains errant `/` instead of `.`.  Should be `rest.piri.` instead of `rest.piri/`

**To Reproduce**
Steps to reproduce the behavior:

1. Fail with LOGIN_URL
2. BACKUP_LOGIN_URL will fail because of incorrect format

**`blinkpy` version:** 0.11.0


Comments:

Patch:
diff --git a/blinkpy/camera.py b/blinkpy/camera.py
index 992310b..8c0eb5b 100644
--- a/blinkpy/camera.py
+++ b/blinkpy/camera.py
@@ -24,6 +24,7 @@ class BlinkCamera():
         self.battery_voltage = None
         self.clip = None
         self.temperature = None
+        self.temperature_calibrated = None
         self.battery_state = None
         self.motion_detected = None
         self.wifi_strength = None
@@ -40,6 +41,7 @@ class BlinkCamera():
             'serial': self.serial,
             'temperature': self.temperature,
             'temperature_c': self.temperature_c,
+            'temperature_calibrated': self.temperature_calibrated,
             'battery': self.battery,
             'thumbnail': self.thumbnail,
             'video': self.clip,
@@ -104,6 +106,15 @@ class BlinkCamera():
         self.temperature = config['temperature']
         self.wifi_strength = config['wifi_strength']
 
+        # Retrieve calibrated temperature from special endpoint
+        resp = api.request_camera_sensors(self.sync.blink,
+                                          self.network_id,
+                                          self.camera_id)
+        try:
+            self.temperature_calibrated = resp['temp']
+        except KeyError:
+            _LOGGER.error("Could not retrieve calibrated temperature.")
+
         # Check if thumbnail exists in config, if not try to
         # get it from the homescreen info in teh sync module
         # otherwise set it to None and log an error
diff --git a/blinkpy/helpers/constants.py b/blinkpy/helpers/constants.py
index a801f5f..3eb1d82 100644
--- a/blinkpy/helpers/constants.py
+++ b/blinkpy/helpers/constants.py
@@ -45,10 +45,10 @@ PYPI_URL = 'https://pypi.python.org/pypi/{}'.format(PROJECT_PACKAGE_NAME)
 URLS
 '''
 BLINK_URL = 'immedia-semi.com'
-LOGIN_URL = 'https://prod.' + BLINK_URL + '/login'
-LOGIN_BACKUP_URL = 'https://rest.piri/' + BLINK_URL + '/login'
-BASE_URL = 'https://prod.' + BLINK_URL
-DEFAULT_URL = 'prod.' + BLINK_URL
+DEFAULT_URL = "{}.{}".format('prod', BLINK_URL)
+BASE_URL = "https://{}".format(DEFAULT_URL)
+LOGIN_URL = "{}/login".format(BASE_URL)
+LOGIN_BACKUP_URL = "https://{}.{}/login".format('rest.piri', BLINK_URL)
 
 '''
 Dictionaries


Test patch:
diff --git a/tests/test_cameras.py b/tests/test_cameras.py
index d3ffccb..a340228 100644
--- a/tests/test_cameras.py
+++ b/tests/test_cameras.py
@@ -98,6 +98,7 @@ class TestBlinkCameraSetup(unittest.TestCase):
         self.camera.last_record = ['1']
         self.camera.sync.all_clips = {'new': {'1': '/test.mp4'}}
         mock_sess.side_effect = [
+            mresp.MockResponse({'temp': 71}, 200),
             'test',
             'foobar'
         ]
@@ -110,6 +111,7 @@ class TestBlinkCameraSetup(unittest.TestCase):
         self.assertEqual(self.camera.battery, 50)
         self.assertEqual(self.camera.temperature, 68)
         self.assertEqual(self.camera.temperature_c, 20)
+        self.assertEqual(self.camera.temperature_calibrated, 71)
         self.assertEqual(self.camera.wifi_strength, 4)
         self.assertEqual(self.camera.thumbnail,
                          'https://rest.test.immedia-semi.com/thumb.jpg')
@@ -120,7 +122,11 @@ class TestBlinkCameraSetup(unittest.TestCase):
 
     def test_thumbnail_not_in_info(self, mock_sess):
         """Test that we grab thumbanil if not in camera_info."""
-        mock_sess.side_effect = ['foobar', 'barfoo']
+        mock_sess.side_effect = [
+            mresp.MockResponse({'temp': 71}, 200),
+            'foobar',
+            'barfoo'
+        ]
         self.camera.last_record = ['1']
         self.camera.sync.record_dates['new'] = ['1']
         self.camera.sync.all_clips = {'new': {'1': '/test.mp4'}}
@@ -175,7 +181,8 @@ class TestBlinkCameraSetup(unittest.TestCase):
         self.assertEqual(self.camera.thumbnail, None)
         self.assertEqual(
             logrecord.output,
-            ["ERROR:blinkpy.camera:Could not find thumbnail for camera new"]
+            ["ERROR:blinkpy.camera:Could not retrieve calibrated temperature.",
+             "ERROR:blinkpy.camera:Could not find thumbnail for camera new"]
         )
 
     def test_no_video_clips(self, mock_sess):