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
694 stars 639 forks source link

[Device Support Request] RTX Zigbee Tuya ZIR aka. TS1201 #1687

Open sobkas opened 1 year ago

sobkas commented 1 year ago

Is your feature request related to a problem? Please describe. Adding support for Tuya TS1201 link: https://allegro.pl/oferta/uniwersalny-pilot-ir-tuya-zigbee-smart-remote-360-11845030905

Describe the solution you'd like Everything is described at https://github.com/Koenkk/zigbee2mqtt/issues/11633

Device signature ```yaml { "node_descriptor": "NodeDescriptor(logical_type=, complex_descriptor_available=0, user_descriptor_available=0, reserved=0, aps_flags=0, frequency_band=, mac_capability_flags=, manufacturer_code=4098, maximum_buffer_size=82, maximum_incoming_transfer_size=82, server_mask=11264, maximum_outgoing_transfer_size=82, descriptor_capability_field=, *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": 260, "device_type": "0xf000", "in_clusters": [ "0x0000", "0x0003", "0x0004", "0x0005", "0x0006", "0xe004", "0xed00" ], "out_clusters": [ "0x000a", "0x0019" ] }, "242": { "profile_id": 41440, "device_type": "0x0061", "in_clusters": [], "out_clusters": [ "0x0021" ] } }, "manufacturer": "_TZ3290_7v1k4vufotpowp9z", "model": "TS1201", "class": "zigpy.device.Device" } ```
Diagnostic information ```yaml { "home_assistant": { "installation_type": "Home Assistant OS", "version": "2022.8.1", "dev": false, "hassio": true, "virtualenv": false, "python_version": "3.10.5", "docker": true, "arch": "x86_64", "timezone": "Europe/Warsaw", "os_name": "Linux", "os_version": "5.15.55", "supervisor": "2022.07.0", "host_os": "Home Assistant OS 8.4", "docker_version": "20.10.14", "chassis": "vm", "run_as_root": true }, "custom_components": {}, "integration_manifest": { "domain": "zha", "name": "Zigbee Home Automation", "config_flow": true, "documentation": "https://www.home-assistant.io/integrations/zha", "requirements": [ "bellows==0.31.2", "pyserial==3.5", "pyserial-asyncio==0.6", "zha-quirks==0.0.78", "zigpy-deconz==0.18.0", "zigpy==0.48.0", "zigpy-xbee==0.15.0", "zigpy-zigate==0.9.0", "zigpy-znp==0.8.1" ], "usb": [ { "vid": "10C4", "pid": "EA60", "description": "*2652*", "known_devices": [ "slae.sh cc2652rb stick" ] }, { "vid": "10C4", "pid": "EA60", "description": "*sonoff*plus*", "known_devices": [ "sonoff zigbee dongle plus" ] }, { "vid": "10C4", "pid": "EA60", "description": "*tubeszb*", "known_devices": [ "TubesZB Coordinator" ] }, { "vid": "1A86", "pid": "7523", "description": "*tubeszb*", "known_devices": [ "TubesZB Coordinator" ] }, { "vid": "1A86", "pid": "7523", "description": "*zigstar*", "known_devices": [ "ZigStar Coordinators" ] }, { "vid": "1CF1", "pid": "0030", "description": "*conbee*", "known_devices": [ "Conbee II" ] }, { "vid": "10C4", "pid": "8A2A", "description": "*zigbee*", "known_devices": [ "Nortek HUSBZB-1" ] }, { "vid": "0403", "pid": "6015", "description": "*zigate*", "known_devices": [ "ZiGate+" ] }, { "vid": "10C4", "pid": "EA60", "description": "*zigate*", "known_devices": [ "ZiGate" ] }, { "vid": "10C4", "pid": "8B34", "description": "*bv 2010/10*", "known_devices": [ "Bitron Video AV2010/10" ] } ], "codeowners": [ "@dmulcahey", "@adminiuga", "@puddly" ], "zeroconf": [ { "type": "_esphomelib._tcp.local.", "name": "tube*" }, { "type": "_zigate-zigbee-gateway._tcp.local.", "name": "*zigate*" } ], "after_dependencies": [ "onboarding", "usb", "zeroconf" ], "iot_class": "local_polling", "loggers": [ "aiosqlite", "bellows", "crccheck", "pure_pcapy3", "zhaquirks", "zigpy", "zigpy_deconz", "zigpy_xbee", "zigpy_zigate", "zigpy_znp" ], "is_built_in": true }, "data": { "ieee": "**REDACTED**", "nwk": 8650, "manufacturer": "_TZ3290_7v1k4vufotpowp9z", "model": "TS1201", "name": "_TZ3290_7v1k4vufotpowp9z TS1201", "quirk_applied": false, "quirk_class": "zigpy.device.Device", "manufacturer_code": 4098, "power_source": "Mains", "lqi": 99, "rssi": null, "last_seen": "2022-08-09T15:39:04", "available": true, "device_type": "Router", "signature": { "node_descriptor": "NodeDescriptor(logical_type=, complex_descriptor_available=0, user_descriptor_available=0, reserved=0, aps_flags=0, frequency_band=, mac_capability_flags=, manufacturer_code=4098, maximum_buffer_size=82, maximum_incoming_transfer_size=82, server_mask=11264, maximum_outgoing_transfer_size=82, descriptor_capability_field=, *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": 260, "device_type": "0xf000", "in_clusters": [ "0x0000", "0x0003", "0x0004", "0x0005", "0x0006", "0xe004", "0xed00" ], "out_clusters": [ "0x000a", "0x0019" ] }, "242": { "profile_id": 41440, "device_type": "0x0061", "in_clusters": [], "out_clusters": [ "0x0021" ] } } }, "active_coordinator": false, "entities": [ { "entity_id": "button.uniwersalny_pilot_identifybutton", "name": "_TZ3290_7v1k4vufotpowp9z TS1201" }, { "entity_id": "switch.uniwersalny_pilot_switch", "name": "_TZ3290_7v1k4vufotpowp9z TS1201" } ], "neighbors": [], "endpoint_names": [ { "name": "undefined_0xf000" }, { "name": "unknown 97 device_type of 0xa1e0 profile id" } ], "user_given_name": "Uniwersalny pilot ", "device_reg_id": "1fea9570578603f815e8598267a40c96", "area_id": "salon", "cluster_details": { "1": { "device_type": { "name": "undefined_0xf000", "id": 61440 }, "profile_id": 260, "in_clusters": { "0x0000": { "endpoint_attribute": "basic", "attributes": { "0x0004": { "attribute_name": "manufacturer", "value": "_TZ3290_7v1k4vufotpowp9z" }, "0x0005": { "attribute_name": "model", "value": "TS1201" } }, "unsupported_attributes": {} }, "0x0004": { "endpoint_attribute": "groups", "attributes": {}, "unsupported_attributes": {} }, "0x0005": { "endpoint_attribute": "scenes", "attributes": {}, "unsupported_attributes": {} }, "0x0003": { "endpoint_attribute": "identify", "attributes": {}, "unsupported_attributes": {} }, "0xed00": { "endpoint_attribute": null, "attributes": {}, "unsupported_attributes": {} }, "0xe004": { "endpoint_attribute": null, "attributes": {}, "unsupported_attributes": {} }, "0x0006": { "endpoint_attribute": "on_off", "attributes": { "0x0000": { "attribute_name": "on_off", "value": 1 } }, "unsupported_attributes": { "0x4003": { "attribute_name": "start_up_on_off" } } } }, "out_clusters": { "0x0019": { "endpoint_attribute": "ota", "attributes": {}, "unsupported_attributes": {} }, "0x000a": { "endpoint_attribute": "time", "attributes": {}, "unsupported_attributes": {} } } }, "242": { "device_type": { "name": "unknown", "id": 97 }, "profile_id": 41440, "in_clusters": {}, "out_clusters": { "0x0021": { "endpoint_attribute": "green_power", "attributes": {}, "unsupported_attributes": {} } } } } } } ```
ownaginatious commented 6 months ago

Has anyone figured out how to repeat a code multiple times? My TV uses a single code to turn on and then expects the same code to be repeated rapidly (i.e. a long press on the remote) to turn off. I tried base64 decoding the code, repeating the byte string 100 times, base64 encoding again and then re-running, but that doesn't seem to do it.

tannisroot commented 6 months ago

Do I understand correctly that the quirk currently doesn't add a "remote" entity for the remote and you have to do all the learning and sending through zigbee cluster commands, instead of an IR learn/send service like with broadlinks?

SethJMoore commented 6 months ago

@tannisroot you understand correctly.

sjors-lemniscap commented 5 months ago

Here's the script I'm using to call the blaster. I have the codes saved as attributes in a sensor template.

alias: Blast IR code
fields:
  code_name:
    name: IR Code
    description: The code to be blasted through the IR blaster
    required: true
    selector:
      attribute:
        entity_id: sensor.ir_blaster_codes
sequence:
  - service: zha.issue_zigbee_cluster_command
    data:
      cluster_type: in
      endpoint_id: 1
      command: 2
      ieee: f0:82:c0:ff:fe:fd:e9:d6
      command_type: server
      params:
        code: "{{ state_attr('sensor.ir_blaster_codes', code_name) }}"
      cluster_id: 57348
  - delay:
      hours: 0
      minutes: 0
      seconds: 2
      milliseconds: 0
icon: mdi:remote
mode: queued
max: 50

Where and how do I configure the codes as attributes in a sensor template? Thanks a lot for this example

EDIT: figured it out, wasn't used to the new modern way of adding templated attributes to my configuration.yaml. Thanks!

SethJMoore commented 5 months ago

@sjors-lemniscap Glad to hear you figured it out. I'll go ahead and post an example of mine in case anyone else could use it.

I have the following in my templates.yaml file:

- sensor:
  - name: " IR Blaster Codes"
    unique_id: "sensor.ir_blaster_codes"
    state: none
    attributes:
      tv_power: "BW4jyBE+AsABA5EGPgLgCwFAF0ADQAFAB+AHA+ADAUAb4AcBQBPAA0ABwAvABwf3nW4jAAk+Ag=="
      tv_input_next: "B3MjkRFkAhsCgAMEhAZkAhtgAeADBwFkAkAXQAPgAwtAD+APA8AnQAfgCwNANwAbIAEBhAZAAxFkAgydcyPLCGQC//9zI8sIZAI="
      tv_channel_up: "BUQj3xE8AsABA5EGPALgCwFAF0ADQAFAB+AHA+AXAeAHL+AHDwfinUQj9Ag8Ag=="
      tv_channel_down: "BYgjwBE8AsABA5UGPALgCwFAF0ADQAFAB+ALA+AXAeALM8ATB+CdiCPdCDwC"
      tv_nav_up: "BXsjwBE8AsABA5IGPALgCwFAF0ADQAFAB+ALA0ABQBfgAwHgAw/AC0AHwANAAQuSBjwCyJ17I/EIPAI="
      tv_nav_down: "BUEj3xE8AsABA5QGPALgCwFAF0ADQAFAB+AHA0ABwBPgAwFAE0ABwAdAAUALwANAAQuUBjwC1p1BI/YIPAI="
      tv_nav_left: "BVgjwxE7AsABA5cGOwLgCwFAF0ADQAFAB+ATA+ADAUAn4AcBQBPAA0ABC5cGOwLKnVgj7wg7Ag=="
      tv_nav_right: "BVkjxBE6AsABA5UGOgLgCwFAF0ADQAFAB+AHA+ADAUAbwAHAC0AHwANAAeAHCwfPnVkjBwk6Ag=="
      tv_nav_ok: "BWAjwBE7AsABA5QGOwLgCwFAF0ADQAFAB+AHA8ABQBfgAwHAD0AHQANAAUAHwAMHOwI7ApQGOwI="
MairusuPawa commented 5 months ago

Hi! I'm jumping on this conversation for hopefully a bit of help with some devices. I've installed the quirks and have successfully already automated quite a lot of devices using the information from this topic, thanks a lot for the work being done!

But there's one device that eludes me, and it's a fan controller. The original remote is a "Distech Controls V13R", and I can't for the life of me capture any of its signals. Well, I've captured ONE for a test originally, but did not save it, and now I am having absolutely no luck.

When captured with a Flipper Zero, the data looks like this:

# 
name: FanAuto
type: raw
frequency: 38000
duty_cycle: 0.330000
data: 14991 1640 3325 1678 6657 1643 1684

I've been trying to convert this data to the base64(-like?) format this integration uses. I found for instance tools such as https://github.com/elupus/irgen but it only knows about the Broadlink base64 format, which is apparently not what the TS1201 is using (well, at least, it does not work).

Decoding the base64 payloads I had already captured (from other remotes) with the TS1201 don't give me any hints. They look like gibberish to me. I'm probably doing a lot of things wrong when experimenting, mind you.

I'd like to know is there's a specific way I could transform the raw data captured with my Flipper, into a payload I can blast with the TS1201. Would anyone have a clue on where to start? Thanks,

andrewjmetzger commented 5 months ago

@MairusuPawa This is an interesting question! After some digging, I captured the following info, hope it helps you.

Here's a review that has photos of the board: https://smarthomescene.com/reviews/tuya-zigbee-infrared-ir-remote-zs06-review/.

The ODM (Zosung) has a sales page here: https://www.zosung.com/products/tuya-zigbee-infrared-remote-control-smart-ir-automatic-scenario. There are no datasheets that list an encoding scheme or other revealing info.

This comment seems to indicate the device uses a custom protocol, invented by Tuya/Zosung: https://github.com/Koenkk/zigbee2mqtt/issues/11633#issuecomment-1122820185.

Further digging led me to the Zosung ZS08 (a similar device). There is thankfully a Gist published that documents the protocol for it: https://gist.github.com/mildsunrise/1d576669b63a260d2cff35fda63ec0b5.

Included is a Python script that seems to take codes and convert them to/from the Tuya IR format, mostly. They also link to another Gist with info: https://gist.github.com/andrewcchen/f16eb20d19ea64d9f997c470e2addeaa.

Please take a look and let me know if this makes sense to you? I have not interrogated the IR codes from my Flipper Zero yet, but hope to be able to figure this out Soon™. If you're willing, I could use the help! :)

Thanks!

mildsunrise commented 5 months ago

hi! as mentioned in the other issue, my module should work with this model as well. for example, trying the codes and signals posted above:

>>> import tuya
>>> tuya.decode_ir('BW4jyBE+AsABA5EGPgLgCwFAF0ADQAFAB+AHA+ADAUAb4AcBQBPAA0ABwAvABwf3nW4jAAk+Ag==')
[9070, 4552, 574, 574, 574, 574, 574, 1681, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 1681, 574, 1681, 574, 574, 574, 1681, 574, 1681, 574, 1681, 574, 1681, 574, 1681, 574, 574, 574, 574, 574, 574, 574, 1681, 574, 574, 574, 574, 574, 574, 574, 574, 574, 1681, 574, 1681, 574, 1681, 574, 574, 574, 1681, 574, 1681, 574, 1681, 574, 1681, 574, 40439, 9070, 2304, 574]
>>> tuya.encode_ir([14991, 1640, 3325, 1678, 6657, 1643, 1684])
'DY86aAb9DI4GARprBpQG'

however, the signal 14991 1640 3325 1678 6657 1643 1684 seems too short to me, i think your flipper captured only a small initial portion.

Has anyone figured out how to repeat a code multiple times? My TV uses a single code to turn on and then expects the same code to be repeated rapidly (i.e. a long press on the remote) to turn off. I tried base64 decoding the code, repeating the byte string 100 times, base64 encoding again and then re-running, but that doesn't seem to do it.

the reason this doesn't work is that a signal is a list of numbers, beginning with a HIGH, then LOW, then HIGH, etc. and ending in a HIGH. simply duplicating the list will not work, because the initial HIGH in the second list gets interpreted as LOW (because it's just after a HIGH), and so on.

to do that, insert a single number between the signals (spacing time), such as 20000 (20ms). for example, to repeat the code 2 times:

>>> signal = tuya.decode_ir('BW4jyBE+AsABA5EGPgLgCwFAF0ADQAFAB+AHA+ADAUAb4AcBQBPAA0ABwAvABwf3nW4jAAk+Ag==')
>>> tuya.encode_ir(signal + [20000] + signal)
'BW4jyBE+AsABAZEG4AEL4AMBQBfAG8AL4AMD4Acr4A8/4A9DCfedbiMACT4CIE7ghY8='

however keep in mind that the device seems to have a size limit, so it could discard your code if it's too big.

also keep in mind that my code hasn't received much testing yet. maybe the generated codes don't work well.

mildsunrise commented 5 months ago

For every run of "IRLearn", I get a new code. Does not seem to be a problem though, but I expected it to be a fixed value all time

this is extremely normal, as the captured signal will have some noise and the numbers won't be exactly the same every time. also, the device seems to quantize the numbers (possibly so that the LZ77 compression is more effective), and the quantization levels are different every time, not sure why. maybe it computes a histogram over the signal to determine the best levels.

MairusuPawa commented 5 months ago

hi! as mentioned in the other issue, my module should work with this model as well. for example, trying the codes and signals posted above:

>>> import tuya
>>> tuya.decode_ir('BW4jyBE+AsABA5EGPgLgCwFAF0ADQAFAB+AHA+ADAUAb4AcBQBPAA0ABwAvABwf3nW4jAAk+Ag==')
[9070, 4552, 574, 574, 574, 574, 574, 1681, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 1681, 574, 1681, 574, 574, 574, 1681, 574, 1681, 574, 1681, 574, 1681, 574, 1681, 574, 574, 574, 574, 574, 574, 574, 1681, 574, 574, 574, 574, 574, 574, 574, 574, 574, 1681, 574, 1681, 574, 1681, 574, 574, 574, 1681, 574, 1681, 574, 1681, 574, 1681, 574, 40439, 9070, 2304, 574]
>>> tuya.encode_ir([14991, 1640, 3325, 1678, 6657, 1643, 1684])
'DY86aAb9DI4GARprBpQG'

however, the signal 14991 1640 3325 1678 6657 1643 1684 seems too short to me, i think your flipper captured only a small initial portion.

Hi! Thanks a lot for the script. I too was surprised by the signal's length, but sending it through the Flipper did work. And here, lo and behold: the payload "DY86aAb9DI4GARprBpQG" absolutely works too, using the TS1201 to blast it. Awesome work!

I now have to capture everything else on this remote :)

Szewcson commented 4 months ago

Since I added a 2 second delay in between calls to the blaster, it seems to be working ok for me, but that makes it pretty slow.

@SethJMoore Works ok, as in reliable? 😉 I have also tried to increase the delay between the commands, but unfortunately, that doesn't make any difference in stability.

And one more thing, I don't know if there's something wrong with one of my IR commands, the quirk itself, or something else, but suddenly I got e.g. double IR commands for "up", even though my automation only says "up" once.

I wonder if there is a firmware available, that could fix these issues.. 🤔

I'm just curious - does anybody else have issues with multiple IR commands in a row? If not, are you running the non-battery-powered version?

I have an issue with doubled codes, but I think it was caused by learning more then one code, when I pushed button little bit longer. I learn that code again and it was ok.

Other thing is that delay. Me either can't make it work smoothly.

Szewcson commented 4 months ago

Also, I have an impression that first code send to a blaster after a while of not using it is lost. Can it be some issue with waking device up?

jacobvohs commented 4 months ago

Here's the script I'm using to call the blaster. I have the codes saved as attributes in a sensor template.

alias: Blast IR code
fields:
  code_name:
    name: IR Code
    description: The code to be blasted through the IR blaster
    required: true
    selector:
      attribute:
        entity_id: sensor.ir_blaster_codes
sequence:
  - service: zha.issue_zigbee_cluster_command
    data:
      cluster_type: in
      endpoint_id: 1
      command: 2
      ieee: f0:82:c0:ff:fe:fd:e9:d6
      command_type: server
      params:
        code: "{{ state_attr('sensor.ir_blaster_codes', code_name) }}"
      cluster_id: 57348
  - delay:
      hours: 0
      minutes: 0
      seconds: 2
      milliseconds: 0
icon: mdi:remote
mode: queued
max: 50

@SethJMoore SethJMoore Where do I enter this script?

jacobvohs commented 4 months ago

Here is a sample script to send a code:

alias: Vacuum Start sequence:

  • service: zha.issue_zigbee_cluster_command data: cluster_type: in endpoint_id: 1 command: 2 ieee: 38:5b:44:ff:fe:33:11:8a command_type: server params: code: >- C7ILsgsfAskBHwLGBYADwAtAB+APA8ArwAfgDyfgIxfAS0AHQDdAB8ADB/pPsguyCx8C4AEXArMCBWCzB8kByQGzAskBQAGAH0AHCR8CyQHJAR8CxgXgBQNAE+A3A+ADU0BL4AMP4AmnAR8CwCNAB+APA0An4AMD4A8n4CMX4AdP4AMP4JWnBLMCxgUfYAPglacJHwLGBR8CxgUfAg== cluster_id: 57348 mode: single icon: mdi:robot-vacuum You will need to switch out the ieee as well as the code. The cluster_id was translated from 0xe004

@ranton1990 Where are you entering this script on home assistant?

costyn commented 4 months ago

Where are you entering this script on home assistant?

@jacobvohs

Don't forget to change the ieee to the address of your device! To find it, View/expand Device info of your TS1201 in the ZHA integration.

Mine, for example:

image
costyn commented 4 months ago

@sjors-lemniscap Glad to hear you figured it out. I'll go ahead and post an example of mine in case anyone else could use it.

I have the following in my templates.yaml file:

- sensor:
  - name: " IR Blaster Codes"
    unique_id: "sensor.ir_blaster_codes"
    state: none
    attributes:
      tv_power: "BW4jyBE+AsABA5EGPgLgCwFAF0ADQAFAB+AHA+ADAUAb4AcBQBPAA0ABwAvABwf3nW4jAAk+Ag=="
      tv_input_next: "B3MjkRFkAhsCgAMEhAZkAhtgAeADBwFkAkAXQAPgAwtAD+APA8AnQAfgCwNANwAbIAEBhAZAAxFkAgydcyPLCGQC//9zI8sIZAI="
      tv_channel_up: "BUQj3xE8AsABA5EGPALgCwFAF0ADQAFAB+AHA+AXAeAHL+AHDwfinUQj9Ag8Ag=="
      tv_channel_down: "BYgjwBE8AsABA5UGPALgCwFAF0ADQAFAB+ALA+AXAeALM8ATB+CdiCPdCDwC"
      tv_nav_up: "BXsjwBE8AsABA5IGPALgCwFAF0ADQAFAB+ALA0ABQBfgAwHgAw/AC0AHwANAAQuSBjwCyJ17I/EIPAI="
      tv_nav_down: "BUEj3xE8AsABA5QGPALgCwFAF0ADQAFAB+AHA0ABwBPgAwFAE0ABwAdAAUALwANAAQuUBjwC1p1BI/YIPAI="
      tv_nav_left: "BVgjwxE7AsABA5cGOwLgCwFAF0ADQAFAB+ATA+ADAUAn4AcBQBPAA0ABC5cGOwLKnVgj7wg7Ag=="
      tv_nav_right: "BVkjxBE6AsABA5UGOgLgCwFAF0ADQAFAB+AHA+ADAUAbwAHAC0AHwANAAeAHCwfPnVkjBwk6Ag=="
      tv_nav_ok: "BWAjwBE7AsABA5QGOwLgCwFAF0ADQAFAB+AHA8ABQBfgAwHAD0AHQANAAUAHwAMHOwI7ApQGOwI="

@SethJMoore Could you give a bit more hints as to how/where I put this? I don't see a templates.yaml in my File Editor, even after I added the Templates addon. Or do I just make it from scratch?

Thanks.

SethJMoore commented 4 months ago

@SethJMoore Could you give a bit more hints as to how/where I put this? I don't see a templates.yaml in my File Editor, even after I added the Templates addon. Or do I just make it from scratch?

Thanks.

@costyn I made it from scratch and have it in folder /homeassistant/config/ then in configuration.yaml I added the following line: template: !include config/templates.yaml

gromgsxr commented 3 months ago

Got one of these yesterday. Added the custom quirk paired the device all good thanks. I can do the ir learn and read the code back as an attribute. But I can't seem to send anything out. I tried using the cluster commands where you set it to learn and it gives me the green tick but the device seems to not respond no blinking blue led my TV didn't do anything. Also tried using the service call zha issue cluster command and also created a script each time nothing seems to happen Using ha v 2024.03.03 in docker with an xbee as the cordinator

edit: added log data

`Logger: homeassistant Source: custom_zha_quirks/ts1201.py:304 First occurred: 20:12:42 (2 occurrences) Last logged: 20:12:44

Error doing job: Exception in callback SerialTransport._read_ready() Traceback (most recent call last): File "/usr/local/lib/python3.12/asyncio/events.py", line 88, in _run self._context.run(self._callback, self._args) File "/usr/local/lib/python3.12/site-packages/serial_asyncio_fast/init.py", line 137, in _read_ready self._protocol.data_received(data) File "/usr/local/lib/python3.12/site-packages/zigpy_xbee/uart.py", line 95, in data_received self.frame_received(frame) File "/usr/local/lib/python3.12/site-packages/zigpy_xbee/uart.py", line 103, in frame_received self._api.frame_received(frame) File "/usr/local/lib/python3.12/site-packages/zigpy_xbee/api.py", line 392, in frame_received getattr(self, f"handle{command}")(data) File "/usr/local/lib/python3.12/site-packages/zigpy_xbee/api.py", line 451, in _handle_explicit_rx_indicator self._app.handle_rx(ieee, nwk, src_ep, dst_ep, cluster, profile, rx_opts, data) File "/usr/local/lib/python3.12/site-packages/zigpy_xbee/zigbee/application.py", line 382, in handle_rx self.packet_received( File "/usr/local/lib/python3.12/site-packages/zigpy/application.py", line 1032, in packet_received return device.packet_received(packet) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/zigpy/device.py", line 497, in packet_received endpoint.handle_message( File "/usr/local/lib/python3.12/site-packages/zigpy/endpoint.py", line 235, in handle_message handler(hdr, args, dst_addressing=dst_addressing) File "/usr/local/lib/python3.12/site-packages/zigpy/zcl/init.py", line 430, in handle_message self.handle_cluster_request(hdr, args, dst_addressing=dst_addressing) File "/config/custom_zha_quirks/ts1201.py", line 304, in handle_cluster_request irmsg = self.endpoint.device.ir_msg_to_send[seq]


KeyError: 2
`
Luc4Piccinini commented 1 week ago

Hello, given the conflict between Zigbee HA and Zigbee2MQTT I decided to work only with Zigbee HA.

I have this device also and by following the guide and trend I managed to memorize the 2 codes of my air conditioner for true and false.

Now how do I associate these 2 values to the ON (true) and OFF (false) switch so both bringing it to the dashboard and structuring some automations?

Is it possible to do this only with a script?