I am trying to turn on input_boolean when I get home:
config.yaml
input_boolean:
derek:
name: Derek
initial: off
icon: mdi:car
Automation.yaml
alias: Derek Home
trigger:
- entity_id: device_tracker.derek
platform: state
to: home
condition:
- condition: state
entity_id: input_boolean.derek
state: 'on'
action: []
What am I missing. I am trying to toggle on an input_boolean in my group menus:
There is no action in that automation. I also believe that block under trigger and condition has to be indented. I should look like this:
alias: Derek Home
trigger:
- entity_id: device_tracker.derek
platform: state
to: home
condition:
- condition: state
entity_id: input_boolean.derek
state: 'off'
action:
service: homeassistant.toggle
entity_id: input_boolean.derek
If i read the above correct, seems like he mistook the condition for the action.
So if he wants to turn on the device, the condition should either be off, or not active at all. Like this:
alias: Derek Home
trigger:
- entity_id: device_tracker.derek
platform: state
to: home
action:
service: input_boolean.turn_on
entity_id: input_boolean.derek
So I have made changes and checked config “No Errors” restarted Hassio and no changes. My device_trackers are registering properly and show “Home” and “Away” but the boolean-inputs are not turning “on” or “off”. Here is my code:
- id: '1550593708373'
alias: Derek Home
trigger:
- entity_id: device_tracker.derek
platform: state
to: home
action:
service: input_boolean.turn_on
entity_id: input_boolean.derek
I added the state from not_home to home and when I got home the input_boolean turned on. Now how do I get it to turn off when I leave? Do need to create another automation that goes for home to not_home and then toggle_off?
- id: '1550593708373'
alias: Derek Home
trigger:
- entity_id: device_tracker.derek
from: not_home
platform: state
to: home
action:
- entity_id: input_boolean.derek
service: input_boolean.turn_on
Are you referring to how it shows up on Lovelace frontend? If so I’m my case using an entities card with the group as entity will not make it show up with a toggle option.
If you refer to your that you do not want the input Boolean Derek to be a toggle button you might want to make it a binary sensor instead.
After diving a little deeper into this the only way I can trigger the input_boolean is to manually change the state from “not_home” to “home” or “home” to " not_home". The automation does not work. So I am guessing it has to do with my syntax “home” “not_home”. I am using Life360 as my device_tracker.
I defined 2 groups as I wanted to separate the groups between when everyone was home or everyone away.
Group home will have status Home when everyone is home (due to the statement all:true), but away when one person left. Group away will be away when everyone is away.
I wanted to have the logic like that so I can use automations when either everyone is home or everyone away.
Lastly I added this into the lovelace UI through an entity card.
entities:
- entity: group.people_away
- entity: group.people_home
show_header_toggle: false
title: Who is where?
type: entities
I added your code and was able to add group entities back to my lovelace but I have not seen where anything changes when anybody comes home or leaves. I have attached my lovelace code.
Lovelace
- cards:
entities:
- entity: group.people_away
- entity: group.people_home
badges: []
show_header_toggle: false
title: Who is where?
type: entities
The only difference I see is the badges statement in cards, which I am not sure if it impacts, but I doubt so.
I also see you use the lovelace.yaml, whilst I use the frontend to configure.
In my case the entity group.people_home will show status home if anyone of the 3 is home. The status of group.people_away changes to status away only if all 3 are away.
Does your group not toggle based on the tracked devices being away? have you validated with the device tracker status itself to make sure it matches?