EPMatt / awesome-ha-blueprints

A curated collection of automation blueprints for Home Assistant.
https://epmatt.github.io/awesome-ha-blueprints
GNU General Public License v3.0
823 stars 246 forks source link

Bug - Zigbee2MQTT works only in legacy trigger mode #244

Open tomasbedrich opened 2 years ago

tomasbedrich commented 2 years ago

Blueprint name

/all blueprints/

Home Assistant Core Version

2021.12.10

Home Assistant Installation Type

Home Assistant Operating System

Description

When you set homeassistant_legacy_triggers: false (docs), there is no xxx_action sensor created, therefore there is no entity which can be used as "(Zigbee2MQTT) Controller Entity".

As name suggests, relying on such entity is considered legacy, therefore can be removed in future?

Automation YAML config

# irrelevant, but for example:

alias: Bedroom controller
description: ''
use_blueprint:
  path: EPMatt/ikea_e1743.yaml
  input:
    integration: Zigbee2MQTT
    helper_last_controller_event: input_text.bedroom_controller_last_event
    button_up_double_press: false
    action_button_up_double: []
    helper_double_press_delay: 200
    button_down_double_press: false
    controller_entity: sensor.bedroom_controller_action # <<<<<< this field is the issue

To Reproduce

  1. Install Zigbee2MQTT addon.
  2. Set:
    advanced:
    homeassistant_legacy_triggers: true
  3. Restart Zigbee2MQTT addon.
  4. Attempt to create a new Blueprint.

Expected behavior

A device can be selected (similarly to ZHA/Deconz) as a Controller Device. This would be consistent with native Home Assistant Automations, where a device must be selected for triggers to show.

Actual Behaviour

No device / nor entity is available to proceed with Blueprint creation.

Additional Details

Screenshots

No response

Additional context

No response

EPMatt commented 2 years ago

Hi @tomasbedrich,

thank you for opening an issue here! There's an open question in the project's Discussions section related to what you're reporting here. The main issue is that responding to button clicks via MQTT device triggers requires not only to know the device id, but also the device's discovery id and other information, as reported in the Z2M docs.

At the time the OP opened the discussion, there wasn't an easy way to retrieve such information from the HA registry, so the issue stalled as we didn't find any solution which would not impact blueprint usability.

However that was a few months ago, so things might have changed in the meanwhile. The best scenario would be to be able to use a device selector directly from the blueprint UI, but that was not possible back when the original discussion was opened.

Are you aware of any ways which can be used to retrieve discovery IDs and other required information, without having to actually type in the full IDs from the UI?

Thanks again!

tomasbedrich commented 2 years ago

Thanks for explanation!

Are you aware of any ways which can be used to retrieve discovery IDs ...

I'm sorry, but I haven't studied Z2M nor HA device registry internals – therefore I'm not.

Maybe just leave this issue here, so that others know that it is acknowledged thing for which we just don't have a solution yet? That would be okay for me. Sorry, I am not very used to look at Discussion section on GitHub.

microraptor commented 2 years ago

Sensor based Z2M legacy triggers don't always work for me when pressing buttons on a controller. On two completely different setups only about 75% of all button presses respond. It seems to me having MQTT subscriptions as a trigger instead of the legacy triggers for Z2M users would be pretty important. I posted an example how they work in the discussion: https://github.com/EPMatt/awesome-ha-blueprints/discussions/177#discussioncomment-2788032

YAMLcase commented 2 years ago

@tomasbedrich thanks for opening this issue, I spent hours this week trying to get legacy_triggers: false working, but to no avail which brought me to google, which brought me here. Now I know.