Home Assistant doesn't respond to first time messages from Zigbee2MQTT

I seem to have an issue where the first use of wireless remote switches doesn’t get sent to Home Assistant via zigbee2MQTT, or Home Assistant doesn’t receive the correct message. My devices are mainly IKEA modules of different types, and they all exhibit the same issue. I should point out that the Sonoff wireless remotes that I have do the same thing.

Running MQTT Explorer I can see the message being transmitted by Zigbee2MQTT but homeseer does not respond to it. If I press the button again, it runs the automation.

The activity log in Home Assistant shows this when I press the ON button for the first time after a period of time not using the switch. This only appears in the activity log when the automation doesn’t respond to the first press.
homeassistant-firstmessage

It is as if the switch is sleeping and only sends a wake message but Zigbee2MQTT sends out the correct message with the action topic with payload ON.

This is what I see with MQTT Explorer on the first press.

IKEASW4 = {"action":"on","battery":null,"identify":null,"linkquality":134,"update":{"installed_version":33816598,"latest_version":33816598,"state":"idle"}}
availability = {"state":"online"}
action = on

UPDATE BEFORE I POSTED THE ABOVE

I setup NodeRed to listen for the zigbee2mqtt message and this was received. NodeRed is running on the same PC as Home Assistant and Zigbee2MQTT

{"action":"on","battery":null,"identify":null,"linkquality":142,"update":{"installed_version":33816598,"latest_version":33816598,"state":"idle"}}

Payload received and shown by MQTT Explorer


{
  "action": "on",
  "battery": null,
  "identify": null,
  "linkquality": 142,
  "update": {
    "installed_version": 33816598,
    "latest_version": 33816598,
    "state": "idle"
  }
}

And again, nothing in the Home Assistant activity log or response to the press. Second press works. :frowning:

Are you using the legacy (old) or experimental (new) button actions in Z2M?

I am running 2.6.3 and legacy_action_sensor setting is false.

See: Using the new action events in Zigbee2MQTT 2.0

1 Like

Still not working. All wireless devices stop after some time to respond to a key press for the first press but subsequent presses are good.

I am totally confused as to why HA doesn’t respond to the button press as I can clearly see the Zigbee2MQTT message in the devices view but no automation fires until I click the button for the second time. After this, it works each time on the first press until some idle time had passed, which seems to be a few hours. All devices of a similar type cause this.

I should add that this never happened before I updated HA and Zibee2MQTT to a later version. Not sure which version was previous. :frowning:

This shows that the button action was received by HA but no automation was triggered at 10:05. There is an initial TURNED ON and then a blank message.

This is the second press, which triggers the automation.

The second press is the same as the first, a TURNED ON action and a blank action but this time the automation fired.

This is the overview showing there are 2 automations. All automations that are tied to buttons are doing the same, ignore the first press after a long idle.

The HA log shows no errors.

Is there any other HA logs I can check?