Sian-Lee-SA / Home-Assistant-Switch-Manager

Switch manager is a centralised component to handle button pushes for your wireless switches. This includes anything passed through the event bus. The component relies on switch blueprints which is easily made to allow GUI configuration of your switches and their button pushes. This helps remove clutter from the automations.
Other
274 stars 90 forks source link

Zigbee2MQTT / IKEA TRÅDFRI Remote Toggle doesn't work #263

Open Stephan-4711 opened 1 month ago

Stephan-4711 commented 1 month ago

Hi,

the Zigbee2MQTT / IKEA TRÅDFRI Remote 5 Button remote isn't working as expected. I want to use the main button to toggle a light on and off. But a short press only switches the light on.

I needed to add a long press to switch the light off. Maybe a problem with key bouncing? I used this switch inside a automation before, there I didn't had problems with toggling.

P.s. the readme in HACS has a link to download the component, which brought me here. Maybe an addional link just to the project would be nice and easier to find this git?

Sian-Lee-SA commented 1 month ago

I'm not the author for that remote but I did compare the Z2M docs and the blueprint and seems to be correct. Have you ensured legacy settings are off in Z2M? If so I would suggest seeing what comes through with MQTT Explorer and compare.

Blueprint: https://github.com/Sian-Lee-SA/Home-Assistant-Switch-Manager/blob/master/custom_components/switch_manager/blueprints/zigbee2mqtt-ikea-tradfri-remote.yaml

Z2M doc: https://www.zigbee2mqtt.io/devices/E1524_E1810.html

Sian-Lee-SA commented 1 month ago

Also ensure everything is up to date (including firmware)

Stephan-4711 commented 1 month ago

I haven't changed anything since I added the switch 3 weeks ago. just set it back to toggle, now it works. Sorry for distrubing you

Stephan-4711 commented 1 month ago

Very weird, now it's back. One quick button press and it's toggling on and off again

Sian-Lee-SA commented 1 month ago

Open kebab menu in top right and select debug then open your browsers dev console. Next press the button on the remote and check to see if it's only being registered once.

Your issue is also very vague, up top you say "I want to use the main button to toggle a light on and off. But a short press only switches the light on." then you say it's back and toggling "on and off". I'm not exactly clear on your issue at hand and you will need to be more thorough.

Stephan-4711 commented 1 month ago

This happens while one short press

info 2024-09-25 06:21:14z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/bridge/response/options', payload '{"data":{"restart_required":false},"status":"ok","transaction":"tjjmr-4"}' info 2024-09-25 06:21:14z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Ikea Test Schalter', payload '{"action":"toggle","battery":null,"last_seen":"2024-09-25T06:21:14+02:00","linkquality":216,"update":{"installed_version":604241925,"latest_version":604241925,"state":"idle"},"update_available":null}' info 2024-09-25 06:21:14z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Ikea Test Schalter', payload '{"action":"","battery":null,"last_seen":"2024-09-25T06:21:14+02:00","linkquality":216,"update":{"installed_version":604241925,"latest_version":604241925,"state":"idle"},"update_available":null}' info 2024-09-25 06:21:14z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Ikea Test Schalter/action', payload 'toggle'

Sian-Lee-SA commented 1 month ago

I just looked at Z2M and it states _"When clicking the middle (center) button on the remote it will send a {"click": "toggle"}, when holding it it will also send a {"click": "togglehold"}. It is not possible to skip the toggle when the button is hold. Also the remote won't send anything when the button is released."... It's my understanding holding the button will always call both press and hold so press will always be fired regardless if it's short or long hold. Hold will also keep repeating the action as the blueprint don't have hold (released) which is only called once... This is all down the the device FW and nothing to do with Switch Manager and Zigbee2MQTT, it's just Ikea's quirky remote implementations that they're notorious for doing.

Stephan-4711 commented 1 month ago

I'm just doing a short press, as I understand you, this should work, but it's triggering two toggels

Sian-Lee-SA commented 1 month ago

So if that's coming in MQTT as two toggles (2 messages) then that's an issue with either your device or Z2M as switch manager only reads the published MQTT. If it's not coming in through MQTT as two messsages then the only other logical reason this is happening is you have an automation or something else hooked that you may have forgotten about. If the other button's are fine and you do the same action on them, then it's 100% not a Switch Manager issue.

As I also don't own the device nor has the author of the blueprint expressed any issues, it is not something we can test and replicate.

Sian-Lee-SA commented 1 month ago

@Mr-Groch may be able to assist as he is the author of this blueprint and happens to own this device

Sian-Lee-SA commented 1 month ago

You could also change the mode to single and have a delay on the bottom of the action sequence to prevent multiple catches of the middle button press till after the delay and sequence has finished. so a delay of 1 or 2 seconds might suffice, but if your issue is caused by an automation you've forgot about etc then this wont work.

Mr-Groch commented 1 month ago

Hi, I've checked with my remote - there is only one action: toggle after single middle button press.

This is from addon debug mode from dev console after single press:

image

My z2m config:

homeassistant:
  legacy_entity_attributes: false
  legacy_triggers: false
device_options:
  legacy: false
Stephan-4711 commented 1 month ago

I'll check the z2m settings

Stephan-4711 commented 1 month ago

legacy_triggers: false where missing, I added this and will try again

github-actions[bot] commented 4 days ago

This issue is stale because it has been open for 30 days with no activity.