Questions regarding device tracking/home-occupancy

I have the following Automation and Boolean

- alias: David Occupancy (On)
  hide_entity: true
  trigger:
    - platform: numeric_state
      entity_id: sensor.david_occupancy_confidence
      above: '0.0'      
  condition:
    condition: and
    conditions:
      - condition: state
        entity_id: 'input_boolean.david_occupancy'
        state: 'off'
  action:
    - service: homeassistant.turn_on
      data:
        entity_id: input_boolean.david_occupancy

- alias: David's Occupancy (Off)
  hide_entity: true
  trigger:
    - platform: state
      entity_id: sensor.david_occupancy_confidence
      to: '0.0'
  condition:
    condition: and
    conditions:
      - condition: state
        entity_id: 'input_boolean.david_occupancy'
        state: 'on'
  action:
    - service: homeassistant.turn_off
      data:
        entity_id: input_boolean.david_occupancy

input Booleans:

input_boolean:
  david_occupancy:
    name: David Occupancy
    initial: off

how do I get it to where it shows on my front page lovelace, if sensor.david_occupancy_confidence is > 10, I am home

Why is the friendly_name for David’s occupancy boolean “Andrew occupancy”?

Why do you have AND conditions but only one condition within?

Why is one automation switching one person on, and the other one switching a different person off?

I think you’re in a bit of a mess there and need to explain exactly what you are trying to achieve so we can get you back on track.

I didn’t mean to post so soon, so I had to make some edits, basically, sensor.david_occupancy_confidence will change based on if im home or not, I am using raspberry pi w’s for presence detection

how do I get the input_booleaen to change to on if I am home and the occupancy_confidence score is > 0?

OK - does it actually matter if David is in, for it to change Andrew’s occupancy and vice versa?

its just one person

That must be a bizarre conversation over breakfast.

Ok…

This will set the boolean off if the score is zero, and on if it is 0.1 or above

alias: Set presence boolean 
trigger:
  platform: state
  entity_id: sensor.david_occupancy_confidence
action:
  service_template: >
    {% if states('sensor.david_occupancy_confidence')|float < 0.1 %} homeassistant.turn_off
    {% else %} homeassistant.turn_on {% endif %}
  entity_id: input_boolean.david_occupancy
1 Like

(please note I used is_state instead of states which was wrong, I’ve edited the post)

where were you able to find this in documentation?

Combination of these 5 pages…

So much to learn! Lol I will have to try this out Saturday, off to vegas tonight!

1 Like

I put this in my input_booleans.yaml file, how do i get this to show as a toggle switch, on if im home, off im not?

Just put the input_boolean on the interface. Are you using lovelace or the old UI?

eventually lovelace, for now old ui, what do you mean interface? i have an input_boolean.conf file that is referenced where i put it and it doesn’t show up

On the old interface put it in a group.

group:
  presence:
    name: Presence 
    control: hidden 
    entities:
      - input_boolean.david_occupancy

and the new?

Add it to a card:

cards:
  - type: entities
    title: Presence
    show_header_toggle: false 
    entities:
      - entity: input_boolean.david_occupancy 
        name: David Home

i got it to show up, but it doesn’t seem to switch to on or off

this is what i have for the autoamtions.yaml

alias: Set presence boolean 
trigger:
  platform: state
  entity_id: sensor.home_occupancy_confidence
action:
  service_template: >
    {% if states('sensor.home_occupancy_confidence')|float < 0.1 %} homeassistant.turn_off
    {% else %} homeassistant.turn_on {% endif %}
  entity_id: input_boolean.david_occupancy

Is that automation switched on? Does the sensor definitely hit zero?