From f65e57bf7bcf2d997f9895142f2e5ebeac5100d4 Mon Sep 17 00:00:00 2001 From: Jason Hunter Date: Wed, 12 Dec 2018 09:54:25 -0500 Subject: [PATCH 1/3] Add automation and script events to logbook event types (#19219) --- homeassistant/components/logbook.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/logbook.py b/homeassistant/components/logbook.py index 78da5733a06..79ee728ddd7 100644 --- a/homeassistant/components/logbook.py +++ b/homeassistant/components/logbook.py @@ -60,7 +60,8 @@ CONFIG_SCHEMA = vol.Schema({ ALL_EVENT_TYPES = [ EVENT_STATE_CHANGED, EVENT_LOGBOOK_ENTRY, EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP, - EVENT_ALEXA_SMART_HOME, EVENT_HOMEKIT_CHANGED + EVENT_ALEXA_SMART_HOME, EVENT_HOMEKIT_CHANGED, + EVENT_AUTOMATION_TRIGGERED, EVENT_SCRIPT_STARTED ] LOG_MESSAGE_SCHEMA = vol.Schema({ From ced96775fe71bb6bc42c6a644ffae47794cc3802 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Wed, 12 Dec 2018 17:17:27 +0100 Subject: [PATCH 2/3] Fix owntracks topic in encrypted ios (#19220) * Fix owntracks topic * Warn if per-topic secret and using HTTP --- homeassistant/components/device_tracker/owntracks.py | 9 +++++++-- homeassistant/components/owntracks/__init__.py | 9 +++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/homeassistant/components/device_tracker/owntracks.py b/homeassistant/components/device_tracker/owntracks.py index ae2b9d6146b..e85ebbe6fe1 100644 --- a/homeassistant/components/device_tracker/owntracks.py +++ b/homeassistant/components/device_tracker/owntracks.py @@ -316,14 +316,19 @@ async def async_handle_waypoints_message(hass, context, message): @HANDLERS.register('encrypted') async def async_handle_encrypted_message(hass, context, message): """Handle an encrypted message.""" - plaintext_payload = _decrypt_payload(context.secret, message['topic'], + if 'topic' not in message and isinstance(context.secret, dict): + _LOGGER.error("You cannot set per topic secrets when using HTTP") + return + + plaintext_payload = _decrypt_payload(context.secret, message.get('topic'), message['data']) if plaintext_payload is None: return decrypted = json.loads(plaintext_payload) - decrypted['topic'] = message['topic'] + if 'topic' in message and 'topic' not in decrypted: + decrypted['topic'] = message['topic'] await async_handle_message(hass, context, decrypted) diff --git a/homeassistant/components/owntracks/__init__.py b/homeassistant/components/owntracks/__init__.py index 7dc88be9764..5e6a99741e8 100644 --- a/homeassistant/components/owntracks/__init__.py +++ b/homeassistant/components/owntracks/__init__.py @@ -137,15 +137,16 @@ async def handle_webhook(hass, webhook_id, request): user = headers.get('X-Limit-U') device = headers.get('X-Limit-D', user) - if user is None: + if user: + topic_base = re.sub('/#$', '', context.mqtt_topic) + message['topic'] = '{}/{}/{}'.format(topic_base, user, device) + + elif message['_type'] != 'encrypted': _LOGGER.warning('No topic or user found in message. If on Android,' ' set a username in Connection -> Identification') # Keep it as a 200 response so the incorrect packet is discarded return json_response([]) - topic_base = re.sub('/#$', '', context.mqtt_topic) - message['topic'] = '{}/{}/{}'.format(topic_base, user, device) - hass.helpers.dispatcher.async_dispatcher_send( DOMAIN, hass, context, message) return json_response([]) From e2bf3ac0956ed2ce569e49a0c774933b74e92f08 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Wed, 12 Dec 2018 17:18:47 +0100 Subject: [PATCH 3/3] Bumped version to 0.84.1 --- homeassistant/const.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/const.py b/homeassistant/const.py index cd71c6d994c..21494691a46 100644 --- a/homeassistant/const.py +++ b/homeassistant/const.py @@ -2,7 +2,7 @@ """Constants used by Home Assistant components.""" MAJOR_VERSION = 0 MINOR_VERSION = 84 -PATCH_VERSION = '0' +PATCH_VERSION = '1' __short_version__ = '{}.{}'.format(MAJOR_VERSION, MINOR_VERSION) __version__ = '{}.{}'.format(__short_version__, PATCH_VERSION) REQUIRED_PYTHON_VER = (3, 5, 3)