Hide sensor based on zone

Hi,

I am fairly new to HA.

I have two sensors wich I would like to hide based on my zone “home”.

  name: A
  api_key: **********
  origin: device_tracker.iphone-a
  destination: zone.home
- platform: google_travel_time
  name: B
  api_key: **********
  origin: device_tracker.iphone-b
  destination: zone.home```

So if the tracker finds these iphone's in the "home" zone, I would no longer want to display these.

I habe been unable to find the solution anywhere.

Thanks,

Michel

Nobody here that has this working or knows how?

It sounds like you can achieve this using automations based on the state of the device ‘home’ or if the device enters the zone and the group visibility service .

Thanks.

Would you know an example config for that?

You will have to create group(s) with the things you want to hide. Are you using groups yet?

- alias: Hide Group Example
  trigger:
    - platform: zone
      entity_id: device_tracker.mike
      zone: zone.mikes_house
      event: enter
  action:
    - service: group.set_availability
      entity_id: group_group_with_the_things_you_want_to_hide

This automation will hade a group when the device tracker enters the home zone…

https://home-assistant.io/docs/configuration/group_visibility/

Thanks, that should do it. I’ll try to get this to work.

@michel72
Let me know if you have more questions. I have been busy this weekend and it is tough to post configs, etc with mobile.

I’m afraid I can’t get it to work yet.

Maybe I should post some configs to clarify things:

I have a tracker for 2 iphone’s:

device_tracker.iphonevanmichel
and
device_tracker.iphonevanlinda

I have multiple zone’s, but the home zone is simply zone.home.

I have 2 sensors:

# Tracking Michel to zone.home
- platform: google_travel_time
  name: Michel naar huis
  api_key: ****************************************************
  origin: device_tracker.iphonevanmichel
  destination: zone.home
# Tracking Linda to zone.home
- platform: google_travel_time
  name: Linda naar huis
  api_key: ****************************************************
  origin: device_tracker.iphonevanlinda
  destination: zone.home

and a group called reistijd (traveltime) :slight_smile:

reistijd:
    name: Reistijd
    entities:
      - sensor.linda_naar_huis
      - sensor.michel_naar_huis

That looks like:

In the most ideal situation I would like to hide any of the 2 sensors in the group when they are in zone.home (or if the travel time = 0)

Since they obviously would not always be home at the same time, I eihter want to hide the respective sensor only. If that is not possible I will create 2 seperate groups.

For now I am not even able to hide the entire group if one of the 2 trackers is home. :wink: