Fix for magnet sensor open state - when opened long time

This commit is contained in:
2017-03-06 20:55:30 +03:00
parent 54eda12502
commit 86d6db496a
3 changed files with 9 additions and 3 deletions
+4 -2
View File
@@ -9,7 +9,7 @@ import mqtt
import yamlparser
from xiaomihub import XiaomiHub
logging.basicConfig(level=logging.DEBUG)
logging.basicConfig(level=logging.INFO)
_LOGGER = logging.getLogger(__name__)
def process_gateway_messages(gateway, client):
@@ -42,8 +42,10 @@ def read_motion_data(gateway, client, polling_interval, polling_models):
sid = device['sid']
sensor_resp = gateway.get_from_hub(sid)
if (sensor_resp == None):
continue;
if (sensor_resp['sid'] != sid):
print("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;
data = json.loads(sensor_resp['data'])