本帖最后由 jyz_0501 于 2018-3-9 01:08 编辑
不过只有两个传感器, 报警器没有,也没法设置状态~~~
def parse_status(self, sensor_type, sensor_status):
"""parse sensors status"""
if sensor_type == SENSOR_TYPE_DOOR_SENSOR and sensor_status in ("0", "128"):
return STATE_CLOSED
elif sensor_type == SENSOR_TYPE_DOOR_SENSOR and sensor_status in ("16", "144"):
return STATE_OPEN
elif sensor_type == SENSOR_TYPE_DOOR_SENSOR and sensor_status == "48":
return STATE_TAMPERED
elif sensor_type == SENSOR_TYPE_MOTION_SENSOR and sensor_status in ("0", "128"):
return STATE_NO_MOTION
elif sensor_type == SENSOR_TYPE_MOTION_SENSOR and sensor_status == "16":
return STATE_MOTION_DETECTED
elif sensor_type == SENSOR_TYPE_MOTION_SENSOR and sensor_status == "32":
return STATE_TAMPERED
elif sensor_type == SENSOR_TYPE_KEY_FOB and sensor_status == "16":
return STATE_ALARM_DISARMED
elif sensor_type == SENSOR_TYPE_KEY_FOB and sensor_status == "32":
return STATE_ALARM_ARMED_AWAY
elif sensor_type == SENSOR_TYPE_KEY_FOB and sensor_status == "64":
return STATE_ALARM_ARMED_HOME
elif sensor_type == SENSOR_TYPE_KEY_FOB and sensor_status in ("0", "128"):
return STATE_ALARM_SOS
else:
_LOGGER.debug("unknow status " + sensor_status + "for type " + sensor_type)
return STATE_UNKNOWN
看到作者写了,但是怎么没出现呢
|