From 10e3c00f0797471b1d1e87e0b755318069785323 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Mon, 28 Aug 2017 09:11:11 -0700 Subject: [PATCH 1/9] Version bump to 0.52.1 --- homeassistant/const.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/const.py b/homeassistant/const.py index a8fefcf26c4..15079b11992 100644 --- a/homeassistant/const.py +++ b/homeassistant/const.py @@ -2,7 +2,7 @@ """Constants used by Home Assistant components.""" MAJOR_VERSION = 0 MINOR_VERSION = 52 -PATCH_VERSION = '0' +PATCH_VERSION = '1' __short_version__ = '{}.{}'.format(MAJOR_VERSION, MINOR_VERSION) __version__ = '{}.{}'.format(__short_version__, PATCH_VERSION) REQUIRED_PYTHON_VER = (3, 4, 2) From 8a896433387827a7b3237309969ee5c43a5dbadb Mon Sep 17 00:00:00 2001 From: Andrey Kupreychik Date: Sat, 26 Aug 2017 23:56:39 +0700 Subject: [PATCH 2/9] Close stream request once we end up with proxy (#9110) * Close stream request once we end up with proxy * Update aiohttp_client.py * Update aiohttp_client.py * Removed trailing whitespace --- homeassistant/helpers/aiohttp_client.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/homeassistant/helpers/aiohttp_client.py b/homeassistant/helpers/aiohttp_client.py index a8b18351021..29e2a6260fd 100644 --- a/homeassistant/helpers/aiohttp_client.py +++ b/homeassistant/helpers/aiohttp_client.py @@ -90,8 +90,15 @@ def async_aiohttp_proxy_web(hass, request, web_coro, buffer_size=102400, # Something went wrong with the connection raise HTTPBadGateway() from err - yield from async_aiohttp_proxy_stream(hass, request, req.content, - req.headers.get(CONTENT_TYPE)) + try: + yield from async_aiohttp_proxy_stream( + hass, + request, + req.content, + req.headers.get(CONTENT_TYPE) + ) + finally: + req.close() @asyncio.coroutine From 0ae1f85f9fb5df4e60fb7310f1dc156e6b48c38f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20H=C3=B8yer=20Iversen?= Date: Sat, 26 Aug 2017 09:36:54 +0200 Subject: [PATCH 3/9] Fix issue #9116 in pushbullet (#9128) * Fix issue #9116 in pushbullet --- homeassistant/components/notify/pushbullet.py | 43 ++++++++++--------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/homeassistant/components/notify/pushbullet.py b/homeassistant/components/notify/pushbullet.py index 6d97d544905..353e833ae51 100644 --- a/homeassistant/components/notify/pushbullet.py +++ b/homeassistant/components/notify/pushbullet.py @@ -89,7 +89,7 @@ class PushBulletNotificationService(BaseNotificationService): if not targets: # Backward compatibility, notify all devices in own account - self._push_data(filepath, message, title, url) + self._push_data(filepath, message, title, self.pushbullet, url) _LOGGER.info("Sent notification to self") return @@ -104,7 +104,8 @@ class PushBulletNotificationService(BaseNotificationService): # Target is email, send directly, don't use a target object # This also seems works to send to all devices in own account if ttype == 'email': - self._push_data(filepath, message, title, url, tname) + self._push_data(filepath, message, title, url, + self.pushbullet, tname) _LOGGER.info("Sent notification to email %s", tname) continue @@ -123,27 +124,27 @@ class PushBulletNotificationService(BaseNotificationService): # Attempt push_note on a dict value. Keys are types & target # name. Dict pbtargets has all *actual* targets. try: - if url: - self.pbtargets[ttype][tname].push_link( - title, url, body=message) - else: - self.pbtargets[ttype][tname].push_note(title, message) + self._push_data(filepath, message, title, url, + self.pbtargets[ttype][tname]) _LOGGER.info("Sent notification to %s/%s", ttype, tname) except KeyError: _LOGGER.error("No such target: %s/%s", ttype, tname) continue - except self.pushbullet.errors.PushError: - _LOGGER.error("Notify failed to: %s/%s", ttype, tname) - continue - def _push_data(self, filepath, message, title, url, tname=None): - if url: - self.pushbullet.push_link( - title, url, body=message, email=tname) - elif filepath and self.hass.config.is_allowed_path(filepath): - with open(filepath, "rb") as fileh: - filedata = self.pushbullet.upload_file(fileh, filepath) - self.pushbullet.push_file(title=title, body=message, - **filedata) - else: - self.pushbullet.push_note(title, message, email=tname) + def _push_data(self, filepath, message, title, url, pusher, tname=None): + from pushbullet import PushError + try: + if url: + pusher.push_link(title, url, body=message, email=tname) + elif filepath and self.hass.config.is_allowed_path(filepath): + with open(filepath, "rb") as fileh: + filedata = self.pushbullet.upload_file(fileh, filepath) + if filedata.get('file_type') == 'application/x-empty': + _LOGGER.error("Failed to send an empty file.") + return + pusher.push_file(title=title, body=message, **filedata) + else: + pusher.push_note(title, message, email=tname) + + except PushError as err: + _LOGGER.error("Notify failed: %s", err) From 422be25d222d1de4d211b3059d4f14aabbcea2a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20H=C3=B8yer=20Iversen?= Date: Sat, 26 Aug 2017 18:12:51 +0200 Subject: [PATCH 4/9] bug fix pushbullet (#9139) --- homeassistant/components/notify/pushbullet.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/notify/pushbullet.py b/homeassistant/components/notify/pushbullet.py index 353e833ae51..0d596fb41ba 100644 --- a/homeassistant/components/notify/pushbullet.py +++ b/homeassistant/components/notify/pushbullet.py @@ -133,9 +133,13 @@ class PushBulletNotificationService(BaseNotificationService): def _push_data(self, filepath, message, title, url, pusher, tname=None): from pushbullet import PushError + from pushbullet import Device try: if url: - pusher.push_link(title, url, body=message, email=tname) + if isinstance(pusher, Device): + pusher.push_link(title, url, body=message) + else: + pusher.push_link(title, url, body=message, email=tname) elif filepath and self.hass.config.is_allowed_path(filepath): with open(filepath, "rb") as fileh: filedata = self.pushbullet.upload_file(fileh, filepath) @@ -144,7 +148,9 @@ class PushBulletNotificationService(BaseNotificationService): return pusher.push_file(title=title, body=message, **filedata) else: - pusher.push_note(title, message, email=tname) - + if isinstance(pusher, Device): + pusher.push_note(title, message) + else: + pusher.push_note(title, message, email=tname) except PushError as err: _LOGGER.error("Notify failed: %s", err) From e6892a4077be135e72eb208a20a7bbe1208fa0db Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Sat, 26 Aug 2017 12:08:37 -0400 Subject: [PATCH 5/9] Fix import for foscam (#9140) While waiting for a new pyfoscam release, we can fix this for users just by changing the import. Foscam devices a pretty widely deployed, so a regression here is definitely no fun. Fixes Bug #8940 --- homeassistant/components/camera/foscam.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/camera/foscam.py b/homeassistant/components/camera/foscam.py index 15138e2c253..8ea90d5a44e 100644 --- a/homeassistant/components/camera/foscam.py +++ b/homeassistant/components/camera/foscam.py @@ -53,7 +53,7 @@ class FoscamCam(Camera): self._name = device_info.get(CONF_NAME) self._motion_status = False - from foscam import FoscamCamera + from foscam.foscam import FoscamCamera self._foscam_session = FoscamCamera(ip_address, port, self._username, self._password, verbose=False) From d986b8f4c2e589ee0e6fd4d61e03c606714e0f37 Mon Sep 17 00:00:00 2001 From: Adam Mills Date: Sat, 26 Aug 2017 17:09:57 -0400 Subject: [PATCH 6/9] Bump aioautomatic to prevent leaking exceptions (#9148) --- homeassistant/components/device_tracker/automatic.py | 2 +- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/device_tracker/automatic.py b/homeassistant/components/device_tracker/automatic.py index 071edf42642..a4495926f82 100644 --- a/homeassistant/components/device_tracker/automatic.py +++ b/homeassistant/components/device_tracker/automatic.py @@ -23,7 +23,7 @@ from homeassistant.helpers.aiohttp_client import async_get_clientsession import homeassistant.helpers.config_validation as cv from homeassistant.helpers.event import async_track_time_interval -REQUIREMENTS = ['aioautomatic==0.6.0'] +REQUIREMENTS = ['aioautomatic==0.6.2'] DEPENDENCIES = ['http'] _LOGGER = logging.getLogger(__name__) diff --git a/requirements_all.txt b/requirements_all.txt index f1fc40a2187..9349c884272 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -42,7 +42,7 @@ TwitterAPI==2.4.6 abodepy==0.7.1 # homeassistant.components.device_tracker.automatic -aioautomatic==0.6.0 +aioautomatic==0.6.2 # homeassistant.components.sensor.dnsip aiodns==1.1.1 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 74717aa7d7b..f286555833e 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -27,7 +27,7 @@ PyJWT==1.5.2 SoCo==0.12 # homeassistant.components.device_tracker.automatic -aioautomatic==0.6.0 +aioautomatic==0.6.2 # homeassistant.components.emulated_hue # homeassistant.components.http From 308b822832b423765fdd6ecd2209d4cd7dae4eed Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Sat, 26 Aug 2017 17:00:59 -0700 Subject: [PATCH 7/9] Wrap state when iterating a domain in templates (#9157) --- homeassistant/helpers/template.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/helpers/template.py b/homeassistant/helpers/template.py index aa6ca186a8e..bdef5541983 100644 --- a/homeassistant/helpers/template.py +++ b/homeassistant/helpers/template.py @@ -209,7 +209,7 @@ class DomainStates(object): def __iter__(self): """Return the iteration over all the states.""" return iter(sorted( - (state for state in self._hass.states.async_all() + (_wrap_state(state) for state in self._hass.states.async_all() if state.domain == self._domain), key=lambda state: state.entity_id)) From 3509ecf07ff7fca7a3409e28462ac39ba12cc948 Mon Sep 17 00:00:00 2001 From: mjj4791 Date: Mon, 28 Aug 2017 18:09:36 +0200 Subject: [PATCH 8/9] Prevent iCloud exceptions in logfile (#9179) * Prevent iCloud exceptions in logfile With this change ValueError exceptions in the logfile caused by this component will disappear. These errors are caused by the iCloud API returning an HTTP 450 error and the external lib throwing a ValueError because of it. A PR has been raised against the external library, but that fix did not yet make it into a new version of the library. This will catch the exception in the mean time.... https://github.com/picklepete/pyicloud/pull/138 * Align log messages --- .../components/device_tracker/icloud.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/homeassistant/components/device_tracker/icloud.py b/homeassistant/components/device_tracker/icloud.py index f20dad1fceb..e670287dd87 100644 --- a/homeassistant/components/device_tracker/icloud.py +++ b/homeassistant/components/device_tracker/icloud.py @@ -307,12 +307,15 @@ class Icloud(DeviceScanner): self.api.authenticate() currentminutes = dt_util.now().hour * 60 + dt_util.now().minute - for devicename in self.devices: - interval = self._intervals.get(devicename, 1) - if ((currentminutes % interval == 0) or - (interval > 10 and - currentminutes % interval in [2, 4])): - self.update_device(devicename) + try: + for devicename in self.devices: + interval = self._intervals.get(devicename, 1) + if ((currentminutes % interval == 0) or + (interval > 10 and + currentminutes % interval in [2, 4])): + self.update_device(devicename) + except ValueError: + _LOGGER.debug("iCloud API returned an error") def determine_interval(self, devicename, latitude, longitude, battery): """Calculate new interval.""" @@ -397,7 +400,7 @@ class Icloud(DeviceScanner): self.see(**kwargs) self.seen_devices[devicename] = True except PyiCloudNoDevicesException: - _LOGGER.error('No iCloud Devices found!') + _LOGGER.error("No iCloud Devices found") def lost_iphone(self, devicename): """Call the lost iPhone function if the device is found.""" From 0ccff6c03e2be946dd9c090772c485fb327401b1 Mon Sep 17 00:00:00 2001 From: Nolan Gilley Date: Mon, 28 Aug 2017 11:12:21 -0400 Subject: [PATCH 9/9] bump ecobee version to fix issue 9190 (#9191) --- homeassistant/components/ecobee.py | 2 +- requirements_all.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/ecobee.py b/homeassistant/components/ecobee.py index 9e74299e6bc..c4b0f2e9546 100644 --- a/homeassistant/components/ecobee.py +++ b/homeassistant/components/ecobee.py @@ -15,7 +15,7 @@ from homeassistant.helpers import discovery from homeassistant.const import CONF_API_KEY from homeassistant.util import Throttle -REQUIREMENTS = ['python-ecobee-api==0.0.8'] +REQUIREMENTS = ['python-ecobee-api==0.0.9'] _CONFIGURING = {} _LOGGER = logging.getLogger(__name__) diff --git a/requirements_all.txt b/requirements_all.txt index 9349c884272..7ec81558945 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -716,7 +716,7 @@ python-clementine-remote==1.0.1 python-digitalocean==1.12 # homeassistant.components.ecobee -python-ecobee-api==0.0.8 +python-ecobee-api==0.0.9 # homeassistant.components.climate.eq3btsmart # python-eq3bt==0.1.5