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
696 stars 641 forks source link

[BUG] TuyaTS130Double_GP_ESTC - can't change/save external_switch_type (0xd030) attibute value #3123

Closed sltvtr closed 1 month ago

sltvtr commented 3 months ago

Bug description

I've purchased some OXT Zigbee curtains controllers, but they all have the same issue. They work by default with monostable external switches, but my switches are bistable. I did some digging and found that there is an attribute in that model, that is used to change the external switch type value, based on that:

There is a cluster:

class TuyaTS130Double_GP_ESTC(CustomDevice):
    """Tuya double smart curtain roller shutter with Green Power and External Switch Type Cluster."""

With attribute external_switch_type:

# Tuya Zigbee Cluster 0xE001 Implementation
class ExternalSwitchType(t.enum8):
    """Tuya external switch type enum."""

    Toggle = 0x00
    State = 0x01
    Momentary = 0x02

I try to do change this the same way You change calibration_time for theese modules, I click "Save", get a green OK sign, but the value is not saved.

obraz

I took another step and installed ZHA Toolkit, enabled debug for it and tried to change it that way with this script:

service: zha_toolkit.attr_write
data:
  ieee: a4:c1:38:50:cb:7d:72:46
  endpoint: 1
  attribute: 53296
  cluster: 57345
  attr_val: 0x01

It executes ok, but in the result there is an error:

zha_toolkit_version: v1.1.10
zigpy_version: 0.63.5
zigpy_rf_version: 0.38.1
ieee_org:
  - 70
  - 114
  - 125
  - 203
  - 80
  - 56
  - 193
  - 164
ieee: a4:c1:38:50:cb:7d:72:46
command: attr_write
command_data: null
start_time: "2024-04-24T07:29:47.545545+00:00"
errors: []
params:
  endpoint_id: 1
  cluster_id: 57345
  attr_id: 53296
  attr_val: 1
  dir: 0
  tries: 1
  expect_reply: true
  args: []
  read_before_write: true
  read_after_write: true
compare_val: 1
attr_type: "0x30"
write_is_equal: false
read_before:
  - {}
  - "53296": 134
result_write:
  - - status: 134
      attrid: 53296
result_read:
  - {}
  - "53296": 134
warnings:
  - >-
    Result: {53296: <Status.UNSUPPORTED_ATTRIBUTE: 134>} - Attribute 53296 not
    in read ({}, {53296: <Status.UNSUPPORTED_ATTRIBUTE: 134>})
success: false

When I add manf: 0 to the script as below:

service: zha_toolkit.attr_write
data:
  ieee: a4:c1:38:50:cb:7d:72:46
  endpoint: 1
  attribute: 53296
  cluster: 57345
  attr_val: 0x01
  manf: 0

I get somewhat different error:

zha_toolkit_version: v1.1.10
zigpy_version: 0.63.5
zigpy_rf_version: 0.38.1
ieee_org:
  - 70
  - 114
  - 125
  - 203
  - 80
  - 56
  - 193
  - 164
ieee: a4:c1:38:50:cb:7d:72:46
command: attr_write
command_data: null
start_time: "2024-04-24T07:31:00.820902+00:00"
errors:
  - TypeError("'uint8_t' object is not subscriptable")
params:
  endpoint_id: 1
  cluster_id: 57345
  attr_id: 53296
  attr_val: 1
  dir: 0
  manf: 0
  tries: 1
  expect_reply: true
  args: []
  read_before_write: true
  read_after_write: true
compare_val: 1
attr_type: "0x30"
write_is_equal: false
read_before:
  - {}
  - "53296": 0
result_write:
  - 2
  - 132
result_read:
  - {}
  - "53296": 0
warnings:
  - "Result: {53296: 0} - Attribute 53296 not in read ({}, {53296: 0})"
success: false

I tried many combinations with values, manufacturer codes and it always ends the same. Am I doing something wrong? (but theese steps works for calibration_time) Or is it someting with devices themself?

Steps to reproduce

  1. Open Developer Tools -> Services, choose ZHA Toolkit: Write Attribute and enter below YAML:
service: zha_toolkit.attr_write
data:
  ieee: a4:c1:38:50:cb:7d:72:46
  endpoint: 1
  attribute: 53296
  cluster: 57345
  attr_val: 0x01
  manf: 0
  1. Click Run/Execute
  2. The script executes but returns errors like:

homeassistant | 2024-04-24 09:09:25.623 DEBUG (MainThread) [custom_components.zha_toolkit] event_data {'zha_toolkit_version': 'v1.1.10', 'zigpy_version': '0.63.5', 'zigpy_rf_version': '0.38.1', 'ieee_org': a4:c1:38:50:cb:7d:72:46, 'ieee': 'a4:c1:38:50:cb:7d:72:46', 'command': 'attr_write', 'command_data': None, 'start_time': '2024-04-24T07:09:25.426038+00:00', 'errors': ['TypeError("\'uint8_t\' object is not subscriptable")'], 'params': {'endpoint_id': 1, 'cluster_id': 57345, 'attr_id': 53296, 'attr_val': 1, 'dir': 0, 'manf': 4417, 'tries': 1, 'expect_reply': True, 'args': [], 'read_before_write': True, 'read_after_write': True}, 'compare_val': <enum8.undefined_0x01: 1>, 'attr_type': '0x30', 'write_is_equal': False, 'read_before': ({}, {53296: 0}), 'result_write': Default_Response(command_id=2, status=<Status.UNSUP_MANUF_GENERAL_COMMAND: 132>), 'result_read': ({}, {53296: 0}), 'warnings': ['Result: {53296: 0} - Attribute 53296 not in read ({}, {53296: 0})'], 'success': False}

or

homeassistant | 2024-04-24 09:08:15.802 DEBUG (MainThread) [custom_components.zha_toolkit] event_data {'zha_toolkit_version': 'v1.1.10', 'zigpy_version': '0.63.5', 'zigpy_rf_version': '0.38.1', 'ieee_org': a4:c1:38:50:cb:7d:72:46, 'ieee': 'a4:c1:38:50:cb:7d:72:46', 'command': 'attr_write', 'command_data': None, 'start_time': '2024-04-24T07:08:15.578186+00:00', 'errors': [], 'params': {'endpoint_id': 1, 'cluster_id': 57345, 'attr_id': 53296, 'attr_val': 1, 'dir': 0, 'tries': 1, 'expect_reply': True, 'args': [], 'read_before_write': True, 'read_after_write': True}, 'compare_val': <enum8.undefined_0x01: 1>, 'attr_type': '0x30', 'write_is_equal': False, 'read_before': ({}, {53296: <Status.UNSUPPORTED_ATTRIBUTE: 134>}), 'result_write': Write_Attributes_rsp(status_records=[WriteAttributesStatusRecord(status=<Status.UNSUPPORTED_ATTRIBUTE: 134>, attrid=0xD030)]), 'result_read': ({}, {53296: <Status.UNSUPPORTED_ATTRIBUTE: 134>}), 'warnings': ['Result: {53296: <Status.UNSUPPORTED_ATTRIBUTE: 134>} - Attribute 53296 not in read ({}, {53296: <Status.UNSUPPORTED_ATTRIBUTE: 134>})'], 'success': False}

Expected behavior

The attribute value should change.

Screenshots/Video

Screenshots/Video [Paste/upload your media here]

Device signature

Device signature ```json { "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=4417, maximum_buffer_size=66, maximum_incoming_transfer_size=66, server_mask=10752, maximum_outgoing_transfer_size=66, 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": "0x0104", "device_type": "0x0202", "input_clusters": [ "0x0000", "0x0004", "0x0005", "0x0006", "0x0102", "0xe001" ], "output_clusters": [ "0x000a", "0x0019" ] }, "2": { "profile_id": "0x0104", "device_type": "0x0202", "input_clusters": [ "0x0004", "0x0005", "0x0006", "0x0102", "0xe001" ], "output_clusters": [] }, "242": { "profile_id": "0xa1e0", "device_type": "0x0061", "input_clusters": [], "output_clusters": [ "0x0021" ] } }, "manufacturer": "_TZ3000_j1xl73iw", "model": "TS130F", "class": "zhaquirks.tuya.ts130f.TuyaTS130Double_GP_ESTC" } ```

Diagnostic information

Diagnostic information ```json { "home_assistant": { "installation_type": "Home Assistant Container", "version": "2024.4.4", "dev": false, "hassio": false, "virtualenv": false, "python_version": "3.12.2", "docker": true, "arch": "x86_64", "timezone": "Europe/Warsaw", "os_name": "Linux", "os_version": "5.15.0-92-generic", "run_as_root": true }, "custom_components": { "hacs": { "version": "1.34.0", "requirements": [ "aiogithubapi>=22.10.1" ] }, "zha_toolkit": { "version": "v1.1.10", "requirements": [ "pytz" ] } }, "integration_manifest": { "domain": "zha", "name": "Zigbee Home Automation", "after_dependencies": [ "onboarding", "usb" ], "codeowners": [ "@dmulcahey", "@adminiuga", "@puddly", "@TheJulianJES" ], "config_flow": true, "dependencies": [ "file_upload" ], "documentation": "https://www.home-assistant.io/integrations/zha", "iot_class": "local_polling", "loggers": [ "aiosqlite", "bellows", "crccheck", "pure_pcapy3", "zhaquirks", "zigpy", "zigpy_deconz", "zigpy_xbee", "zigpy_zigate", "zigpy_znp", "universal_silabs_flasher" ], "requirements": [ "bellows==0.38.1", "pyserial==3.5", "pyserial-asyncio==0.6", "zha-quirks==0.0.114", "zigpy-deconz==0.23.1", "zigpy==0.63.5", "zigpy-xbee==0.20.1", "zigpy-zigate==0.12.0", "zigpy-znp==0.12.1", "universal-silabs-flasher==0.0.18", "pyserial-asyncio-fast==0.11" ], "usb": [ { "vid": "10C4", "pid": "EA60", "description": "*2652*", "known_devices": [ "slae.sh cc2652rb stick" ] }, { "vid": "10C4", "pid": "EA60", "description": "*slzb-07*", "known_devices": [ "smlight slzb-07" ] }, { "vid": "1A86", "pid": "55D4", "description": "*sonoff*plus*", "known_devices": [ "sonoff zigbee dongle plus v2" ] }, { "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": "0403", "pid": "6015", "description": "*conbee*", "known_devices": [ "Conbee III" ] }, { "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" ] } ], "zeroconf": [ { "type": "_esphomelib._tcp.local.", "name": "tube*" }, { "type": "_zigate-zigbee-gateway._tcp.local.", "name": "*zigate*" }, { "type": "_zigstar_gw._tcp.local.", "name": "*zigstar*" }, { "type": "_uzg-01._tcp.local.", "name": "uzg-01*" }, { "type": "_slzb-06._tcp.local.", "name": "slzb-06*" } ], "is_built_in": true }, "data": { "ieee": "**REDACTED**", "nwk": 35611, "manufacturer": "_TZ3000_j1xl73iw", "model": "TS130F", "name": "_TZ3000_j1xl73iw TS130F", "quirk_applied": true, "quirk_class": "zhaquirks.tuya.ts130f.TuyaTS130Double_GP_ESTC", "quirk_id": null, "manufacturer_code": 4417, "power_source": "Mains", "lqi": 132, "rssi": -67, "last_seen": "2024-04-24T09:38:43", "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=4417, maximum_buffer_size=66, maximum_incoming_transfer_size=66, server_mask=10752, maximum_outgoing_transfer_size=66, 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": "0x0104", "device_type": "0x0202", "input_clusters": [ "0x0000", "0x0004", "0x0005", "0x0006", "0x0102", "0xe001" ], "output_clusters": [ "0x000a", "0x0019" ] }, "2": { "profile_id": "0x0104", "device_type": "0x0202", "input_clusters": [ "0x0004", "0x0005", "0x0006", "0x0102", "0xe001" ], "output_clusters": [] }, "242": { "profile_id": "0xa1e0", "device_type": "0x0061", "input_clusters": [], "output_clusters": [ "0x0021" ] } }, "manufacturer": "_TZ3000_j1xl73iw", "model": "TS130F" }, "active_coordinator": false, "entities": [ { "entity_id": "update.blindstest_firmware", "name": "_TZ3000_j1xl73iw TS130F" }, { "entity_id": "switch.blindstest_przelacznik", "name": "_TZ3000_j1xl73iw TS130F" }, { "entity_id": "switch.blindstest_przelacznik_2", "name": "_TZ3000_j1xl73iw TS130F" }, { "entity_id": "cover.blindstest_roleta", "name": "_TZ3000_j1xl73iw TS130F" }, { "entity_id": "cover.blindstest_roleta_2", "name": "_TZ3000_j1xl73iw TS130F" } ], "neighbors": [], "routes": [], "endpoint_names": [ { "name": "WINDOW_COVERING_DEVICE" }, { "name": "WINDOW_COVERING_DEVICE" }, { "name": "PROXY_BASIC" } ], "user_given_name": "BlindsTest", "device_reg_id": "39233da983edd932cc2768662012a42f", "area_id": "sypialnia", "cluster_details": { "1": { "device_type": { "name": "WINDOW_COVERING_DEVICE", "id": 514 }, "profile_id": 260, "in_clusters": { "0x0000": { "endpoint_attribute": "basic", "attributes": {}, "unsupported_attributes": {} }, "0x0004": { "endpoint_attribute": "groups", "attributes": {}, "unsupported_attributes": {} }, "0x0005": { "endpoint_attribute": "scenes", "attributes": {}, "unsupported_attributes": {} }, "0x0006": { "endpoint_attribute": "on_off", "attributes": { "0x8001": { "attribute_name": "backlight_mode", "value": 0 }, "0x0000": { "attribute_name": "on_off", "value": 0 } }, "unsupported_attributes": { "0x0000": { "attribute_name": "on_off" }, "0x4003": { "attribute_name": "start_up_on_off" } } }, "0x0102": { "endpoint_attribute": "window_covering", "attributes": { "0xf001": { "attribute_name": "calibration", "value": 1 }, "0xf003": { "attribute_name": "calibration_time", "value": 100 }, "0x0008": { "attribute_name": "current_position_lift_percentage", "value": 100 }, "0x8000": { "attribute_name": "motor_mode", "value": 0 }, "0xf002": { "attribute_name": "motor_reversal", "value": 0 }, "0xf000": { "attribute_name": "tuya_moving_state", "value": 1 } }, "unsupported_attributes": { "0x0000": { "attribute_name": "window_covering_type" }, "0x0011": { "attribute_name": "installed_closed_limit_lift" }, "0x0009": { "attribute_name": "current_position_tilt_percentage" }, "0x0010": { "attribute_name": "installed_open_limit_lift" }, "0x0007": { "attribute_name": "config_status" }, "0x0017": { "attribute_name": "window_covering_mode" }, "0x0013": { "attribute_name": "installed_closed_limit_tilt" }, "0x0012": { "attribute_name": "installed_open_limit_tilt" } } }, "0xe001": { "endpoint_attribute": "tuya_external_switch_type", "attributes": {}, "unsupported_attributes": { "0xd030": { "attribute_name": "external_switch_type" } } } }, "out_clusters": { "0x000a": { "endpoint_attribute": "time", "attributes": {}, "unsupported_attributes": {} }, "0x0019": { "endpoint_attribute": "ota", "attributes": { "0x0002": { "attribute_name": "current_file_version", "value": 70 } }, "unsupported_attributes": {} } } }, "2": { "device_type": { "name": "WINDOW_COVERING_DEVICE", "id": 514 }, "profile_id": 260, "in_clusters": { "0x0004": { "endpoint_attribute": "groups", "attributes": {}, "unsupported_attributes": {} }, "0x0005": { "endpoint_attribute": "scenes", "attributes": {}, "unsupported_attributes": {} }, "0x0006": { "endpoint_attribute": "on_off", "attributes": { "0x0000": { "attribute_name": "on_off", "value": 0 } }, "unsupported_attributes": { "0x0000": { "attribute_name": "on_off" }, "0x4003": { "attribute_name": "start_up_on_off" } } }, "0x0102": { "endpoint_attribute": "window_covering", "attributes": { "0xf001": { "attribute_name": "calibration", "value": 1 }, "0xf003": { "attribute_name": "calibration_time", "value": 100 }, "0x0008": { "attribute_name": "current_position_lift_percentage", "value": 100 }, "0x8000": { "attribute_name": "motor_mode", "value": 0 }, "0xf002": { "attribute_name": "motor_reversal", "value": 0 }, "0xf000": { "attribute_name": "tuya_moving_state", "value": 1 } }, "unsupported_attributes": { "0x0000": { "attribute_name": "window_covering_type" }, "0x0009": { "attribute_name": "current_position_tilt_percentage" }, "0x0011": { "attribute_name": "installed_closed_limit_lift" }, "0x0010": { "attribute_name": "installed_open_limit_lift" }, "0x0007": { "attribute_name": "config_status" }, "0x0017": { "attribute_name": "window_covering_mode" }, "0x0013": { "attribute_name": "installed_closed_limit_tilt" }, "0x0012": { "attribute_name": "installed_open_limit_tilt" } } }, "0xe001": { "endpoint_attribute": "tuya_external_switch_type", "attributes": {}, "unsupported_attributes": { "0xd030": { "attribute_name": "external_switch_type" } } } }, "out_clusters": {} }, "242": { "device_type": { "name": "PROXY_BASIC", "id": 97 }, "profile_id": 41440, "in_clusters": {}, "out_clusters": { "0x0021": { "endpoint_attribute": "green_power", "attributes": {}, "unsupported_attributes": {} } } } } } } ```

Logs

Logs ```python homeassistant | 2024-04-24 09:08:15.554 INFO (MainThread) [custom_components.zha_toolkit] Running ZHA Toolkit service: homeassistant | 2024-04-24 09:08:15.554 DEBUG (MainThread) [custom_components.zha_toolkit] Got hass.data['zha']/gateway homeassistant | 2024-04-24 09:08:15.571 DEBUG (MainThread) [custom_components.zha_toolkit] module is homeassistant | 2024-04-24 09:08:15.576 DEBUG (MainThread) [custom_components.zha_toolkit.utils] Parameters '{'ieee': a4:c1:38:50:cb:7d:72:46, 'endpoint': 1, 'attribute': 53296, 'cluster': 57345, 'attr_val': 1}' homeassistant | 2024-04-24 09:08:15.576 DEBUG (MainThread) [custom_components.zha_toolkit.utils] Final manf 'None' homeassistant | 2024-04-24 09:08:15.578 DEBUG (MainThread) [custom_components.zha_toolkit] 'ieee' parameter: 'a4:c1:38:50:cb:7d:72:46' -> IEEE Addr: 'a4:c1:38:50:cb:7d:72:46' homeassistant | 2024-04-24 09:08:15.578 DEBUG (MainThread) [custom_components.zha_toolkit] Default handler for attr_write homeassistant | 2024-04-24 09:08:15.578 DEBUG (MainThread) [custom_components.zha_toolkit] Handler: homeassistant | 2024-04-24 09:08:15.578 DEBUG (MainThread) [custom_components.zha_toolkit] running default command: homeassistant | 2024-04-24 09:08:15.581 DEBUG (MainThread) [custom_components.zha_toolkit.default] Trying to import custom_components.zha_toolkit.zcl_attr to call attr_write homeassistant | 2024-04-24 09:08:15.584 DEBUG (MainThread) [custom_components.zha_toolkit.utils] IEEE for get_device: a4:c1:38:50:cb:7d:72:46 a4:c1:38:50:cb:7d:72:46 homeassistant | 2024-04-24 09:08:15.584 DEBUG (MainThread) [custom_components.zha_toolkit.zcl_attr] Request attr read [53296] homeassistant | 2024-04-24 09:08:15.664 DEBUG (MainThread) [custom_components.zha_toolkit.zcl_attr] Reading attr result (attrs, status): ({}, {53296: }) homeassistant | 2024-04-24 09:08:15.664 DEBUG (MainThread) [custom_components.zha_toolkit.utils] Data type '' for attr type 48 homeassistant | 2024-04-24 09:08:15.665 DEBUG (MainThread) [custom_components.zha_toolkit.utils] Converted 1 to TypeValue(type=enum8, value=) - will compare to enum8.undefined_0x01 - Type: 0x30 homeassistant | 2024-04-24 09:08:15.665 DEBUG (MainThread) [custom_components.zha_toolkit.zcl_attr] Request attr write [Attribute(attrid=0xD030, value=TypeValue(type=enum8, value=))] homeassistant | 2024-04-24 09:08:15.734 DEBUG (MainThread) [custom_components.zha_toolkit.zcl_attr] Write attr status: Write_Attributes_rsp(status_records=[WriteAttributesStatusRecord(status=, attrid=0xD030)]) homeassistant | 2024-04-24 09:08:15.735 DEBUG (MainThread) [custom_components.zha_toolkit.zcl_attr] Write success: False homeassistant | 2024-04-24 09:08:15.735 DEBUG (MainThread) [custom_components.zha_toolkit.zcl_attr] Request attr read [53296] homeassistant | 2024-04-24 09:08:15.801 DEBUG (MainThread) [custom_components.zha_toolkit.zcl_attr] Reading attr result (attrs, status): ({}, {53296: }) homeassistant | 2024-04-24 09:08:15.801 WARNING (MainThread) [custom_components.zha_toolkit.zcl_attr] Result: {53296: } - Attribute 53296 not in read ({}, {53296: }) homeassistant | 2024-04-24 09:08:15.802 DEBUG (MainThread) [custom_components.zha_toolkit] event_data {'zha_toolkit_version': 'v1.1.10', 'zigpy_version': '0.63.5', 'zigpy_rf_version': '0.38.1', 'ieee_org': a4:c1:38:50:cb:7d:72:46, 'ieee': 'a4:c1:38:50:cb:7d:72:46', 'command': 'attr_write', 'command_data': None, 'start_time': '2024-04-24T07:08:15.578186+00:00', 'errors': [], 'params': {'endpoint_id': 1, 'cluster_id': 57345, 'attr_id': 53296, 'attr_val': 1, 'dir': 0, 'tries': 1, 'expect_reply': True, 'args': [], 'read_before_write': True, 'read_after_write': True}, 'compare_val': , 'attr_type': '0x30', 'write_is_equal': False, 'read_before': ({}, {53296: }), 'result_write': Write_Attributes_rsp(status_records=[WriteAttributesStatusRecord(status=, attrid=0xD030)]), 'result_read': ({}, {53296: }), 'warnings': ['Result: {53296: } - Attribute 53296 not in read ({}, {53296: })'], 'success': False} or homeassistant | 2024-04-24 09:09:10.746 INFO (MainThread) [custom_components.zha_toolkit] Running ZHA Toolkit service: homeassistant | 2024-04-24 09:09:10.746 DEBUG (MainThread) [custom_components.zha_toolkit] Got hass.data['zha']/gateway homeassistant | 2024-04-24 09:09:10.768 DEBUG (MainThread) [custom_components.zha_toolkit] module is homeassistant | 2024-04-24 09:09:10.772 DEBUG (MainThread) [custom_components.zha_toolkit.utils] Parameters '{'ieee': a4:c1:38:50:cb:7d:72:46, 'endpoint': 1, 'attribute': 53296, 'cluster': 57345, 'attr_val': 1, 'manf': 4417}' homeassistant | 2024-04-24 09:09:10.773 DEBUG (MainThread) [custom_components.zha_toolkit.utils] Final manf '4417' homeassistant | 2024-04-24 09:09:10.775 DEBUG (MainThread) [custom_components.zha_toolkit] 'ieee' parameter: 'a4:c1:38:50:cb:7d:72:46' -> IEEE Addr: 'a4:c1:38:50:cb:7d:72:46' homeassistant | 2024-04-24 09:09:10.775 DEBUG (MainThread) [custom_components.zha_toolkit] Default handler for attr_write homeassistant | 2024-04-24 09:09:10.775 DEBUG (MainThread) [custom_components.zha_toolkit] Handler: homeassistant | 2024-04-24 09:09:10.775 DEBUG (MainThread) [custom_components.zha_toolkit] running default command: homeassistant | 2024-04-24 09:09:10.779 DEBUG (MainThread) [custom_components.zha_toolkit.default] Trying to import custom_components.zha_toolkit.zcl_attr to call attr_write homeassistant | 2024-04-24 09:09:10.781 DEBUG (MainThread) [custom_components.zha_toolkit.utils] IEEE for get_device: a4:c1:38:50:cb:7d:72:46 a4:c1:38:50:cb:7d:72:46 homeassistant | 2024-04-24 09:09:10.782 DEBUG (MainThread) [custom_components.zha_toolkit.zcl_attr] Request attr read [53296] homeassistant | 2024-04-24 09:09:10.841 DEBUG (MainThread) [custom_components.zha_toolkit.zcl_attr] Reading attr result (attrs, status): ({}, {53296: 0}) homeassistant | 2024-04-24 09:09:10.842 DEBUG (MainThread) [custom_components.zha_toolkit.utils] Data type '' for attr type 48 homeassistant | 2024-04-24 09:09:10.842 DEBUG (MainThread) [custom_components.zha_toolkit.utils] Converted 1 to TypeValue(type=enum8, value=) - will compare to enum8.undefined_0x01 - Type: 0x30 homeassistant | 2024-04-24 09:09:10.842 DEBUG (MainThread) [custom_components.zha_toolkit.zcl_attr] Request attr write [Attribute(attrid=0xD030, value=TypeValue(type=enum8, value=))] homeassistant | 2024-04-24 09:09:10.910 DEBUG (MainThread) [custom_components.zha_toolkit.zcl_attr] Write attr status: Default_Response(command_id=2, status=) homeassistant | 2024-04-24 09:09:10.911 DEBUG (MainThread) [custom_components.zha_toolkit.zcl_attr] Request attr read [53296] homeassistant | 2024-04-24 09:09:10.973 DEBUG (MainThread) [custom_components.zha_toolkit.zcl_attr] Reading attr result (attrs, status): ({}, {53296: 0}) homeassistant | 2024-04-24 09:09:10.973 WARNING (MainThread) [custom_components.zha_toolkit.zcl_attr] Result: {53296: 0} - Attribute 53296 not in read ({}, {53296: 0}) homeassistant | 2024-04-24 09:09:10.973 DEBUG (MainThread) [custom_components.zha_toolkit] event_data {'zha_toolkit_version': 'v1.1.10', 'zigpy_version': '0.63.5', 'zigpy_rf_version': '0.38.1', 'ieee_org': a4:c1:38:50:cb:7d:72:46, 'ieee': 'a4:c1:38:50:cb:7d:72:46', 'command': 'attr_write', 'command_data': None, 'start_time': '2024-04-24T07:09:10.775205+00:00', 'errors': ['TypeError("\'uint8_t\' object is not subscriptable")'], 'params': {'endpoint_id': 1, 'cluster_id': 57345, 'attr_id': 53296, 'attr_val': 1, 'dir': 0, 'manf': 4417, 'tries': 1, 'expect_reply': True, 'args': [], 'read_before_write': True, 'read_after_write': True}, 'compare_val': , 'attr_type': '0x30', 'write_is_equal': False, 'read_before': ({}, {53296: 0}), 'result_write': Default_Response(command_id=2, status=), 'result_read': ({}, {53296: 0}), 'warnings': ['Result: {53296: 0} - Attribute 53296 not in read ({}, {53296: 0})'], 'success': False} ```

Additional information

Home Assistant docker release: Core 2024.4.4 Interfejs użytkownika 20240404.2

sltvtr commented 3 months ago

I've just read through the device diagnostics and I think I found something relevant. There is cluster 0xE001 for external switch type and its attribute 0xD030, but in "unsupported_attributes" section:

          "0xe001": {
            "endpoint_attribute": "tuya_external_switch_type",
            "attributes": {},
            "unsupported_attributes": {
              "0xd030": {
                "attribute_name": "external_switch_type"
              }
            }

Why is that? Is that somehow recoverable?

sltvtr commented 1 month ago

It turned out that this model doesn't support changing button type. I had to return them and buy 1-channel controllers for bistable button. Case closed.