zigpy / zha-device-handlers

ZHA device handlers bridge the functionality gap created when manufacturers deviate from the ZCL specification, handling deviations and exceptions by parsing custom messages to and from Zigbee devices.
Apache License 2.0
713 stars 660 forks source link

Tuya Siren (new) TS0601 by _TZE204_hcxvyxa5 #3255

Open Martijnsx opened 1 month ago

Martijnsx commented 1 month ago

Problem description

I have a tuya zigbee siren. It is a new model i guess. How can i get this working with ZHA? I can only see it in home assistant but it has no entities and can not be controlled (alarm fired).

TS0601 by _TZE204_hcxvyxa5

Solution description

That i can start and stop the alarm in home assistant and read it's status.

Screenshots/Video

Screenshots/Video [Paste/upload your media here]

Device signature

Device signature ```json [Paste the device signature here] ```

Diagnostic information

Diagnostic information ```json [Paste the diagnostic information here] ```

Logs

Logs ```python [Paste the logs here] ```

Custom quirk

Custom quirk ```python [Paste your custom quirk here] ```

Additional information

No response

Conchar commented 1 month ago

I recently received this item too, from here: https://www.aliexpress.us/item/3256806983895286.html All of my previous zigbee purchases just magically worked when paired with ZHA, so I had no idea of the constantly vigilant world of wonderful developers here until researching how to get this device to work. Thanks to all for your hard work!

I didn't see the original poster copy & paste the device signature, so I hope this helps:

"signature": {
  "node_descriptor": "NodeDescriptor(logical_type=<LogicalType.Router: 1>, complex_descriptor_available=0, user_descriptor_available=0, reserved=0, aps_flags=0, frequency_band=<FrequencyBand.Freq2400MHz: 8>, mac_capability_flags=<MACCapabilityFlags.FullFunctionDevice|MainsPowered|RxOnWhenIdle|AllocateAddress: 142>, manufacturer_code=4417, maximum_buffer_size=66, maximum_incoming_transfer_size=66, server_mask=10752, maximum_outgoing_transfer_size=66, descriptor_capability_field=<DescriptorCapability.NONE: 0>, *allocate_address=True, *is_alternate_pan_coordinator=False, *is_coordinator=False, *is_end_device=False, *is_full_function_device=True, *is_mains_powered=True, *is_receiver_on_when_idle=True, *is_router=True, *is_security_capable=False)",
  "endpoints": {
    "1": {
      "profile_id": "0x0104",
      "device_type": "0x0051",
      "input_clusters": [
        "0x0000",
        "0x0004",
        "0x0005",
        "0xef00"
      ],
      "output_clusters": [
        "0x000a",
        "0x0019"
      ]
    },
    "242": {
      "profile_id": "0xa1e0",
      "device_type": "0x0061",
      "input_clusters": [],
      "output_clusters": [
        "0x0021"
      ]
    }
  },
  "manufacturer": "_TZE204_hcxvyxa5",
  "model": "TS0601"
},
TheOddPerson commented 1 month ago

I have a similar device

"signature": {
      "node_descriptor": "NodeDescriptor(logical_type=<LogicalType.Router: 1>, complex_descriptor_available=0, user_descriptor_available=0, reserved=0, aps_flags=0, frequency_band=<FrequencyBand.Freq2400MHz: 8>, mac_capability_flags=<MACCapabilityFlags.FullFunctionDevice|MainsPowered|RxOnWhenIdle|AllocateAddress: 142>, manufacturer_code=4417, maximum_buffer_size=66, maximum_incoming_transfer_size=66, server_mask=10752, maximum_outgoing_transfer_size=66, descriptor_capability_field=<DescriptorCapability.NONE: 0>, *allocate_address=True, *is_alternate_pan_coordinator=False, *is_coordinator=False, *is_end_device=False, *is_full_function_device=True, *is_mains_powered=True, *is_receiver_on_when_idle=True, *is_router=True, *is_security_capable=False)",
      "endpoints": {
        "1": {
          "profile_id": "0x0104",
          "device_type": "0x0403",
          "input_clusters": [
            "0x0000",
            "0x0004",
            "0x0005",
            "0x0006",
            "0xef00"
          ],
          "output_clusters": [
            "0x000a",
            "0x0019"
          ]
        },
        "242": {
          "profile_id": "0xa1e0",
          "device_type": "0x0061",
          "input_clusters": [],
          "output_clusters": [
            "0x0021"
          ]
        }
      },
      "manufacturer": "_TZE204_hcxvyxa5",
      "model": "TS0601"
    },

I added ("_TZE204_hcxvyxa5", "TS0601") to ts0601_siren.py in TuyaSirenGPP_NoSensors and the device redetected with an on/off entity. When toggled on the siren sounds for 1 second and the toggle turns off automatically.

I'm reading through the quirks documentation to see if its within my grasp to make it work.

yurisat commented 1 month ago

With this implementation in Node-Red it was possible to increase the duration and change the melody. It wasn't done by me, unfortunately I don't remember where I got it. But it works, it's a way forward.

[{"id":"0c1810def209b6a6","type":"subflow","name":"Tuya Zigbee Siren","info":"**IEEE:** Is used to identify the siren to use. It can be found in the **Zigbee Info** for the device.\r\nExample: **a1:b2:34:5c:5d:67:ef:gh**\r\n\r\n**Sound:** Chooses the sound to play.\r\n\r\n**Duration:** Defines how long the siren will sound for in seconds.\r\n\r\n**Activate Siren:** Choses whether to fire the siren or not, it can also be used to stop an active siren. If you change other settings but choose to not fire the siren, those settings will still be applied for the next event unless they are again changed.\r\n\r\n\r\n# Table of Sounds\r\n - ## ID Sound\r\n - 0\tDoorbell Chime\r\n - 1\tFur Elise\r\n - 2\tWestminster Chimes\r\n - 3\tFast double door bell\r\n - 4\tWilliam Tell Overture\r\n - 5\tTurkish March\r\n - 6\tSafe/Security Alarm\r\n - 7\tChemical Spill Alert\r\n - 8\tPiercing Alarm Clock\r\n - 9\tSmoke Alarm\r\n - 10\tDog Barking\r\n - 11\tPolice Siren\r\n - 12\tDoorbell Chime (reverb)\r\n - 13\tMechanical Telephone\r\n - 14\tFire/Ambulance\r\n - 15\t3/1 Elevator\r\n - 16\tBuzzing Alarm Clock\r\n - 17\tSchool Bell\r\n\r\n","category":"","in":[{"x":80,"y":160,"wires":[{"id":"afe31aab2b1daaab"}]}],"out":[{"x":1290,"y":160,"wires":[{"id":"920a10178ba2a0b4","port":0}]}],"env":[{"name":"siren_ieee","type":"str","value":"xx:xx:xx:xx:xx:xx:xx:xx","ui":{"icon":"font-awesome/fa-bullhorn","label":{"en-US":"Zigbee IEEE*"},"type":"input","opts":{"types":["str"]}}},{"name":"siren_sound","type":"str","value":"0","ui":{"icon":"font-awesome/fa-file-sound-o","label":{"en-US":"Sound (0-18)"},"type":"select","opts":{"opts":[{"l":{"en-US":"Doorbell Chime"},"v":"0"},{"l":{"en-US":"Fur Elise"},"v":"1"},{"l":{"en-US":"Westminster Chimes"},"v":"2"},{"l":{"en-US":"Fast double door bell"},"v":"3"},{"l":{"en-US":"William Tell Overture"},"v":"4"},{"l":{"en-US":"Turkish March"},"v":"5"},{"l":{"en-US":"Safe/Security Alarm"},"v":"6"},{"l":{"en-US":"Chemical Spill Alert"},"v":"7"},{"l":{"en-US":"Piercing Alarm Clock"},"v":"8"},{"l":{"en-US":"Smoke Alarm"},"v":"9"},{"l":{"en-US":"Dog Barking"},"v":"10"},{"l":{"en-US":"Police Siren"},"v":"11"},{"l":{"en-US":"Doorbell Chime (reverb)"},"v":"12"},{"l":{"en-US":"Mechanical Telephone"},"v":"13"},{"l":{"en-US":"Fire/Ambulance"},"v":"14"},{"l":{"en-US":"3/1 Elevator"},"v":"15"},{"l":{"en-US":"Buzzing Alarm Clock"},"v":"16"},{"l":{"en-US":"School Bell"},"v":"17"}]}}},{"name":"siren_duration","type":"num","value":"30","ui":{"icon":"font-awesome/fa-clock-o","label":{"en-US":"Duration (s)"},"type":"input","opts":{"types":["num"]}}},{"name":"siren_vol","type":"str","value":"0","ui":{"icon":"font-awesome/fa-volume-up","label":{"en-US":"Volume (0-2)"},"type":"select","opts":{"opts":[{"l":{"en-US":"Low"},"v":"0"},{"l":{"en-US":"Medium"},"v":"1"},{"l":{"en-US":"High"},"v":"2"}]}}},{"name":"activate_siren","type":"str","value":"1","ui":{"label":{"en-US":"Activate"},"type":"select","opts":{"opts":[{"l":{"en-US":"On"},"v":"1"},{"l":{"en-US":"Off"},"v":"0"}]}}}],"meta":{},"color":"#FFCC66","inputLabels":["Activate Deactivate or Change settings."],"outputLabels":["Output for debugging or just chaining."],"icon":"font-awesome/fa-bullhorn"},{"id":"e965ea08b86a79a7","type":"api-call-service","z":"0c1810def209b6a6","name":"set sound","server":"528411d506baef5f","version":5,"debugenabled":false,"domain":"zha","service":"set_zigbee_cluster_attribute","areaId":[],"deviceId":[],"entityId":[],"data":"{\t \"ieee\": msg.siren_ieee,\t \"cluster_type\": in,\t \"endpoint_id\": 1,\t \"cluster_id\": 6,\t \"attribute\": 1126,\t \"value\": msg.siren_sound\t}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":460,"y":160,"wires":[["00ccd135e76b49f1"]]},{"id":"00ccd135e76b49f1","type":"api-call-service","z":"0c1810def209b6a6","name":"set duration (s)","server":"528411d506baef5f","version":5,"debugenabled":false,"domain":"zha","service":"set_zigbee_cluster_attribute","areaId":[],"deviceId":[],"entityId":[],"data":"{\t \"ieee\": msg.siren_ieee,\t \"cluster_type\": in,\t \"endpoint_id\": 1,\t \"cluster_id\": 6,\t \"attribute\": 615,\t \"value\": msg.siren_duration\t}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":640,"y":160,"wires":[["92e8833d9b061a79"]]},{"id":"92e8833d9b061a79","type":"api-call-service","z":"0c1810def209b6a6","name":"set volume (0-2)","server":"528411d506baef5f","version":5,"debugenabled":false,"domain":"zha","service":"set_zigbee_cluster_attribute","areaId":[],"deviceId":[],"entityId":[],"data":"{\t \"ieee\": msg.siren_ieee,\t \"cluster_type\": in,\t \"endpoint_id\": 1,\t \"cluster_id\": 6,\t \"attribute\": 1140,\t \"value\": msg.siren_vol\t}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":840,"y":160,"wires":[["920a10178ba2a0b4"]]},{"id":"920a10178ba2a0b4","type":"api-call-service","z":"0c1810def209b6a6","name":"play sound","server":"528411d506baef5f","version":5,"debugenabled":false,"domain":"zha","service":"set_zigbee_cluster_attribute","areaId":[],"deviceId":[],"entityId":[],"data":"{\t \"ieee\": msg.siren_ieee,\t \"cluster_type\": in,\t \"endpoint_id\": 1,\t \"cluster_id\": 6,\t \"attribute\": 0,\t \"value\": msg.activate_siren\t}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1030,"y":160,"wires":[[]]},{"id":"afe31aab2b1daaab","type":"change","z":"0c1810def209b6a6","name":"Convert envvars to msg","rules":[{"t":"set","p":"siren_ieee","pt":"msg","to":"siren_ieee","tot":"env"},{"t":"set","p":"siren_sound","pt":"msg","to":"siren_sound","tot":"env"},{"t":"set","p":"siren_duration","pt":"msg","to":"siren_duration","tot":"env"},{"t":"set","p":"siren_vol","pt":"msg","to":"siren_vol","tot":"env"},{"t":"set","p":"activate_siren","pt":"msg","to":"activate_siren","tot":"env"}],"action":"","property":"","from":"","to":"","reg":false,"x":250,"y":160,"wires":[["e965ea08b86a79a7"]]},{"id":"528411d506baef5f","type":"server","name":"Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"30","areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":": ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"default","statusTimeFormat":"h:m","enableGlobalContextStore":true},{"id":"4b9dca30f8055f6a","type":"subflow:0c1810def209b6a6","z":"d18f56c86b4f8991","name":"","env":[{"name":"siren_ieee","value":"a4:c1:38:38:ab:43:1e:6d","type":"str"},{"name":"siren_sound","value":"14","type":"str"},{"name":"siren_duration","value":"90","type":"num"},{"name":"siren_vol","value":"2","type":"str"}],"x":570,"y":360,"wires":[[]]}]

JAKAMI99 commented 1 week ago

Also bought this device and would love to see it get supported