tuya / tuya-home-assistant

Home Assistant integration for controlling Powered by Tuya (PBT) devices using Tuya Open API, maintained by the Home Assistant Community and Tuya Developer Team.
MIT License
857 stars 206 forks source link

Support Dual-Network Security System (Tuya Wifi Alarm) #339

Open burnworld3d opened 2 years ago

burnworld3d commented 2 years ago

Device normal info

Device info like this:

{ "active_time": 1610558260, "biz_type": 18, "category": "mal", "create_time": 1610558260, "icon": "smart/icon/ay1544185183501IhqNw/1e8e8e2b7d484cf08c35a389ded75028.png", "id": "51020483f4cfa2e7225b", "ip": "", "lat": "", "local_key": "", "lon": "", "name": "Alarma", "online": true, "owner_id": "10843xxxx", "product_id": "t0fxulygeftpwe2o", "product_name": "Dual-Network Security System", "status": [ { "code": "master_mode", "value": "disarmed" }, { "code": "delay_set", "value": 30 }, { "code": "alarm_time", "value": 3 }, { "code": "switch_alarm_sound", "value": true }, { "code": "temper_alarm", "value": false }, { "code": "switch_mode_sound", "value": true }, { "code": "charge_state", "value": true }, { "code": "battery_percentage", "value": 60 }, { "code": "switch_low_battery", "value": true }, { "code": "alarm_call_number", "value": "AQUBAQxxxxxxxxxxxx5" }, { "code": "alarm_sms_number", "value": "Axxxxxxxxxxxx" }, { "code": "switch_alarm_call", "value": true }, { "code": "switch_alarm_sms", "value": false }, { "code": "call_looptimes", "value": 1 }, { "code": "muffling", "value": false }, { "code": "alarm_msg", "value": "AFMAaQBzAHQAZQBtAGEAIABExxxxxxxxxxxxxxxxxxxxxxxxxxxxQBhACk=" }, { "code": "switch_alarm_propel", "value": false }, { "code": "alarm_delay_time", "value": 30 }, { "code": "switch_mode_dl_sound", "value": false }, { "code": "master_state", "value": "normal" }, { "code": "master_information", "value": "" }, { "code": "factory_reset", "value": false }, { "code": "sub_admin", "value": "AgADAAEC////GgBTAGUAbgBzAxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" } ], "sub": false, "time_zone": "+01:00", "uid": "***", "update_time": 1628596297, "uuid": "xxxx483f4cfa2e7225b" }

Device specifications

2021-08-11 16:32:29 DEBUG (SyncWorker_0) [tuya iot] Request: method = GET, url = https://openapi.tuyaus.com/v1.0/devices/51020483f4cfa2xxxxxxx/specifications, params = None, body = None, t = 1628692349579 2021-08-11 16:32:29 DEBUG (SyncWorker_0) [tuya iot] Response: { "result": { "category": "mal", "functions": [ { "code": "master_mode", "type": "Enum", "values": "{\"range\":[\"disarmed\",\"arm\",\"home\",\"sos\"]}" }, { "code": "delay_set", "type": "Integer", "values": "{\"unit\":\"秒\",\"min\":0,\"max\":300,\"scale\":0,\"step\":1}" }, { "code": "alarm_time", "type": "Integer", "values": "{\"unit\":\"分钟\",\"min\":1,\"max\":60,\"scale\":0,\"step\":1}" }, { "code": "switch_alarm_sound", "type": "Boolean", "values": "{}" }, { "code": "switch_mode_sound", "type": "Boolean", "values": "{}" }, { "code": "switch_low_battery", "type": "Boolean", "values": "{}" }, { "code": "alarm_call_number", "type": "Raw", "values": "{}" }, { "code": "alarm_sms_number", "type": "Raw", "values": "{}" }, { "code": "switch_alarm_call", "type": "Boolean", "values": "{}" }, { "code": "switch_alarm_sms", "type": "Boolean", "values": "{}" }, { "code": "call_looptimes", "type": "Integer", "values": "{\"unit\":\"\",\"min\":1,\"max\":10,\"scale\":0,\"step\":1}" }, { "code": "muffling", "type": "Boolean", "values": "{}" }, { "code": "switch_alarm_propel", "type": "Boolean", "values": "{}" }, { "code": "alarm_delay_time", "type": "Integer", "values": "{\"unit\":\"秒\",\"min\":0,\"max\":300,\"scale\":0,\"step\":1}" }, { "code": "switch_mode_dl_sound", "type": "Boolean", "values": "{}" }, { "code": "master_state", "type": "Enum", "values": "{\"range\":[\"normal\",\"alarm\"]}" }, { "code": "factory_reset", "type": "Boolean", "values": "{}" }, { "code": "sub_admin", "type": "Raw", "values": "{}" } ], "status": [ { "code": "master_mode", "type": "Enum", "values": "{\"range\":[\"disarmed\",\"arm\",\"home\",\"sos\"]}" }, { "code": "delay_set", "type": "Integer", "values": "{\"unit\":\"秒\",\"min\":0,\"max\":300,\"scale\":0,\"step\":1}" }, { "code": "alarm_time", "type": "Integer", "values": "{\"unit\":\"分钟\",\"min\":1,\"max\":60,\"scale\":0,\"step\":1}" }, { "code": "switch_alarm_sound", "type": "Boolean", "values": "{}" }, { "code": "temper_alarm", "type": "Boolean", "values": "{}" }, { "code": "switch_mode_sound", "type": "Boolean", "values": "{}" }, { "code": "charge_state", "type": "Boolean", "values": "{}" }, { "code": "battery_percentage", "type": "Integer", "values": "{\"unit\":\"%\",\"min\":0,\"max\":100,\"scale\":0,\"step\":1}" }, { "code": "switch_low_battery", "type": "Boolean", "values": "{}" }, { "code": "alarm_call_number", "type": "Raw", "values": "{}" }, { "code": "alarm_sms_number", "type": "Raw", "values": "{}" }, { "code": "switch_alarm_call", "type": "Boolean", "values": "{}" }, { "code": "switch_alarm_sms", "type": "Boolean", "values": "{}" }, { "code": "call_looptimes", "type": "Integer", "values": "{\"unit\":\"\",\"min\":1,\"max\":10,\"scale\":0,\"step\":1}" }, { "code": "muffling", "type": "Boolean", "values": "{}" }, { "code": "alarm_msg", "type": "Raw", "values": "{}" }, { "code": "switch_alarm_propel", "type": "Boolean", "values": "{}" }, { "code": "alarm_delay_time", "type": "Integer", "values": "{\"unit\":\"秒\",\"min\":0,\"max\":300,\"scale\":0,\"step\":1}" }, { "code": "switch_mode_dl_sound", "type": "Boolean", "values": "{}" }, { "code": "master_state", "type": "Enum", "values": "{\"range\":[\"normal\",\"alarm\"]}" }, { "code": "master_information", "type": "String", "values": "{\"maxlen\":255}" }, { "code": "factory_reset", "type": "Boolean", "values": "{}" }, { "code": "sub_admin", "type": "Raw", "values": "{}" } ] }, "success": true, "t": 1628692349730 }

thanoskas commented 2 years ago

Similar Device: Digoo Hama or PGST PG-107

{ "active_time": 1591188068, "biz_type": 18, "category": "mal", "create_time": 1589531860, "icon": "smart/icon/ay15500268672065IQ53/f4d96a760d09c7f67c08497c87d7e196.jpg", "id": "02375607ecfabc55b70c", "ip": "", "lat": "", "local_key": "", "lon": "", "model": "PG", "name": "HAMB alarm", "online": true, "owner_id": "11448855", "product_id": "a4xyigjpkcmfafvh", "product_name": "Multifunction alarm", "status": [ { "code": "master_mode", "value": "disarmed" }, { "code": "delay_set", "value": 40 }, { "code": "alarm_time", "value": 2 }, { "code": "switch_alarm_sound", "value": false }, { "code": "switch_alarm_light", "value": true }, { "code": "switch_kb_sound", "value": false }, { "code": "switch_kb_light", "value": false }, { "code": "alarm_call_number", "value": "Axxxxxxxxxxxxx" }, { "code": "switch_alarm_call", "value": false }, { "code": "switch_alarm_sms", "value": false }, { "code": "alarm_msg", "value": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "code": "alarm_delay_time", "value": 30 }, { "code": "sub_class", "value": "remote_controller" }, { "code": "sub_admin", "value": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, { "code": "sub_state", "value": "normal" } ], "sub": false, "time_zone": "+02:00", "uid": "***", "update_time": 1628453643, "uuid": "02375607ecfabc55b70c" },

2021-08-11 16:52:48 DEBUG (SyncWorker_6) [tuya iot] Request: method = GET, url = https://openapi.tuyaeu.com/v1.0/devices/02375607ecfabc55b70c/specifications, params = None, body = None, t = 1628xxxxxxxxxxxxxxxx 2021-08-11 16:52:48 DEBUG (SyncWorker_6) [tuya iot] Response: { "result": { "category": "mal", "functions": [ { "code": "master_mode", "type": "Enum", "values": "{\"range\":[\"disarmed\",\"arm\",\"home\",\"sos\"]}" }, { "code": "delay_set", "type": "Integer", "values": "{\"unit\":\"s\",\"min\":0,\"max\":300,\"scale\":0,\"step\":1}" }, { "code": "alarm_time", "type": "Integer", "values": "{\"unit\":\"min\",\"min\":0,\"max\":60,\"scale\":0,\"step\":1}" }, { "code": "switch_alarm_sound", "type": "Boolean", "values": "{}" }, { "code": "switch_alarm_light", "type": "Boolean", "values": "{}" }, { "code": "switch_kb_sound", "type": "Boolean", "values": "{}" }, { "code": "switch_kb_light", "type": "Boolean", "values": "{}" }, { "code": "alarm_call_number", "type": "Raw", "values": "{}" }, { "code": "switch_alarm_call", "type": "Boolean", "values": "{}" }, { "code": "switch_alarm_sms", "type": "Boolean", "values": "{}" }, { "code": "alarm_delay_time", "type": "Integer", "values": "{\"unit\":\"s\",\"min\":0,\"max\":300,\"scale\":0,\"step\":1}" }, { "code": "sub_class", "type": "Enum", "values": "{\"range\":[\"remote_controller\",\"detector\"]}" }, { "code": "sub_admin", "type": "Raw", "values": "{}" } ], "status": [ { "code": "master_mode", "type": "Enum", "values": "{\"range\":[\"disarmed\",\"arm\",\"home\",\"sos\"]}" }, { "code": "delay_set", "type": "Integer", "values": "{\"unit\":\"s\",\"min\":0,\"max\":300,\"scale\":0,\"step\":1}" }, { "code": "alarm_time", "type": "Integer", "values": "{\"unit\":\"min\",\"min\":0,\"max\":60,\"scale\":0,\"step\":1}" }, { "code": "switch_alarm_sound", "type": "Boolean", "values": "{}" }, { "code": "switch_alarm_light", "type": "Boolean", "values": "{}" }, { "code": "switch_kb_sound", "type": "Boolean", "values": "{}" }, { "code": "switch_kb_light", "type": "Boolean", "values": "{}" }, { "code": "alarm_call_number", "type": "Raw", "values": "{}" }, { "code": "switch_alarm_call", "type": "Boolean", "values": "{}" }, { "code": "switch_alarm_sms", "type": "Boolean", "values": "{}" }, { "code": "alarm_msg", "type": "Raw", "values": "{}" }, { "code": "alarm_delay_time", "type": "Integer", "values": "{\"unit\":\"s\",\"min\":0,\"max\":300,\"scale\":0,\"step\":1}" }, { "code": "sub_class", "type": "Enum", "values": "{\"range\":[\"remote_controller\",\"detector\"]}" }, { "code": "sub_admin", "type": "Raw", "values": "{}" }, { "code": "sub_state", "type": "Enum", "values": "{\"range\":[\"normal\",\"alarm\",\"fault\",\"others\"]}" } ] }, "success": true, "t": 162xxxxxxxxxxxxxxxxxxx }

johnw230873 commented 2 years ago

Afternoon burnworld3d, I have the same device, have you been able to build a custom driver yet. I started to follow the instructions but didn't have much luck.

cq74 commented 2 years ago

Support for PGST PG-107 would be really great.

vampywiz17 commented 2 years ago

Any info of this devices? it would be good, that we able to manage tuya based alarm systems.

AlanADV commented 1 year ago

Hello, Any update on this? How can anyone help? I've added another diagnostics file, for the new "Staniot Smart Security 4G" systems. tuya-567381765c8e2bb436d6597bb01069ca-Smart Security Panel-62d8b0dc6cde5ae878b8e5c4c261a94d.json.txt

A lot of useful properties/states of the alarm are present there and would be nice to be able to acces them as properties in HA.

vampywiz17 commented 1 year ago

Hello,

Not possible to manage alarm state to locally. This info is come to directly to the cloud. If you want to add it, try my solution. It working with alarm systems, doorbells, etc...

https://github.com/vampywiz17/tuyaiot2mqtt