Zigbee2mqtt State Sync (touchlink)

z2m state sync

This is a blueprint for a Home Assistant automation that triggers a sync of the state of a Zigbee device connected to Zigbee2MQTT. This is useful when you control a zigbee device directly via touchlink and want to keep the state in sync with Home Assistant.

Use case: Touchlink

You’re using Home Assistant with Zigbee2MQTT and you have a Zigbee device that you control directly via touchlink (e.g. a remote control). E.g. you have an TRETAKT smart plug and a TRADFRI on/off switch. You don’t need to create an automation to control the device via Home Assistant, because you can connect the smart plug and the switch via touchlink. This can be extremely useful for devices which supports dimming, because you can dim the device directly via the remote control. The only downside is that the state of the device in Home Assistant is not in sync with the real state of the device. This blueprint solves this problem by triggering a sync of the state of the device in Home Assistant.

Limitations

Zigbee2MQTT

This blueprint requires that you’re using Zigbee2MQTT. It’s not possible to use this blueprint with other Zigbee integrations like ZHA.

Trigger actions

The trigger actions are currently limited to the following:

  • on/off
  • brightness_move_up/brightness_move_down

Installation

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

Sourcecode

1 Like

Since I cannot edit the original post: I updated the blueprint and removed the limitations of the trigger actions. You can now choose any triggers.

Actually I’ve found a better solution to keep the state in z2m in sync: With Binding

I just needed to add a binding for OnOff and LevelCtrl to the coordinator and that’s it. No automation needed.