I have a few template sensors that use information from multiple sources to displace information. This is an example of a template sensor that I use to display our door states
- platform: template
sensors:
all_doors:
value_template: >-
{% if (is_state('sensor.xiaomi_door_1_status','Closed')) and
(is_state('sensor.xiaomi_door_2_status','Closed')) and
(is_state('sensor.xiaomi_door_3_status','Closed')) and
(is_state('sensor.xiaomi_door_4_status','Closed')) and
(is_state('sensor.xiaomi_door_5_status','Closed')) and
(is_state('sensor.xiaomi_door_6_status','Closed')) and
(is_state('sensor.xiaomi_door_7_status','Closed')) and
(is_state('sensor.xiaomi_door_8_status','Closed')) and
(is_state('sensor.back_door_status','Closed')) and
(is_state('sensor.front_door_status','Closed')) and
(is_state('sensor.garage_door_status','Closed')) %}
House secure
{% endif %}
{% if (is_state('sensor.xiaomi_door_1_status','Open')) %}kitchen wooden door open{% endif %} {% if (is_state('sensor.xiaomi_door_2_status','Open')) %}glass sliding door open{% endif %} {% if (is_state('sensor.xiaomi_door_3_status','Open')) %}bedroom wooden door open{% endif %} {% if (is_state('sensor.xiaomi_door_4_status','Open')) %}storeroom door open{% endif %} {% if (is_state('sensor.xiaomi_door_5_status','Open')) %}glass sliding door 2 open{% endif %} {% if (is_state('sensor.xiaomi_door_6_status','Open')) %}ensuite door open{% endif %} {% if (is_state('sensor.xiaomi_door_7_status','Open')) %}bedroom screen door open{% endif %} {% if (is_state('sensor.xiaomi_door_8_status','Open')) %}kitchen screen door open{% endif %} {% if (is_state('sensor.back_door_status','Open')) %}back door open{% endif %} {% if (is_state('sensor.front_door_status','Open')) %}front door open{% endif %} {% if (is_state('sensor.garage_door_status','Open')) %}garage door open
{% endif %}
icon_template: mdi:door-closed
friendly_name: 'All doors'_
With the breaking change to template sensors do I now add all the entity ids so that it looks like this?
- platform: template
sensors:
all_doors:
entity_id: sensor.xiaomi_door_1_status
entity_id: sensor.xiaomi_door_2_status
and so on....
value_template: >-
{% if (is_state('sensor.xiaomi_door_1_status','Closed')) and
(is_state('sensor.xiaomi_door_2_status','Closed')) and
(is_state('sensor.xiaomi_door_7_status','Closed')) and
and so on...