Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Home Assistant MQTT triggers #3033

Closed
Koenkk opened this issue Feb 29, 2020 · 5 comments
Closed

Home Assistant MQTT triggers #3033

Koenkk opened this issue Feb 29, 2020 · 5 comments
Labels
stale Stale issues

Comments

@Koenkk
Copy link
Owner

Koenkk commented Feb 29, 2020

Home Assistant 0.106 adds support for MQTT device triggers (link).

This allows to trigger on a device action or click without using the state change workaround on sensor_action/sensor_click (link).

This has now been implemented in the latest Zigbee2mqtt dev branch.

To use it first trigger the event once on the device (e.g. press a button on your remote), Zigbee2mqtt will now discover the MQTT device trigger into Home Assistant.

After this you can e.g. use the Home Assistant automation editor to respond to this event.

image

Big thanks to @emontnemery for implementing this on the Home Assistant side.

@Kryzek
Copy link

Kryzek commented Feb 29, 2020

Interesting, would it ne possible to create button-hold-for-style triggers i.e. hold remote button for >5 seconds to turn off all lights or would this require per-device support for held buttons?

@FutureCow
Copy link

FutureCow commented Mar 1, 2020

Will it also be possible to remove the "hack" to send two messages when receiving a click when HA is set to true?

info 2020-03-01 10:56:05: MQTT publish: topic 'zigbee2mqtt/Schakel_Knop_Woonkamer', payload '{"battery":100,"voltage":3025,"linkquality":36,"last_seen":1583056565457,"click":"single","elapsed":16002}'
info 2020-03-01 10:56:05: MQTT publish: topic 'zigbee2mqtt/Schakel_Knop_Woonkamer', payload '{"battery":100,"voltage":3025,"linkquality":36,"last_seen":1583056565457,"click":""}'

@sjorge
Copy link
Contributor

sjorge commented Mar 1, 2020

+1 for eventually removing the hack... or making it an option

@Koenkk
Copy link
Owner Author

Koenkk commented Mar 1, 2020

@Kryzek no, it will provide the same functionality as the sensor_action/sensor_click does.

@FutureCow @sjorge good idea, you can now do this in the latest dev branch by setting in configuration.yaml

advanced:
  homeassistant_legacy_triggers: false # Default = true as we don't want a breaking change

This will:

  • Prevent the clear payload (e.g. click: 'single' -> click: '')
  • Prevent the sensor_action and sensor_click from being discovered

@stale
Copy link

stale bot commented Apr 30, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Stale issues
Projects
None yet
Development

No branches or pull requests

4 participants