home-assistant-configuration/sensors/house.yaml

25 lines
752 B
YAML

- platform: mqtt
name: "Family Status"
state_topic: "house/family/status"
payload_on: "home"
payload_off: "away"
retain: true
- platform: template
sensors:
house_status:
friendly_name: Status
unit_of_measurement: ''
value_template: >-
{%- if is_state("sensor.family_status", "home") %}
Home ({{ states.sensor.security_status.state }})
{% else %}
Away ({{ states.sensor.security_status.state }})
{%- endif %}
icon_template: >-
{%- if is_state("sensor.family_status", "home") %}
mdi:home
{%- elif is_state("sensor.family_status", "away") %}
mdi:home-outline
{% else %}
mdi:home-outline
{%- endif %}