Keeping two Home Assitant entities in sync
In some scenarios, it's desirable to have keep two entities in sync. In my case, the most common scenario is when I have a smart bulb on a circuit controlled by a smart switch. The smart switch is set in 'smart bulb' mode, which means it sends events for on and off and maintains state, but does not actually cut the power to the light bulb. This is important because while it's useful to have a physical switch for a smart bulb, smart bulbs are designed to be always online. When a smart bulb is unplugged, it can have undesirable effects, such as impacting the Zigbee mesh if the bulb is Zigbee or forgetting it's prior brightness or color settings.
For this reason, I have automations that will turn on the bulb when the switch is turned on and turn off the bulb when the switch is turned off. Similarly, it ensures that if the smart bulb state changes either via a direct interaction, or due to an initial power on state, the switch will reflect the state of the bulb.
I found a simple useful blueprint that does this well, and helps avoid possible self-triggering and endless loops by implementing some throttles.
alias: Sync front porch light with physical switch
description: ""
use_blueprint:
path: alexdelprete/ha-blueprint-linked-entities.yaml
input:
linked_entity:
- light.front_porch
- switch.front_porch
You can import this blueprint in your HA instance with one easy click: