Fix for new aqara motion sensor
This commit is contained in:
+4
-2
@@ -9,6 +9,8 @@ _LOGGER = logging.getLogger(__name__)
|
|||||||
|
|
||||||
class Mqtt:
|
class Mqtt:
|
||||||
event_based_sensors = ["switch", "cube"]
|
event_based_sensors = ["switch", "cube"]
|
||||||
|
motion_sensors = ["motion", "sensor_motion.aq2"]
|
||||||
|
magnet_sensors = ["magnet"]
|
||||||
username = ""
|
username = ""
|
||||||
password = ""
|
password = ""
|
||||||
server = "localhost"
|
server = "localhost"
|
||||||
@@ -77,10 +79,10 @@ class Mqtt:
|
|||||||
items = {}
|
items = {}
|
||||||
for key, value in data.items():
|
for key, value in data.items():
|
||||||
# fix for latest motion value
|
# fix for latest motion value
|
||||||
if (model == "motion" and key == "no_motion"):
|
if (model in self.motion_sensors and key == "no_motion"):
|
||||||
key="status"
|
key="status"
|
||||||
value="no_motion"
|
value="no_motion"
|
||||||
if (model == "magnet" and key == "no_close"):
|
if (model in self.magnet_sensors and key == "no_close"):
|
||||||
key="status"
|
key="status"
|
||||||
value="open"
|
value="open"
|
||||||
# do not retain event-based sensors (like switches and cubes).
|
# do not retain event-based sensors (like switches and cubes).
|
||||||
|
|||||||
Reference in New Issue
Block a user