Compile before
This commit is contained in:
@@ -1,8 +1,11 @@
|
|||||||
#SHELL := /bin/bash
|
|
||||||
|
|
||||||
ARGS = `arg="$(filter-out $@,$(MAKECMDGOALS))" && echo $${arg:-${1}}`
|
ARGS = `arg="$(filter-out $@,$(MAKECMDGOALS))" && echo $${arg:-${1}}`
|
||||||
|
|
||||||
commit:
|
lint:
|
||||||
|
rm -rf "src/__pycache__"
|
||||||
|
python3 -m compileall src
|
||||||
|
rm -rf "src/__pycache__"
|
||||||
|
|
||||||
|
commit: lint
|
||||||
git add .
|
git add .
|
||||||
git commit -m "$(call ARGS,\"updating to lastest local code\")"
|
git commit -m "$(call ARGS,\"updating to lastest local code\")"
|
||||||
git push
|
git push
|
||||||
|
|||||||
+5
-6
@@ -1,7 +1,6 @@
|
|||||||
import logging
|
import logging
|
||||||
import time
|
import time
|
||||||
import threading
|
import threading
|
||||||
import os
|
|
||||||
import json
|
import json
|
||||||
import signal
|
import signal
|
||||||
|
|
||||||
@@ -41,16 +40,16 @@ def read_motion_data(gateway, client, polling_interval, polling_models, stop_eve
|
|||||||
devices = gateway.XIAOMI_DEVICES[device_type]
|
devices = gateway.XIAOMI_DEVICES[device_type]
|
||||||
for device in devices:
|
for device in devices:
|
||||||
model = device.get("model", "")
|
model = device.get("model", "")
|
||||||
if (model not in polling_models):
|
if model not in polling_models:
|
||||||
continue
|
continue
|
||||||
sid = device['sid']
|
sid = device['sid']
|
||||||
|
|
||||||
sensor_resp = gateway.get_from_hub(sid)
|
sensor_resp = gateway.get_from_hub(sid)
|
||||||
if (sensor_resp == None):
|
if sensor_resp is None:
|
||||||
continue;
|
continue
|
||||||
if (sensor_resp['sid'] != sid):
|
if sensor_resp['sid'] != sid:
|
||||||
_LOGGER.error("Error: Response sid(" + sensor_resp['sid'] + ") differs from requested(" + sid + "). Skipping.")
|
_LOGGER.error("Error: Response sid(" + sensor_resp['sid'] + ") differs from requested(" + sid + "). Skipping.")
|
||||||
continue;
|
continue
|
||||||
|
|
||||||
data = json.loads(sensor_resp['data'])
|
data = json.loads(sensor_resp['data'])
|
||||||
state = data.get("status", None)
|
state = data.get("status", None)
|
||||||
|
|||||||
Reference in New Issue
Block a user