Compile before

This commit is contained in:
raspberry
2018-02-22 10:10:08 +03:00
parent 3e5e71035d
commit 0f9a759839
2 changed files with 16 additions and 14 deletions
+6 -3
View File
@@ -1,8 +1,11 @@
#SHELL := /bin/bash
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 commit -m "$(call ARGS,\"updating to lastest local code\")"
git push
+5 -6
View File
@@ -1,7 +1,6 @@
import logging
import time
import threading
import os
import json
import signal
@@ -41,16 +40,16 @@ def read_motion_data(gateway, client, polling_interval, polling_models, stop_eve
devices = gateway.XIAOMI_DEVICES[device_type]
for device in devices:
model = device.get("model", "")
if (model not in polling_models):
if model not in polling_models:
continue
sid = device['sid']
sensor_resp = gateway.get_from_hub(sid)
if (sensor_resp == None):
continue;
if (sensor_resp['sid'] != sid):
if sensor_resp is None:
continue
if sensor_resp['sid'] != sid:
_LOGGER.error("Error: Response sid(" + sensor_resp['sid'] + ") differs from requested(" + sid + "). Skipping.")
continue;
continue
data = json.loads(sensor_resp['data'])
state = data.get("status", None)