make-all / tuya-local

Local support for Tuya devices in Home Assistant
MIT License
1.42k stars 547 forks source link

Request support for Tuya Alarm - Digoo HamB #2399

Closed fotis3d closed 2 weeks ago

fotis3d commented 1 month ago

Log message

Device matches whm04_doorbell with quality of 33%. DPS: {"updated_at": 1729020140.1325095, "1": "disarmed", "2": 0, "3": 30, "4": false, "6": true, "12": false, "13": false, "20": false, "21": false, "28": 0, "101": "normal", "104": "TAMPER"}

DPS information

{
  "result": {
    "model": "{\"modelId\":\"0000003oce\",\"services\":[{\"actions\":[],\"code\":\"\",\"description\":\"\",\"events\":[],\"name\":\"默认服务\",\"properties\":[
{\"abilityId\":1,\"accessMode\":\"rw\",\"code\":\"master_mode\",\"description\":\"disarmed撤防 arm布防 home在家 sos紧急\",\"extensions\":{\"iconName\":\"icon-dp_mode\"},\"name\":\"主机模式\",\"typeSpec\":{\"type\":\"enum\",\"range\":[\"disarmed\",\"arm\",\"home\",\"sos\"]}},
{\"abilityId\":2,\"accessMode\":\"rw\",\"code\":\"delay_set\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-dp_time3\"},\"name\":\"延时设置\",\"typeSpec\":{\"type\":\"value\",\"max\":300,\"min\":0,\"scale\":0,\"step\":1,\"unit\":\"s\"}},
{\"abilityId\":3,\"accessMode\":\"rw\",\"code\":\"alarm_time\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-dp_time3\"},\"name\":\"警号鸣响时间\",\"typeSpec\":{\"type\":\"value\",\"max\":60,\"min\":0,\"scale\":0,\"step\":1,\"unit\":\"min\"}},
{\"abilityId\":4,\"accessMode\":\"rw\",\"code\":\"switch_alarm_sound\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-dp_power3\"},\"name\":\"奥德赛\",\"typeSpec\":{\"type\":\"bool\"}},
{\"abilityId\":6,\"accessMode\":\"rw\",\"code\":\"switch_alarm_light\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-dp_power3\"},\"name\":\"报警灯开关1\",\"typeSpec\":{\"type\":\"bool\"}},
{\"abilityId\":12,\"accessMode\":\"rw\",\"code\":\"switch_kb_sound\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-yinliang\"},\"name\":\"键盘按键音开关\",\"typeSpec\":{\"type\":\"bool\"}},
{\"abilityId\":13,\"accessMode\":\"rw\",\"code\":\"switch_kb_light\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-dp_light\"},\"name\":\"键盘背光\",\"typeSpec\":{\"type\":\"bool\"}},
{\"abilityId\":18,\"accessMode\":\"rw\",\"code\":\"alarm_call_number\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-baojing\"},\"name\":\"报警电话号码\",\"typeSpec\":{\"type\":\"raw\",\"maxlen\":128}},
{\"abilityId\":20,\"accessMode\":\"rw\",\"code\":\"switch_alarm_call\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-baojing\"},\"name\":\"报警电话开关\",\"typeSpec\":{\"type\":\"bool\"}},
{\"abilityId\":21,\"accessMode\":\"rw\",\"code\":\"switch_alarm_sms\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-baojing\"},\"name\":\"报警短信开关\",\"typeSpec\":{\"type\":\"bool\"}},
{\"abilityId\":24,\"accessMode\":\"rw\",\"code\":\"zone_attribute\",\"description\":\"0-留守布放有效;1-外出布放有效;2-24小时有效;3-关闭;4-门铃;5-24小时无声;6-留守布放有效(无延时);7-外出布放有效(无延时)\",\"extensions\":{\"iconName\":\"icon-air_quality\"},\"name\":\"防区属性\",\"typeSpec\":{\"type\":\"enum\",\"range\":[\"MODE_HOME_ARM\",\"MODE_ARM\",\"MODE_24\",\"MODE_OFF\",\"MODE_DOORBELL\",\"MODE_24_SILENT\",\"HOME_ARM_NO_DELAY\",\"ARM_NO_DELAY\"]}},
{\"abilityId\":26,\"accessMode\":\"ro\",\"code\":\"alarm_msg\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-baojing\"},\"name\":\"告警信息\",\"typeSpec\":{\"type\":\"raw\",\"maxlen\":128}},
{\"abilityId\":28,\"accessMode\":\"rw\",\"code\":\"alarm_delay_time\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-baojing\"},\"name\":\"告警后延时报警\",\"typeSpec\":{\"type\":\"value\",\"max\":300,\"min\":0,\"scale\":0,\"step\":1,\"unit\":\"s\"}},
{\"abilityId\":36,\"accessMode\":\"rw\",\"code\":\"sub_class\",\"description\":\"0-遥控器 1-探测器 2-插座\",\"extensions\":{\"iconName\":\"icon-dp_mode\"},\"name\":\"子设备品类\",\"typeSpec\":{\"type\":\"enum\",\"range\":[\"remote_controller\",\"detector\",\"socket\"]}},
{\"abilityId\":37,\"accessMode\":\"rw\",\"code\":\"sub_type\",\"description\":\"0-系统警情、1-主门报警、2-大厅报警、3-求救报警、4-卧室报警、5-窗户报警、6-阳台报警、7-周界报警、8-烟雾报警、9-燃气泄露、10-一氧化碳、11-漏水报警 \",\"extensions\":{\"iconName\":\"icon-dp_mode\"},\"name\":\"设备类型\",\"typeSpec\":{\"type\":\"enum\",\"range\":[\"OTHER\",\"DOOR\",\"PIR\",\"SOS\",\"ROOM\",\"WINDOW\",\"BALCONY\",\"FENCE\",\"SMOKE\",\"GAS\",\"CO\",\"WATER\"]}},
{\"abilityId\":38,\"accessMode\":\"rw\",\"code\":\"sub_admin\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-dp_mode\"},\"name\":\"子设备管理\",\"typeSpec\":{\"type\":\"raw\",\"maxlen\":128}},
{\"abilityId\":39,\"accessMode\":\"ro\",\"code\":\"sub_state\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-zhuangtai\"},\"name\":\"子设备状态\",\"typeSpec\":{\"type\":\"enum\",\"range\":[\"normal\",\"alarm\",\"fault\",\"others\"]}},
{\"abilityId\":101,\"accessMode\":\"ro\",\"code\":\"PowerEvent\",\"description\":\"0正常\\n1主电源断开\\n2电池电量不足\",\"name\":\"电源状态信息\",\"typeSpec\":{\"type\":\"enum\",\"range\":[\"normal\",\"powerDisconnect\",\"BatteryIsLow\"]}},
{\"abilityId\":103,\"accessMode\":\"ro\",\"code\":\"zone_number\",\"description\":\"推送指令   报警类型 + 防区名称\",\"name\":\"防区号\",\"typeSpec\":{\"type\":\"raw\",\"maxlen\":128}},
{\"abilityId\":104,\"accessMode\":\"ro\",\"code\":\"OtherEvent\",\"description\":\"0:正常;\\n1:防撬报警\",\"extensions\":{\"trigger\":\"direct\"},\"name\":\"其他事件\",\"typeSpec\":{\"type\":\"enum\",\"range\":[\"NORMAL\",\"TAMPER\"]}}]}]}"
  },

Product ID

a4xyigjpkcmfafvh

Product Name

报警主机PG

Information about how the device functions

Mainly as an alarm has home arm/away arm/disarm/sos.

You can do those funtions with RF remote which is what I am doing with a Sonoff RF Bridge via mqtt.

The most import thing is to get local the status (home/away arm, disarmed).

fotis3d commented 1 month ago

FYI even the Tuya intergration brings only home arm/away arm/disarm and the status.

make-all commented 1 month ago

There should be a log message in the Home Assistant log when that "unsupported devices to choose from" occurs. Without that, it is difficult to provide support.

fotis3d commented 1 month ago

Ok sorry here it is.

This error originated from a custom integration.

Logger: custom_components.tuya_local.config_flow Source: custom_components/tuya_local/config_flow.py:485 integration: Tuya Local (documentation, issues) First occurred: October 15, 2024 at 22:22:22 (3 occurrences) Last logged: 07:12:47

Device matches whm04_doorbell with quality of 33%. DPS: {"updated_at": 1729020140.1325095, "1": "disarmed", "2": 0, "3": 30, "4": false, "6": true, "12": false, "13": false, "20": false, "21": false, "28": 0, "101": "normal", "104": "TAMPER"} Device matches whm04_doorbell with quality of 33%. DPS: {"updated_at": 1729020218.1887238, "1": "disarmed", "2": 0, "3": 30, "4": false, "6": true, "12": false, "13": false, "20": false, "21": false, "28": 0, "101": "normal", "104": "TAMPER"} Device matches whm04_doorbell with quality of 33%. DPS: {"updated_at": 1729051964.8444636, "1": "disarmed", "2": 0, "3": 30, "4": false, "6": true, "12": false, "13": false, "20": false, "21": false, "28": 0, "101": "normal", "104": "TAMPER"}

fotis3d commented 1 month ago

I also own a Tuya PGST 107 wifi alarm which I have never used and had gotten it as a spare thinking it is the same. If this one Digoo gets included I will also try to add the PGST 107 in order to add it also in the list of devices that work. If it will work.

Thanks for your time and support

fotis3d commented 3 weeks ago

@make-all Hi. Thanks for your support.

I add it choosing as device the "whm04_doorbell" when the list appears.

I get the below entities but none of them seam to do anything.

image

I cannot at least see the status (armed/disarmed etc).

Am I doing something wrong ? Should I try other devices instead of "whm04_doorbell" ?

Thanks again :)

make-all commented 3 weeks ago

There should be a separate config for digoo_hamb_alarm

fotis3d commented 3 weeks ago

Yes there is one but how do I make use of that ?

I have not quite understand.

I connect the device and have to choose one of the below right ?

image

And then some entities are created that basically do not respond to anything.

How do I point the device to the specific config file ?

Thanks again for your effort

make-all commented 3 weeks ago

What is the log message that is output when you see that list? It will contain the clue as to why the digoo_hamb_alarm is not being detected as compatible at dps level.

When the log message at the top is used, the result is as follows, so something must have changed in the behaviour of the device between then and now. It is not uncommon to require 2 or 3 iterations before a tuya device can be reliably detected.

python util/best_match.py '{"1": "disarmed", "2": 0, "3": 30, "4": false, "6": true, "12": false, "13": false, "20": false, "21": false, "28": 0, "101": "normal", "104": "TAMPER"}'

digoo_hamb_alarm matched 100%
  alarm_control_panel:
   alarm_state: disarmed
   trigger: False
   sub_class: None
   sub_type: None
   sub_admin: None
   sub_state: None
  number_exit_delay:
    value: 0
  number_alarm_time:
    value: 30
  switch_alarm_sound:
    switch: False
  switch_alarm_light:
    switch: True
  switch_keytone:
    switch: False
  light_backlight:
    switch: False
  switch_alarm_call:
    switch: False
    phone_number: None
  switch_alarm_sms:
    switch: False
  select_zone_activation:
    option: None
    zone: None
  event_alarm:
    event: None
    message: None
  number_entry_delay:
    value: 0
  binary_sensor_plug:
    sensor: True
  binary_sensor_battery:
    sensor: False
  binary_sensor_tamper:
    sensor: True
fotis3d commented 3 weeks ago

I get these . At the list I choose the doorbell.

image

image

image

fotis3d commented 3 weeks ago

I also have intergrated via Tuya. Could this be a problem ?

make-all commented 3 weeks ago

No, the problem is that in the original report, the TAMPER alarm was being reported on dp 104, but now it is not reported at all. The original config assumed that the dp would always be reported as either "NORMAL" or "TAMPER" as the dp info said.

fotis3d commented 3 weeks ago

Oh ok. Do you need anything from me that might help? Thanks again

make-all commented 3 weeks ago

I think it is fixed, so it only needs testing. If you can copy the latest digoo_hamb_alarm.yaml file into your local install (replacing the one that is there), then that can be done immediately, but otherwise it can be after the next release.

fotis3d commented 3 weeks ago

@make-all You are awesome.

It worked. It gave me 15 entities.

I can not test them all now but everyone I tried worked beautifully. :)

image

When I get back from work I will do more testing and on the next days I will also try my PGST PG-107 to see if it is the same in order for you to include it also in the devices.

Thank you very much for you precious help :)

fotis3d commented 3 weeks ago

@make-all I did some tests and everything seams to work fine.

I miss only the "sos" command but this is no issue at all since I can send that via RF control remote or Sonoff RF bridge.

Now I connected also my spare alarm PG-107 (this could also be under Gautone brand) but it connects with the Gautone PG-103 at the list of devices and thus it gives 10 entities instead of 15 that the Digoo gives and they are almost identical.

Is there a way of connecting it at the same yaml as the Digoo or would you like to open a new request and do the same procedure for DPs etc ?

Thanks

make-all commented 3 weeks ago

The "sos" command should be mapped to the alarm_control_panel.trigger service. I am not sure what the alarm_control_panel UI is in HA, but you could map this to a button that calls that service.

make-all commented 3 weeks ago

You should file another request for the other alarm. Or if you are sure it is a clone of this Digoo alarm, post the log message when adding it here.

fotis3d commented 2 weeks ago

I forgot to mention one thing to improve. I have changed the below lines at least at my yaml file to be more accurate to the alarm functions.

image

The alarm bell is basically the arm_beep to the central unit BUT the light controlls the SIREN.