I’ve read some about geofencing and other presence detection, but that is a bit more than I really need to do.
I searched around, and maybe my terms weren’t quite right to get the results I’m looking for, but is there a way to set up a ‘switch’ in HASS that I can manually toggle for home or away? Basically, I’d like to have some lights doing different things if I’m home vs if I’m away, but I don’t need it automatically knowing if I’m home or away such as is done with presence detection.
Thanks - I got the ‘switch’ to show up, now to figure out how to make it work the way I want - the example there used proximity to send a message. I’ll have to put this on the back burner until I have more time to dig in and try and figure it out.
I did something similar to this - I call it Vacation Mode. It is pretty crude, but I use this variable for several switches in my automation. So before I head out, I put Hass in vacation mode and let the lights cycle. It gets the job done.
Thanks Dap! That’s pretty much exactly what I’m looking to do… I’ll have to play with the random off function I was asking about in my other thread, but I think I should be able to adapt your config to work.
I also had it without the ‘-’ before platform and condition, with the same problem.
Technically, I could do this without scenes, but I can’t figure out what I’d need to use for these dimmers.
I have the following that has been working until I broke the automation because it couldn’t find my Office scenes until I changed them to be how they are above.
[/code]
alias: Turn on driveway lights when sun sets
trigger:
platform: sun
event: sunset
offset: “-00:20:00”
action:
service: switch.turn_on
entity_id: switch.leviton_unknown_type1c02_id0334_switch_4
[/code]
Because that’s a ‘switch’, not a ‘dimmer’, the service ‘switch.turn_on’ applies, but I can’t seem to find anything for the dimmer - what would I need to use for a Leviton dimmer? Or any ideas why the scene doesn’t seem to be activating? When I activate it manually, it does what is expected, but the automation doesn’t seem to be activating it.
Noob here trying to learn as I go along and looking at a lot of post in order to do so.
What I am not understanding from the code of @dap35 is what is displayed on the screenshot. I am not seeing anything in the code that would display “Vacation Mode” maybe I just don’t know enough about HA but this puzzles me.
Basically, what his code does is looks at the state of '‘input_boolean.vacation_mode’, and if that is ‘on’,then the automation will run. If that is ‘off’, then it won’t run.
note:
condition:
condition: state
entity_id: input_boolean.vacation_mode
state: ‘on’
I’m pretty sure that I understand that part, but still can’t see how this gives me the card shown in the screenshot with the icon and switch. Guess I will have to play around with it but not seeing how this all works right now
Sorry, I left a few things out… Hope this helps. I have my config split into multiple files, so my spacing may be off in a place or two in what I have pasted below.
# Turns on lights at sunset
- alias: 'Rule 3 Welcome Home light in kitchen'
trigger:
platform: state
entity_id: binary_sensor.stairwell_motion_sensor_4_0
from: 'off'
to: 'on'
condition:
- condition: state
entity_id: binary_sensor.basement_motion_sensor_5_0
state: 'on'
- condition: sun
after: sunset
action:
service: light.turn_on
entity_id: light.kitchen_dimmer_level_9_0
But you might try and change the service to homeassistant and see if your Leviton dimmer will respond to that. I am using this to turn on one or more Aeotec smart outlets.
#Turn on other switches when great room light is turned on.
- alias: 'Rule 12 Slave outlets to GreatRoom On'
trigger:
platform: state
entity_id: switch.great_room_lights_switch_6_0
from: 'off'
to: 'on'
action:
service: homeassistant.turn_on
entity_id: group.gr_light_slaves
Tried to follow along to this and maybe because it’s late, I’m not seeing something correctly. I’ve got my front end showing the Vacation mode switch and I can toggle it on or off. I’ve made an automation to test:
- id: '1544757125460'
alias: Vacation Test
trigger:
- entity_id: light.light_by_door
from: 'off'
platform: state
to: 'on'
condition:
- condition: state
entity_id: input_boolean.vacation_mode
state: 'on'
action:
- data:
entity_id: light.light_by_door
service: light.turn_on
In this test I’m trying to see if when the light is off and I have vacation mode turned on, that it turns on the light, however, when I run the automation it turns the light on regardless of what the state of the switch is. What could I be missing?
Is there any good way for HA to detect you’re on vacation? Let’s automate all the things…
I don’t want to rely on me remembering to set myself in vacation mode…I might forget.
I thought about using zones to say: if my wife and I are not in #ourcity, then we’re on vacation, but then I realised we might go to #nearbycity for a meal or a show, and that would trigger the automation.
A better way to do it might be to say: if user A and user B are both >50 miles away from home, we’re probably on vacation. But at this point I came unstuck, because I don’t know how to do this calculation.
A very simple solution a time-based: if all person entities are not_home for more than X hours (12, 24, whatever), assume vacation mode.
Use a bayesian sensor to amalgamate all of the conditions that would be likely when on vacation (i.e., people gone, lights turned off for a certain amount of time, motion not detected for a certain amount of time, etc.).
action:
- service: notify.telegram
data:
message: House is simulating presence due to a ring on the doorbell at night
- delay: '00:00:{{ range(10,40) | random | int }}'
- service: light.turn_on
entity_id: light.dave_s_room
- delay: '00:0{{ range(9) | random | int }}:{{ range(10,58) | random | int }}'
- service: light.turn_off
entity_id: light.dave_s_room