It is often useful to set the state of one entity based on another. Maybe one light should be turned on when another light is on. Or a template helper computes the desired state of a switch.
Unlike the example in the blueprint tutorial, the Boolean Follower only requires its input to have a state which can be ‘on’ or ‘off’, and the entity which is supposed to match that state must have a ‘turn_on’ or ‘turn_off’ service.
If the input state is other than on or off, the automation will fail, which I think is the desired behavior.
blueprint:
name: Boolean Follower
description: An entity with turn_on and turn_off follows the state of another entity with on or off states.
domain: automation
input:
to_follow:
name: Entity to Follow State
description: The entity with the desired state.
selector:
entity:
target_entity:
name: followed
description: The entity that should bept in sync with the entity to Follow State
selector:
entity:
mode: restart
triggers:
- trigger: state
entity_id: !input to_follow
actions:
- action: homeassistant.turn_{{ states(trigger.entity_id) }}
metadata: {}
data: {}
target:
entity_id: !input target_entity
I’ve recently started getting errors with this Blueprint. Not sure what can be done about it but I thought I would share:
onn Google Media Player bool tracker uses an unknown actionError · Reported by Automation
The automation “onn Google Media Player bool tracker” (automation.onn_google_media_player_bool_tracker) has an unknown action: homeassistant.turn_unavailable.
This error prevents the automation from running correctly. Maybe this action is no longer available, or perhaps a typo caused it.
The turn_{{ states(trigger.entity_id) }} error occurs in Home Assistant Community because you are likely trying to use trigger.entity_id directly within a service call, but you should instead use trigger.to_state.state to get the new state of the entity. The error message turn_unavailable or turn_unknown indicates that the automation is trying to call an invalid service because the trigger.entity_id is being rendered as part of the service name, which is incorrect syntax.
Correct Syntax
To fix this, use trigger.to_state.state in your template to correctly identify the new state of the triggered entity.