SORRY! Fix for broken motion/door state!
This commit is contained in:
@@ -0,0 +1,11 @@
|
|||||||
|
#SHELL := /bin/bash
|
||||||
|
|
||||||
|
ARGS = `arg="$(filter-out $@,$(MAKECMDGOALS))" && echo $${arg:-${1}}`
|
||||||
|
|
||||||
|
commit:
|
||||||
|
git add .
|
||||||
|
git commit -m "$(call ARGS,\"updating to lastest local code\")"
|
||||||
|
git push
|
||||||
|
|
||||||
|
%:
|
||||||
|
@:
|
||||||
+3
-1
@@ -1,5 +1,7 @@
|
|||||||
aqara:
|
aqara:
|
||||||
image: monster1025/aqara-mqtt:1-armhf
|
#image: monster1025/aqara-mqtt:1-armhf
|
||||||
|
build: .
|
||||||
|
dockerfile: Dockerfile-armhf
|
||||||
container_name: aqara
|
container_name: aqara
|
||||||
volumes:
|
volumes:
|
||||||
- "./config:/app/config"
|
- "./config:/app/config"
|
||||||
|
|||||||
+7
-5
@@ -74,6 +74,7 @@ class Mqtt:
|
|||||||
model = sidprops.get("model",model)
|
model = sidprops.get("model",model)
|
||||||
sid = sidprops.get("name",sid)
|
sid = sidprops.get("name",sid)
|
||||||
|
|
||||||
|
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 == "motion" and key == "no_motion"):
|
||||||
@@ -88,23 +89,24 @@ class Mqtt:
|
|||||||
# fix for rgb format
|
# fix for rgb format
|
||||||
if (key == "rgb" and self._is_int(value)):
|
if (key == "rgb" and self._is_int(value)):
|
||||||
value = self._color_xiaomi_to_rgb(value)
|
value = self._color_xiaomi_to_rgb(value)
|
||||||
|
items[key] = value
|
||||||
|
|
||||||
if self.json == True:
|
if self.json == True:
|
||||||
PATH_FMT = self.prefix + "/{model}/{sid}/json"
|
PATH_FMT = self.prefix + "/{model}/{sid}/json"
|
||||||
topic = PATH_FMT.format(model=model, sid=sid)
|
topic = PATH_FMT.format(model=model, sid=sid)
|
||||||
values = {}
|
values = {}
|
||||||
values['sid'] = sid
|
values['sid'] = sid
|
||||||
for key, value in data.items():
|
for key in items:
|
||||||
values[key] = value
|
values[key] = items[key]
|
||||||
jsondata = json.dumps(values)
|
jsondata = json.dumps(values)
|
||||||
_LOGGER.info("Publishing message to topic " + topic + ": " + str(jsondata) + ".")
|
_LOGGER.info("Publishing message to topic " + topic + ": " + str(jsondata) + ".")
|
||||||
self._client.publish(topic, payload=jsondata, qos=0, retain=retain)
|
self._client.publish(topic, payload=jsondata, qos=0, retain=retain)
|
||||||
else:
|
else:
|
||||||
for key, value in data.items():
|
for key in items:
|
||||||
PATH_FMT = self.prefix + "/{model}/{sid}/{prop}"
|
PATH_FMT = self.prefix + "/{model}/{sid}/{prop}"
|
||||||
topic = PATH_FMT.format(model=model, sid=sid, prop=key)
|
topic = PATH_FMT.format(model=model, sid=sid, prop=key)
|
||||||
_LOGGER.info("Publishing message to topic " + topic + ": " + str(value) + ".")
|
_LOGGER.info("Publishing message to topic " + topic + ": " + str(items[key]) + ".")
|
||||||
self._client.publish(topic, payload=value, qos=0, retain=retain)
|
self._client.publish(topic, payload=items[key], qos=0, retain=retain)
|
||||||
|
|
||||||
def _mqtt_on_connect(self, client, userdata, rc, unk):
|
def _mqtt_on_connect(self, client, userdata, rc, unk):
|
||||||
_LOGGER.info("Connected to mqtt server.")
|
_LOGGER.info("Connected to mqtt server.")
|
||||||
|
|||||||
Reference in New Issue
Block a user