I’m trying to set a sensor to see if either my wife or I are at home. I want the sensor to be “true” if either one of us is home. I have had this working in the past, but I recently moved to using the person component so I could use multiple device trackers to track a single person. Previously, I was just using the Life360 tracker.
presence:
name: Where is everyone
entities:
- person.brad
- person.katie
When this worked in the past, my groups.yaml looked like this and I did not have the “person” entry in my config. Note that these device trackers are using Life360 to see where we are at.
Old Groups.yaml
presence:
name: Where is everyone
entities:
- device_tracker.brad_phillips
- device_tracker.katie_phillips
With my current config, using the person tracker, the entity “Is someone home” becomes “true” only when BOTH of us are at home. Previously, using the old config, the entity “is someone home” became “true” when either of us got home.
How can I get this to be “true” if just one of us is at home?
Thanks for the code! But there looks to be an error in the icon_template section. I’m getting this error:
Invalid config for [binary_sensor.template]: invalid template (TemplateSyntaxError: expected token 'end of statement block', got 'mdi') for dictionary value @ data['sensors']['someone_home']['icon_template']. Got "{% if is_state('binary_sensor.someone_home','on') mdi:home-account {% else %} mdi:home-outline". (See ?, line ?). Please check the docs at https://home-assistant.io/components/binary_sensor.template/
VdkaShaker just posted a comment here so this brought this thread back to my attention. You didn’t reply to myself or @walaj you just posted another reply in your own thread so neither one of us realized you had another question!
You’ve probably figure this out by now but yes and now. You can’t do it with a binary sensor which only has states of on/off but you can accoplish this with a template sensor utilizing the value_template parameter.
Hey, I’m fairly new and would like to set up this binary sensor, however when I post this into my config, I get the warning that “end of the stream or a document separator is expected (46:1)”. I think it may have something to do with the indentation but as this is only second time I am working in the config file, I do not really know how to solve this.
Maybe someone can help me. The part for which I get the error is this:
sensor:
- platform: integration
source: sensor.battery_power_charging
name: "Total Batterie geladen"
method: left
- platform: integration
source: sensor.battery_power_discharging
name: "Total Batterie entladen"
method: left
- platform: integration
source: sensor.power_photovoltaics
name: "Total Photovoltaik"
method: left
- platform: template
sensors:
someone_home:
friendly_name: Someone Home
icon_template: >-
{% if is_state('binary_sensor.someone_home','on') %}
mdi:home-account
{% else %}
mdi:home-outline
{% endif %}
value_template: "{{ is_state('person.one','home') or is_state('person.two','home') or is_state('person.three','home') }}"```
The persons obviously have not been changed yet.
Thanks very much!
So if I got this right, if I now want to add another binary sensor it must be under the binary_sensor “headline”, starting again with “- platform: template”, right?
Correct. Assuming you are doing another template binary sensor. Here is an example of my Binary Sensor section in my config.yaml with 3 different binary sensors.
binary_sensor:
#See if anyone is home - https://community.home-assistant.io/t/how-to-see-if-anyone-is-home/106340/4
- platform: template
sensors:
someone_home:
friendly_name: Is Someone Home
icon_template: >-
{% if is_state('binary_sensor.someone_home','on') %}
mdi:thumb-up
{% else %}
mdi:thumb-down
{% endif %}
value_template: "{{ is_state('person.brad_phillips','home') or is_state('person.katie_phillips','home') }}"
#See if any radiant floor pump is running
- platform: template
sensors:
radiant_heat_running:
friendly_name: Is Radiant Heat Running
value_template: "{{ is_state('binary_sensor.basement_garage_zone_pump','on') or is_state('binary_sensor.basement_zone_pump','on') or is_state('binary_sensor.garage_zone_pump','on') }}"
- platform: trend
sensors:
air_line_pressure_drop:
entity_id: sensor.air_line_pressure
sample_duration: 11
max_samples: 3
min_gradient: -0.5
friendly_name: Air Line Pressure Drop
I recently switched to using proximity;
It will not only return the distance from the person closest to home, but also the direction of movement (arrived,towards,away_from, stationary, unknown,not set)