Please help with automations not firing

Hi All
I am pretty new to HA but have set up quite a few automations. It seems though that they are not reliably firing…

  • The first example is simple light control from a zigbee button. I press the button and the lights are supposed to come on. In the logs from zigbee2mqtt I can see that the button press is registered but the lights do not come on. There is nothing in the HA logs or logbook about the button press.
  • The second example is an automation that turns off my heating when the Tado aircon control turns on. This usually fires fine, however the reverse is supposed to happen when the aircon turns off. This sometimes doesn’t happen or sometimes takes a long time to happen. I can see in HA that the aircon is no longer on but it has not yet set the heating to auto.

Is this normal? How do I go about fixing or debugging these issues?

Many Thanks

Post the relevant automations (correctly formatted).

Automation one (I hope this is correctly formatted)

alias: Master Bedroom Dimmed
description: ''
trigger:
  - platform: device
    domain: mqtt
    device_id: b25cc3b4999f7a66aed3214d26f68ce5
    type: action
    subtype: hold
    discovery_id: 0x00158d0008147f5e action_hold
    id: leftDimmed
  - platform: device
    domain: mqtt
    device_id: 4f34b2cb15e322db3c9821beec99778c
    type: action
    subtype: hold
    discovery_id: 0x00158d0008092b6a action_hold
    id: rightDimmed
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id: leftDimmed
        sequence:
          - service: scene.turn_on
            target:
              entity_id: scene.left_dimmed
            metadata: {}
      - conditions:
          - condition: trigger
            id: rightDimmed
        sequence:
          - service: scene.turn_on
            target:
              entity_id: scene.right_dimmed
            metadata: {}
    default: []
mode: single

and second automation:

alias: Turn off study radiator when aircon starts
description: ''
trigger:
  - platform: device
    device_id: 087814d02feb1175a4fc915720dacebc
    domain: climate
    entity_id: climate.study_aircon
    type: hvac_mode_changed
    to: cool
    id: airConTurnedOn
  - platform: device
    device_id: 087814d02feb1175a4fc915720dacebc
    domain: climate
    entity_id: climate.study_aircon
    type: hvac_mode_changed
    to: 'off'
    id: airConTurnedOff
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id: airConTurnedOn
        sequence:
          - device_id: 97f4b3b7414330929595040626e998ce
            domain: climate
            entity_id: climate.study_radiator
            type: set_hvac_mode
            hvac_mode: 'off'
          - service: cast.show_lovelace_view
            data:
              entity_id: media_player.study_display
              dashboard_path: lovelace-study
              view_path: '0'
      - conditions:
          - condition: trigger
            id: airConTurnedOff
        sequence:
          - device_id: 97f4b3b7414330929595040626e998ce
            domain: climate
            entity_id: climate.study_radiator
            type: set_hvac_mode
            hvac_mode: auto
          - service: media_player.turn_off
            data: {}
            target:
              entity_id: media_player.study_display
    default: []
mode: single

In the automation screen there is a debugging tool which should help.

you mean that “show trace”? There are no entries in there for today which is when I last tried to run the automation

Then it wasn’t triggered.

yes… I know…
but why wasn’t it triggered when there was a mqtt message. That’s what I am trying to figure out.

Is this the documentation you have followed?

If so, you are missing (at least) the topic from your configuration. Did you check your HA logs for errors or did you run the config checker?

I don’t know what the config checker is.
I did check logs and the logbook for errors but didn’t see anything.
These are mqtt messages but as the messages originate from zigbee2mqtt this is not an mqtt automation. The button appears as a device and prompts me for the available actions.

Are you sure the zigbee network is stable. Can you see the button pressing Z2M

OK, I think that the issue here is that I am not using the basic MQTT action. I am using a device action that’s generated from zigbee2mqtt. I am not sure how this works but if I enable home assistant mode in zigbee2mqtt then the zigbee devices appear as devices in HA and I am able to select the device and then select “single” (or “double” or “hold” for a button for example) for the trigger.
The issue seems to be that HA forgets these allowable actions and when I go back into the automation it just says “Unknown trigger”:

Just using the MQTT topic and payload seems to have fixed it (but I’ve only given this very limited testing)

Then you have to fix that. Is z2m perhaps losing contact with the button? do you still see it in z2m’s web interface?

Yup, all buttons are available in the web interface but they all seem to have lost the configuration. I’ve just moved to MQTT triggers. Seem to be more reliable (well, we’ll see).