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
743 stars 680 forks source link

[Device Support Request] Bticino 3577C Toggle Switch Relay #1970

Closed brantmacga closed 1 year ago

brantmacga commented 1 year ago

Is your feature request related to a problem? Please describe. I can pair this toggle switch device, but am unable to bind to a lamp or use in automations. It works correctly in Zigbee2MQTT.

Describe the solution you'd like I would like to be able to bind this to a zigbee lamp to toggle on/off, or use in automations. Link to product - https://catalogue.bticino.com/BTI-3577C-EN

Device signature ```yaml { "node_descriptor": "NodeDescriptor(logical_type=, complex_descriptor_available=0, user_descriptor_available=1, reserved=0, aps_flags=0, frequency_band=, mac_capability_flags=, manufacturer_code=4129, maximum_buffer_size=89, maximum_incoming_transfer_size=63, server_mask=10752, maximum_outgoing_transfer_size=63, descriptor_capability_field=, *allocate_address=True, *is_alternate_pan_coordinator=False, *is_coordinator=False, *is_end_device=True, *is_full_function_device=False, *is_mains_powered=False, *is_receiver_on_when_idle=False, *is_router=False, *is_security_capable=False)", "endpoints": { "1": { "profile_id": 260, "device_type": "0x0103", "in_clusters": [ "0x0000", "0x0001", "0x0003", "0x000f", "0x0020", "0xfc01" ], "out_clusters": [ "0x0000", "0x0003", "0x0006", "0x0019", "0xfc01" ] } }, "manufacturer": " Legrand", "model": " Remote toggle switch", "class": "zigpy.device.Device" } ```
Diagnostic information ```yaml { "home_assistant": { "installation_type": "Home Assistant OS", "version": "2022.11.4", "dev": false, "hassio": true, "virtualenv": false, "python_version": "3.10.7", "docker": true, "arch": "aarch64", "timezone": "America/New_York", "os_name": "Linux", "os_version": "5.15.61-v8", "supervisor": "2022.11.2", "host_os": "Home Assistant OS 9.3", "docker_version": "20.10.18", "chassis": "embedded", "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.34.2", "pyserial==3.5", "pyserial-asyncio==0.6", "zha-quirks==0.0.86", "zigpy-deconz==0.19.0", "zigpy==0.51.5", "zigpy-xbee==0.16.2", "zigpy-zigate==0.10.3", "zigpy-znp==0.9.1" ], "usb": [ { "vid": "10C4", "pid": "EA60", "description": "*2652*", "known_devices": [ "slae.sh cc2652rb stick" ] }, { "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": "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*" }, { "type": "_zigstar_gw._tcp.local.", "name": "*zigstar*" } ], "dependencies": [ "file_upload" ], "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": 5431, "manufacturer": " Legrand", "model": " Remote toggle switch", "name": " Legrand Remote toggle switch", "quirk_applied": false, "quirk_class": "zigpy.device.Device", "manufacturer_code": 4129, "power_source": "Battery or Unknown", "lqi": 255, "rssi": -73, "last_seen": "2022-11-27T19:27:54", "available": true, "device_type": "EndDevice", "signature": { "node_descriptor": "NodeDescriptor(logical_type=, complex_descriptor_available=0, user_descriptor_available=1, reserved=0, aps_flags=0, frequency_band=, mac_capability_flags=, manufacturer_code=4129, maximum_buffer_size=89, maximum_incoming_transfer_size=63, server_mask=10752, maximum_outgoing_transfer_size=63, descriptor_capability_field=, *allocate_address=True, *is_alternate_pan_coordinator=False, *is_coordinator=False, *is_end_device=True, *is_full_function_device=False, *is_mains_powered=False, *is_receiver_on_when_idle=False, *is_router=False, *is_security_capable=False)", "endpoints": { "1": { "profile_id": 260, "device_type": "0x0103", "in_clusters": [ "0x0000", "0x0001", "0x0003", "0x000f", "0x0020", "0xfc01" ], "out_clusters": [ "0x0000", "0x0003", "0x0006", "0x0019", "0xfc01" ] } } }, "active_coordinator": false, "entities": [ { "entity_id": "binary_sensor.legrand_remote_toggle_switch_binaryinput", "name": " Legrand Remote toggle switch" }, { "entity_id": "button.legrand_remote_toggle_switch_identify", "name": " Legrand Remote toggle switch" }, { "entity_id": "sensor.legrand_remote_toggle_switch_battery", "name": " Legrand Remote toggle switch" } ], "neighbors": [], "endpoint_names": [ { "name": "ON_OFF_LIGHT_SWITCH" } ], "user_given_name": null, "device_reg_id": "630c75403487615f3e4fbc44ed1b3b73", "area_id": "patio", "cluster_details": { "1": { "device_type": { "name": "ON_OFF_LIGHT_SWITCH", "id": 259 }, "profile_id": 260, "in_clusters": { "0x0000": { "endpoint_attribute": "basic", "attributes": { "0x0004": { "attribute_name": "manufacturer", "value": " Legrand" }, "0x0005": { "attribute_name": "model", "value": " Remote toggle switch" } }, "unsupported_attributes": {} }, "0x0003": { "endpoint_attribute": "identify", "attributes": {}, "unsupported_attributes": {} }, "0x000f": { "endpoint_attribute": "binary_input", "attributes": { "0x0055": { "attribute_name": "present_value", "value": 0 } }, "unsupported_attributes": {} }, "0x0020": { "endpoint_attribute": "poll_control", "attributes": { "0x0000": { "attribute_name": "checkin_interval", "value": 13200 } }, "unsupported_attributes": {} }, "0x0001": { "endpoint_attribute": "power", "attributes": { "0x0020": { "attribute_name": "battery_voltage", "value": 27 } }, "unsupported_attributes": { "0x0021": { "attribute_name": "battery_percentage_remaining" }, "0x0033": { "attribute_name": "battery_quantity" }, "0x0031": { "attribute_name": "battery_size" } } }, "0xfc01": { "endpoint_attribute": "manufacturer_specific", "attributes": {}, "unsupported_attributes": {} } }, "out_clusters": { "0x0003": { "endpoint_attribute": "identify", "attributes": {}, "unsupported_attributes": {} }, "0x0006": { "endpoint_attribute": "on_off", "attributes": {}, "unsupported_attributes": {} }, "0x0000": { "endpoint_attribute": "basic", "attributes": {}, "unsupported_attributes": {} }, "0xfc01": { "endpoint_attribute": "manufacturer_specific", "attributes": {}, "unsupported_attributes": {} }, "0x0019": { "endpoint_attribute": "ota", "attributes": {}, "unsupported_attributes": {} } } } } } } ```
Additional logs ``` Paste any additional debug logs here. Don't remove the extra line breaks outside the ``` marks. ```

Additional context Add any other context or screenshots about the feature request here.

javicalle commented 1 year ago

Not sure if that quirk could fix the related issue because other Legrand devices are quite standar zigbee.

If you want to try, there is my proposal:

RemoteSwitch ```python class OnOffEventsCluster(EventableCluster, OnOff): """OnOffEventsCluster: fire events corresponding to press type.""" class RemoteSwitch(CustomDevice): """Remote switch.""" signature = { MODELS_INFO: [(f" {LEGRAND}", " Remote toggle switch")], ENDPOINTS: { 1: { # "profile_id": 260, # "device_type": "0x0103", # "in_clusters": ["0x0000","0x0001","0x0003","0x000f","0x0020","0xfc01"], # "out_clusters": ["0x0000","0x0003","0x0006","0x0019","0xfc01"] PROFILE_ID: zha.PROFILE_ID, DEVICE_TYPE: zha.DeviceType.ON_OFF_LIGHT_SWITCH, INPUT_CLUSTERS: [ Basic.cluster_id, PowerConfigurationCluster.cluster_id, Identify.cluster_id, BinaryInput.cluster_id, PollControl.cluster_id, LegrandCluster.cluster_id, ], OUTPUT_CLUSTERS: [ Basic.cluster_id, Identify.cluster_id, OnOff.cluster_id, Ota.cluster_id, LegrandCluster.cluster_id, ], } }, } replacement = { ENDPOINTS: { 1: { INPUT_CLUSTERS: [ Basic.cluster_id, LegrandPowerConfigurationCluster, Identify.cluster_id, BinaryInput.cluster_id, PollControl.cluster_id, LegrandCluster, ], OUTPUT_CLUSTERS: [ Basic.cluster_id, Identify.cluster_id, OnOffEventsCluster, Ota.cluster_id, LegrandCluster, ], } } } device_automation_triggers = { (SHORT_PRESS, BUTTON_1): {ENDPOINT_ID: 1, COMMAND: SHORT_PRESS}, (LONG_PRESS, BUTTON_1): {ENDPOINT_ID: 1, COMMAND: LONG_PRESS}, (DOUBLE_PRESS, BUTTON_1): {ENDPOINT_ID: 1, COMMAND: DOUBLE_PRESS}, } ```

You can enable the local quirks and copy the current legrand/dimmer.py file:

Add the proposed quirk at the end of the file. Save changes, restart HA and repair the device.

If not working, enable the debud logs and attach the relavant info.

brantmacga commented 1 year ago

thanks.... Still not working. The 'On/off' and 'PollControl' are not binding.

javicalle commented 1 year ago

I can't say anything about the binding part, but is the switch status updating in HA? Maybe an EventableCluster can be implemented...

brantmacga commented 1 year ago

it doesn't appear to be using the quirk. I say this because when I look at my remote dimmer, if I check "Zigbee info" I see on the last line that its using a quirk. I do not see the same information on the remote toggle switch, and nothing about its behavior has changed.

javicalle commented 1 year ago

I have added an OnOffEventsCluster to the proposed quirk. It is used in the replacement part.

As a remote switch this device has not a switch entity in HA, isn't it?

The new quirk may trigger zha_event with the button pressed.

brantmacga commented 1 year ago

I have added an OnOffEventsCluster to the proposed quirk. It is used in the replacement part.

As a remote switch this device has not a switch entity in HA, isn't it?

The new quirk may trigger zha_event with the button pressed.

Diagnostic information ```yaml { "home_assistant": { "installation_type": "Home Assistant OS", "version": "2022.11.5", "dev": false, "hassio": true, "virtualenv": false, "python_version": "3.10.7", "docker": true, "arch": "aarch64", "timezone": "America/New_York", "os_name": "Linux", "os_version": "5.15.61-v8", "supervisor": "2022.11.2", "host_os": "Home Assistant OS 9.3", "docker_version": "20.10.18", "chassis": "embedded", "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.34.4", "pyserial==3.5", "pyserial-asyncio==0.6", "zha-quirks==0.0.87", "zigpy-deconz==0.19.1", "zigpy==0.51.6", "zigpy-xbee==0.16.2", "zigpy-zigate==0.10.3", "zigpy-znp==0.9.1" ], "usb": [ { "vid": "10C4", "pid": "EA60", "description": "*2652*", "known_devices": [ "slae.sh cc2652rb stick" ] }, { "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": "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*" }, { "type": "_zigstar_gw._tcp.local.", "name": "*zigstar*" } ], "dependencies": [ "file_upload" ], "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": 16373, "manufacturer": " Legrand", "model": " Remote toggle switch", "name": " Legrand Remote toggle switch", "quirk_applied": false, "quirk_class": "zigpy.device.Device", "manufacturer_code": 4129, "power_source": "Battery or Unknown", "lqi": null, "rssi": null, "last_seen": "2022-12-04T17:41:37", "available": true, "device_type": "EndDevice", "signature": { "node_descriptor": "NodeDescriptor(logical_type=, complex_descriptor_available=0, user_descriptor_available=1, reserved=0, aps_flags=0, frequency_band=, mac_capability_flags=, manufacturer_code=4129, maximum_buffer_size=89, maximum_incoming_transfer_size=63, server_mask=10752, maximum_outgoing_transfer_size=63, descriptor_capability_field=, *allocate_address=True, *is_alternate_pan_coordinator=False, *is_coordinator=False, *is_end_device=True, *is_full_function_device=False, *is_mains_powered=False, *is_receiver_on_when_idle=False, *is_router=False, *is_security_capable=False)", "endpoints": { "1": { "profile_id": 260, "device_type": "0x0103", "in_clusters": [ "0x0000", "0x0001", "0x0003", "0x000f", "0x0020", "0xfc01" ], "out_clusters": [ "0x0000", "0x0003", "0x0006", "0x0019", "0xfc01" ] } } }, "active_coordinator": false, "entities": [ { "entity_id": "binary_sensor.legrand_remote_toggle_switch_binaryinput", "name": " Legrand Remote toggle switch" }, { "entity_id": "button.legrand_remote_toggle_switch_identify", "name": " Legrand Remote toggle switch" }, { "entity_id": "sensor.legrand_remote_toggle_switch_battery", "name": " Legrand Remote toggle switch" } ], "neighbors": [], "endpoint_names": [ { "name": "ON_OFF_LIGHT_SWITCH" } ], "user_given_name": null, "device_reg_id": "630c75403487615f3e4fbc44ed1b3b73", "area_id": "patio", "cluster_details": { "1": { "device_type": { "name": "ON_OFF_LIGHT_SWITCH", "id": 259 }, "profile_id": 260, "in_clusters": { "0x0000": { "endpoint_attribute": "basic", "attributes": { "0x0004": { "attribute_name": "manufacturer", "value": " Legrand" }, "0x0005": { "attribute_name": "model", "value": " Remote toggle switch" } }, "unsupported_attributes": {} }, "0x0003": { "endpoint_attribute": "identify", "attributes": {}, "unsupported_attributes": {} }, "0x000f": { "endpoint_attribute": "binary_input", "attributes": {}, "unsupported_attributes": {} }, "0x0020": { "endpoint_attribute": "poll_control", "attributes": {}, "unsupported_attributes": {} }, "0x0001": { "endpoint_attribute": "power", "attributes": {}, "unsupported_attributes": {} }, "0xfc01": { "endpoint_attribute": "manufacturer_specific", "attributes": {}, "unsupported_attributes": {} } }, "out_clusters": { "0x0003": { "endpoint_attribute": "identify", "attributes": {}, "unsupported_attributes": {} }, "0x0006": { "endpoint_attribute": "on_off", "attributes": {}, "unsupported_attributes": {} }, "0x0000": { "endpoint_attribute": "basic", "attributes": {}, "unsupported_attributes": {} }, "0xfc01": { "endpoint_attribute": "manufacturer_specific", "attributes": {}, "unsupported_attributes": {} }, "0x0019": { "endpoint_attribute": "ota", "attributes": {}, "unsupported_attributes": {} } } } } } } ```

It didn't work that time either. I don't think the switch is seeing the quirk.

My process was to delete the toggle switch, add new lines to the .py file, restart HA, then pair the toggle switch. When I click on "Zigbee Info" on the toggle switch page, I'm not seeing the quirk like I do on the wireless dimmer; the wireless dimmer doesn't work either though.

Thanks.

javicalle commented 1 year ago

The device is not loading the quirk. Double check that there is no a __pycache__ folder in your local quirk folder. Also look for any exception or errors in the HA startup logs. Maybe there is a errata in the local quirk code.

brantmacga commented 1 year ago

The device is not loading the quirk. Double check that there is no a __pycache__ folder in your local quirk folder. Also look for any exception or errors in the HA startup logs. Maybe there is a errata in the local quirk code.

not seeing the pycache folder, and I just read through all of the logs and did not see any errors related to that switch. Certainly possible I'm overlooking something.

I noticed the quirk calls it an ON_OFF_LIGHT_SWITCH; the device model in the diagnostics refers to it only as a Toggle switch. Would that have anything to do with it?

brantmacga commented 1 year ago

ok I deleted the device, paired again, and I saw this in the logs while adding to ZHA....

[0x0A92:1:0x0003] Decoded ZCL frame: Identify:identify_query() [0x0A92:1:0x0003] Received command 0x01 (TSN 1): identify_query() [0x0A92:1:0x0003] No explicit handler for cluster command 0x01: identify_query() [0x3208:1:0x0006]: failed to get attributes '['on_off']' on 'on_off' cluster: Failed to deliver packet: <TXStatus.NWK_ROUTE_DISCOVERY_FAILED: 208> [0x3208:1:0x0006]: async_initialize: all attempts have failed: [DeliveryError('Failed to deliver packet: <TXStatus.NWK_ROUTE_DISCOVERY_FAILED: 208>'), DeliveryError('Failed to deliver packet: <TXStatus.NWK_ROUTE_DISCOVERY_FAILED: 208>'), DeliveryError('Failed to deliver packet: <TXStatus.NWK_ROUTE_DISCOVERY_FAILED: 208>'), DeliveryError('Failed to deliver packet: <TXStatus.NWK_ROUTE_DISCOVERY_FAILED: 208>')]

brantmacga commented 1 year ago

Any idea what these errors could mean ?

javicalle commented 1 year ago

The errors seem to be some communication error. Not sure if related. Can you enable the debug logs and attach the logs from pairing the device?

brantmacga commented 1 year ago

home-assistant_zha_2022-12-22T21-50-58.603Z.log

Log attached. Thanks!

javicalle commented 1 year ago

That part is very significative:

2022-12-22 16:47:07.573 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry ConBee II, s/n: DE2483634 - dresden elektronik ingenieurtechnik GmbH for zha
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 372, in async_setup
    result = await component.async_setup_entry(hass, self)
  File "/usr/src/homeassistant/homeassistant/components/zha/__init__.py", line 100, in async_setup_entry
    setup_quirks(config)
  File "/usr/local/lib/python3.10/site-packages/zhaquirks/__init__.py", line 409, in setup
    importer.find_module(modname).load_module(modname)
  File "<frozen importlib._bootstrap_external>", line 548, in _check_name_wrapper
  File "<frozen importlib._bootstrap_external>", line 1063, in load_module
  File "<frozen importlib._bootstrap_external>", line 888, in load_module
  File "<frozen importlib._bootstrap>", line 290, in _load_module_shim
  File "<frozen importlib._bootstrap>", line 719, in _load
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/config/zha_quirks/legrand_wireless_dimmer.py", line 170, in <module>
    class OnOffEventsCluster(EventableCluster, OnOff):
NameError: name 'EventableCluster' is not defined

Edit the quirk and add the EventableCluster import statement replacing this line:

from zhaquirks import EventableCluster, PowerConfigurationCluster

Save changes, delete any __pycache__ folder from your local quirk folder, restart HA and pair the device again.

brantmacga commented 1 year ago

I'm sorry, I don't quite fully understand where I should be placing that text within the quirk .py file

brantmacga commented 1 year ago

I added the text line above the quirk for the toggle switch. Log is attached. thank you. home-assistant_zha_2022-12-23T00-26-40.166Z.log

javicalle commented 1 year ago

I'm sorry, I don't quite fully understand where I should be placing that text within the quirk .py file

At the top of file, where are all the import statements you need to replace this line with the proposed one:

javicalle commented 1 year ago

I don't see any error in the logs. I don't see any command or zha_event

Have you validated in the Device view if the device is loading the quirk? Have you tested if the device is generating events from the device actions?

brantmacga commented 1 year ago

Ok it is now loading the quirk... Quirk: legrand_wireless_dimmer.RemoteSwitch

And it is firing events in the log.

What I am missing now is the "toggle" action when using for automations. I have "Binary Input Turned On" or "Binary Input Turned Off".

When I pair it through Z2M, I have a "toggle" option that allows me to use it like a normal switch with anything. Thank you again!

brantmacga commented 1 year ago

I will also add that in the event log, I see "Legrand Remote toggle switch Toggle event was fired".

edit .... I was able to Bind to the hue lamp, I just didn't wake it up correctly on the first try. So it IS toggling Hue lamps off/on when I bind it. But I would like to see the "toggle" option within automations.

javicalle commented 1 year ago

The quirk has nothing to do with the direct binding between devices.

In ZHA you can use triggers in automations but will not create a switch or input. I have updated the code from my comment to add the triggers:

    device_automation_triggers = {
        (SHORT_PRESS, BUTTON_1): {ENDPOINT_ID: 1, COMMAND: SHORT_PRESS},
        (LONG_PRESS, BUTTON_1): {ENDPOINT_ID: 1, COMMAND: LONG_PRESS},
        (DOUBLE_PRESS, BUTTON_1): {ENDPOINT_ID: 1, COMMAND: DOUBLE_PRESS},
    }

But these are just an example. We need to know the events and attributes for that device. So we need that you test the posible events (click, double-click, long-press, release, whatever...) and attach the events to see what can be done and how.

MattWestb commented 1 year ago

@brantmacga Do you getting command 0x02 (toggle) in the log then pressing the button ? If yes make one device automation with it as @javicalle was explaining in the example above. If the device is not sending toggle you cant do device automatons for it then the device is not sending it.

Z2M is making may things that is emulated function like brightness for one dimmer remote that is only emulated and is not one real thing and is being broken if using more dimmers or other device is changing the real one.

brantmacga commented 1 year ago

@MattWestb in the Logbook, I see 'Legrand Remote toggle switch Toggle even was fired'. If I use the same device paired with Z2M, I do have a "Toggle" option in automations.

brantmacga commented 1 year ago

@javicalle I will try the updated code when get home later today. thank you!

MattWestb commented 1 year ago

one example of DA with toggle: https://github.com/zigpy/zha-device-handlers/blob/c2b2893d027fdcd3a225996fdf382d2ac72ff799/zhaquirks/tuya/ts004f.py#L134

brantmacga commented 1 year ago

@javicalle I haven't been able to get it to work correctly yet with the code. It did give me an error about attributes not being define (BUTTON_1) and (DOUBLE_PRESS); I added those to the list below {from zhaquirks.const import} and got ZHA to load correctly, but now it won't load the switch attributes when I try to pair it; and it actually won't show that its paired within ZHA.

I also tried @MattWestb 's example in its place, added the definition for (COMMAND_TOGGLE) and (BUTTON_1), and now the switch will pair, and I can try to create an automation with it, but it doesn't work. When I check the log, no ZHA Events are being received.

Still thinking it through.

brantmacga commented 1 year ago

@javicalle I think I'm going to leave it alone for now.... It is binding with zigbee lamps and switching them correctly. If I can get my wireless dimmer to work reported here https://github.com/zigpy/zha-device-handlers/issues/1969 then I really don't have a need for the automation toggle trigger. I could just bind everything together in ZHA and be done with it. Thanks for all the help.

javicalle commented 1 year ago

Just one question, is still needed the quirk? I mean, if you just need the binding, can it be done without the quirk?

brantmacga commented 1 year ago

I was unable to bind without using the quirk, so yes, definitely needed

Thanks

On Dec 23, 2022, at 3:45 PM, javicalle @.***> wrote:



Just one question, is still needed the quirk? I mean, is you just need the binding, can it be done without the quirk?

— Reply to this email directly, view it on GitHubhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fzigpy%2Fzha-device-handlers%2Fissues%2F1970%23issuecomment-1364324409&data=05%7C01%7C%7C26292712a1fd4c7fe21e08dae526a397%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638074251363486543%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=NLM0cAybeWpK9JPK39RLMbw4BDwJg8gaZ3a1abZl1OI%3D&reserved=0, or unsubscribehttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FA2SJ3KXJ2XRDZ6TVMQMUCR3WOYFO5ANCNFSM6AAAAAASMZDJPA&data=05%7C01%7C%7C26292712a1fd4c7fe21e08dae526a397%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638074251363486543%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=s7bDnWxYdTiETsDE70KfXME06NEvTKuqj1udv9ylM8Y%3D&reserved=0. You are receiving this because you were mentioned.Message ID: @.***>

Buci007 commented 1 year ago

Hello! Thank you for your information. I tried the suggested quirk. Added the code at the and of the original legrand/dimmer.py and updated the line 20 "from zhaquirks import EventableCluster, PowerConfigurationCluster". The file put in the zha_custom_quirks and restart HA. The coordinator crashed. If I tried with the original dimmer.py file the system restart without any failure. My switch device_type: "0x104" and model: Remote switch". I changed these 2 part in the code, but the result was same. Crash again. Ps.: I use already custom quirk for termostat valve: ts0601_trv_moes.py. home-assistant_2023-01-15T19-35-31.842Z.log

javicalle commented 1 year ago

You need to import all the device_automation_triggers constants:

from zhaquirks.const import (
    BUTTON_1,
    COMMAND,
    DEVICE_TYPE,
    DOUBLE_PRESS,
    ENDPOINT_ID,
    ENDPOINTS,
    INPUT_CLUSTERS,
    LONG_PRESS,
    MODELS_INFO,
    OUTPUT_CLUSTERS,
    PROFILE_ID,
    SHORT_PRESS,
)
Buci007 commented 1 year ago

Good morning! Thank you. I updated the quirk. Deleted all the not needed devices to be able better overview it and updated the remote switch part with my device_type: "0x104" and model: " Remote switch" The quirk is loading. The sytem started. home-assistant_2023-01-16T06-43-03.867Z.log I added the switch new, but based on his signature does not use the quirk. Signature.txt dimmer.txt Thank you in advance your response.

javicalle commented 1 year ago

Your device signature don't match the quirk. Let's continue in #2098

github-actions[bot] commented 1 year ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.