Skip to content

Commit

Permalink
Add blueprint that came with HA
Browse files Browse the repository at this point in the history
  • Loading branch information
tetsuo13 committed Nov 10, 2024
1 parent 43731fa commit 68ee4ef
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions blueprints/template/homeassistant/inverted_binary_sensor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
blueprint:
name: Invert a binary sensor
description: Creates a binary_sensor which holds the inverted value of a reference binary_sensor
domain: template
source_url: https://github.com/home-assistant/core/blob/dev/homeassistant/components/template/blueprints/inverted_binary_sensor.yaml
input:
reference_entity:
name: Binary sensor to be inverted
description: The binary_sensor which needs to have its value inverted
selector:
entity:
domain: binary_sensor
variables:
reference_entity: !input reference_entity
binary_sensor:
state: >
{% if states(reference_entity) == 'on' %}
off
{% elif states(reference_entity) == 'off' %}
on
{% else %}
{{ states(reference_entity) }}
{% endif %}
# delay_on: not_used in this example
# delay_off: not_used in this example
# auto_off: not_used in this example
availability: "{{ states(reference_entity) not in ('unknown', 'unavailable') }}"

0 comments on commit 68ee4ef

Please sign in to comment.