Home Assistant - Displaying entities on card based on state of other entities

Home Assistant - Displaying entities on card based on state of other entities

Good morning everyone,

In this article I introduced how to have entities displayed on a card according to their state.

Today I want to go a little bit deeper.

Use case

You want to display an entity (e.g. your geocoded position) only when you are not home.

Software configuration

  1. Home Assistant. I'm currently running version?2022.8.0
  2. Mobile App integration?configured in Home Assistant. This integration allows Home Assistant mobile apps (Android / IOS) to integrate with your Home Assistant environment.
  3. The?person?integration has to be configured as well. It allows connecting?a device_tracker entity defined by the?Mobile App integration, to one or more person entities.
  4. Your home location has to be defined just setting its coordinates (latitude/longitude) as well as the elevation in meters within the configuration.yaml file.
  5. The geocoded sensor must be enabled on your Home Assistant companion app.

Home Assistant code (yaml)

This is the piece of code you have to write down to configure your card where the entity has to be reported:

title: Position detail
state_color: true
type: entities
entities:
? - entity: person.A
? - type: conditional
? ? conditions:
? ? ? - entity: person.A
? ? ? ? state_not: home
? ? row:
? ? ? entity: sensor.[yoursmartphone]_geocoded_locations        

Some specifics about the code above

  1. The first entity: person.A is always displayed. It shows home or not_home based on the position of the entity person.A.
  2. The type: conditional tells Home Assistant to show up the entity: sensor.[yoursmartphone]_geocoded_location only if the entity: person.A is not home.

You can define as many type: conditional as you want, here more details about this very useful feature to help having your cards super clean and better organized.

I do hope you have enjoyed this article.

I'm available for any feedback so, feel free to contact me or share your thoughts in the comments section below!

Thank you for reading. ??

--------------------------------------------------------------------------------------------------------

Hereafter other articles about?Home Assistant:

Home Assistant - Tracking entities on cards according to their state

Home Assistant - Tracking the sunrise every day

Home Assistant - Turning OFF a power socket when the operative state of the household connected to goes OFF

Home Assistant - Set the smartphone's ring mode if you are somewhere

Home Assistant - Stop streaming on Google Home speakers when not home

Home Assistant - Create a button to do something

Home Assistant - Know the distance between two people

Home Assistant - Get notified when ISS is above your home

Home Assistant - Getting the position?of ISS

Home Assistant - Getting the distance between people and zones

Home Assistant - Automation: Stop chromcast streaming if TV has turned OFF

Home Assistant - Sensor: Getting the operational state of a household appliance

Home Assistant - Automation: Power up your TV / DVD based on Chromcast

要查看或添加评论,请登录

Emiliano Guerzoni的更多文章

社区洞察

其他会员也浏览了