Closed brantmacga closed 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:
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.
thanks.... Still not working. The 'On/off' and 'PollControl' are not binding.
I can't say anything about the binding part, but is the switch status updating in HA?
Maybe an EventableCluster
can be implemented...
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.
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.
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.
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.
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.
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?
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>')]
Any idea what these errors could mean ?
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?
home-assistant_zha_2022-12-22T21-50-58.603Z.log
Log attached. Thanks!
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.
I'm sorry, I don't quite fully understand where I should be placing that text within the quirk .py file
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
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:
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?
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!
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.
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.
@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.
@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.
@javicalle I will try the updated code when get home later today. thank you!
one example of DA with toggle: https://github.com/zigpy/zha-device-handlers/blob/c2b2893d027fdcd3a225996fdf382d2ac72ff799/zhaquirks/tuya/ts004f.py#L134
@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.
@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.
Just one question, is still needed the quirk? I mean, if you just need the binding, can it be done without the quirk?
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: @.***>
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
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,
)
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.
Your device signature don't match the quirk. Let's continue in #2098
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.
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=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=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.