zha-device-handlers
zha-device-handlers copied to clipboard
[BUG] IKEA TRADFRI - SWITCH Dimmer E1743 (Zigbee)
its about this device: zigbee2mqtt --> E1743
Describe the bug
I want to create an automation based on the "long-press"=action1 + "release after long press"=action2 functions.
on the button "I = on = dimmer up" everything works fine :-)
but if i (after a longpress) release the button "o = off = dimmer down",
it triggers the "button up: release after long press" function,
instead of the expected "button down: release after long press".
To Reproduce Steps to reproduce the behavior:
- Go to "devices" --> open the device itself
- Click on "automations" --> click on "do something if... "
- Click on "button down: release after long press" aka. [german] "Dimmer runter" Taste nach langem Drücken losgelassen"
- Create your automation & test it
- See error described above
Expected behavior see above...
hint / my theory i've checked the zha_event logs. and if you check carefully there actually is the exact same log for both functions (posted below). maybe during programming someone simply copy n pasted the "up"-code but didnt change it into "down"?
sidenote i also noticed, that the script for both "long press" functions differ a bit stragely. but since a) i know nothing about this, and b) it works! ...so better dont touch it, i guess?? ^^
Device signature
{
"node_descriptor": "NodeDescriptor(logical_type=<LogicalType.EndDevice: 2>, complex_descriptor_available=0, user_descriptor_available=0, reserved=0, aps_flags=0, frequency_band=<FrequencyBand.Freq2400MHz: 8>, mac_capability_flags=<MACCapabilityFlags.AllocateAddress: 128>, manufacturer_code=4476, maximum_buffer_size=82, maximum_incoming_transfer_size=82, server_mask=11264, maximum_outgoing_transfer_size=82, descriptor_capability_field=<DescriptorCapability.NONE: 0>, *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": "0x0820",
"in_clusters": [
"0x0000",
"0x0001",
"0x0003",
"0x0009",
"0x0020",
"0x1000",
"0xfc7c"
],
"out_clusters": [
"0x0003",
"0x0004",
"0x0006",
"0x0008",
"0x0019",
"0x0102",
"0x1000"
]
}
},
"manufacturer": "IKEA of Sweden",
"model": "TRADFRI on/off switch",
"class": "zhaquirks.ikea.twobtnremote.IkeaTradfriRemote2Btn"
}
Automation: yaml code
alias: Neue Automatisierung
description: ''
trigger:
- device_id: 9fa8ab01e402c95578a21d2bf72ab456
domain: zha
platform: device
type: remote_button_long_release
subtype: dim_down
condition: []
action:
- type: turn_off
device_id: 963c08ef31c8970b763bb96f2bbac958
entity_id: light.led_e27_w01_sebzimmer_decke
domain: light
mode: single
zha_event logs: long press up
{
"event_type": "zha_event",
"data": {
"device_ieee": "54:0f:57:ff:fe:f0:9b:a1",
"unique_id": "54:0f:57:ff:fe:f0:9b:a1:1:0x0008",
"device_id": "9fa8ab01e402c95578a21d2bf72ab456",
"endpoint_id": 1,
"cluster_id": 8,
"command": "move_with_on_off",
"args": [
0,
83
],
"params": {
"move_mode": 0,
"rate": 83
}
},
"origin": "LOCAL",
"time_fired": "2022-06-07T22:08:50.916046+00:00",
"context": {
"id": "01G503D874EZ41B3F24KRDG3R6",
"parent_id": null,
"user_id": null
}
}
zha_event logs: long press up release
{
"event_type": "zha_event",
"data": {
"device_ieee": "54:0f:57:ff:fe:f0:9b:a1",
"unique_id": "54:0f:57:ff:fe:f0:9b:a1:1:0x0008",
"device_id": "9fa8ab01e402c95578a21d2bf72ab456",
"endpoint_id": 1,
"cluster_id": 8,
"command": "stop_with_on_off",
"args": [],
"params": {}
},
"origin": "LOCAL",
"time_fired": "2022-06-07T22:09:05.046569+00:00",
"context": {
"id": "01G503DP0PDD0YC4PTZEM2ZSYN",
"parent_id": null,
"user_id": null
}
}
zha_event logs: long press down
{
"event_type": "zha_event",
"data": {
"device_ieee": "54:0f:57:ff:fe:f0:9b:a1",
"unique_id": "54:0f:57:ff:fe:f0:9b:a1:1:0x0008",
"device_id": "9fa8ab01e402c95578a21d2bf72ab456",
"endpoint_id": 1,
"cluster_id": 8,
"command": "move",
"args": [
1,
83,
0,
0
],
"params": {
"move_mode": 1,
"rate": 83,
"options_mask": 0,
"options_override": 0
}
},
"origin": "LOCAL",
"time_fired": "2022-06-07T22:09:18.709119+00:00",
"context": {
"id": "01G503E3BNFQ221P1J0600PQW9",
"parent_id": null,
"user_id": null
}
}
zha_event logs: long press down release
{
"event_type": "zha_event",
"data": {
"device_ieee": "54:0f:57:ff:fe:f0:9b:a1",
"unique_id": "54:0f:57:ff:fe:f0:9b:a1:1:0x0008",
"device_id": "9fa8ab01e402c95578a21d2bf72ab456",
"endpoint_id": 1,
"cluster_id": 8,
"command": "stop_with_on_off",
"args": [],
"params": {}
},
"origin": "LOCAL",
"time_fired": "2022-06-07T22:09:32.728173+00:00",
"context": {
"id": "01G503EH1RZ9WEYS23GTFPT4ER",
"parent_id": null,
"user_id": null
}
}
Additional context Add any other context about the problem here.
The dimmer switch is sending move with direction up and down then long pressing.
The Zigbee command for stop moving is one stop command without direction so both release commands is the same.
In the Open/Close button it have implanting one "memory" of the last direction that is used tagging the stop command and its working OK. You can see how its being done in this class: https://github.com/zigpy/zha-device-handlers/blob/b6556169bf641e8f2eb882e8ace4a5a1ab4552d5/zhaquirks/ikea/opencloseremote.py#L47 You can do the same with automatons in HA but i dont have the experience how to do it or you is updating the quirk with the function so it working as the Open/Close button.
Hi, can I somehow vote for this? I just ran into the exact same issue. The long-press-0-release Event does not work. The log shows two "Dim Up-Release" events even though on the second one I was actually using '0':

Then implanting the "memory" function for getting separate DA for release from long press up and down as written in https://github.com/zigpy/zha-device-handlers/issues/1614#issuecomment-1149452891.
All code enchantment is very welcome in the Zigpy and HA project.
Thank you for your quick response. I really would like to help but I don't have any python experience. So it would definitely make things a lot worse. Will give zigbee2mqtt a try...
Very similar to https://github.com/zigpy/zha-device-handlers/issues/2024
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.