From b390d044cc113c40b37e26ba60edeb3b51724fbd Mon Sep 17 00:00:00 2001 From: raspberry Date: Wed, 21 Feb 2018 21:05:24 +0300 Subject: [PATCH] Fix for new aqara motion sensor --- src/mqtt.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/mqtt.py b/src/mqtt.py index 7f4d864..8cd4a71 100644 --- a/src/mqtt.py +++ b/src/mqtt.py @@ -9,6 +9,8 @@ _LOGGER = logging.getLogger(__name__) class Mqtt: event_based_sensors = ["switch", "cube"] + motion_sensors = ["motion", "sensor_motion.aq2"] + magnet_sensors = ["magnet"] username = "" password = "" server = "localhost" @@ -77,10 +79,10 @@ class Mqtt: items = {} for key, value in data.items(): # fix for latest motion value - if (model == "motion" and key == "no_motion"): + if (model in self.motion_sensors and key == "no_motion"): key="status" value="no_motion" - if (model == "magnet" and key == "no_close"): + if (model in self.magnet_sensors and key == "no_close"): key="status" value="open" # do not retain event-based sensors (like switches and cubes).