(I’m 5 hour+ looking for a solution, look at a lot of webpage, including the HA input boolean page, But, their examples aren’t fully explain the content. Why their isn’t a simple solution like “if entity is on then, else”)
Hi,
I want to create a simple on/off button (and/or if possible simply passing a tag) as a detection presence switch.
My script IN + OUT work but I would like to get only a simple switch on two state.
The same could apply for my heating (off = night, on = day).
Just create an input Boolean for each person, and then use whatever detection rules you want to set that input Boolean as on.
I do this because I use homekit for presence detection (that her than exposing ha to the internet and using that all or waiting for a device to hit the WiFi)
But as well as the homekit detection, the mobile app and WiFi detection can also be used. So there can be up to 3 factors to set the presence for a person.
This isn’t really an answer…
I have a Toggle switch made by the helper but it doing nothing.
I need the structure of the code and some explanation.
I just want something like :
Switch ON :
light on, Climate on, notification Off
Switch state is off :
Light off, climate off, notification On
I can’t find a solution without a trigger, I can’t find the way to just say “state off - entity presence”
Why there isn’t a “Choose” directly
or a if boolen switch state is Off
8h+ now
And I realise how many simple on/off I wan’t, and the only way I can find is using two script which take place.
I am doing something similar to determine if my Jeep is in the garage. There is an ESP8266-01 in the jeep that wakes every two minutes, and if it’s in the garage, it will connect to the WiFi. I detect that state in an automation and set a helper entity to true.
I use the toggle type which is input_boolean.entity_name
You can use an entity card on the front-end or a service call to set the value: Input boolean: Turn off (or on).
That’s because there isn’t one. An automation or script needs something to start it. That would be a trigger.
The easiest that I can see from your description is to use the state of the switch as the trigger.
You just need two automations for the start of your journey.
On: Your input boolean is the trigger for your “I’m home” automation and actions are light, heating and whatever. Of course you need a separate automations or scene that triggers the input boolean.
Off: The off-state triggers all things to reverse and lights and stuff go off.
After that you can combine both automations with a template.
If you insist in using a manuel trigger (NFC or similar) you’re done. But why not use a device tracker (person) as the trigger?
Example for “on”:
alias: MembershipExcel is home
description: turns on light if MembershipExcel's input boolean is set to 'on'
mode: single
trigger:
- platform: state
entity_id: input_boolean.membershipexcel
from: 'off'
to: 'on'
condition: []
action:
- service: light.toggle
data: {}
target:
entity_id: light.somewhereinthe house