Hi
Looking to switch on/off lights at random when I’m away, but not using yaml - how to I achieve this? All the articles I can find require some coding.
Hi
Looking to switch on/off lights at random when I’m away, but not using yaml - how to I achieve this? All the articles I can find require some coding.
Is this any good ?
Thanks for the reply, but if I understand correctly, this just repeats the lights from a previous week. Not what I’m after really.
I have an automation which turns lights off on a “random” timing starting at 10pm. There’s a condition in there to check the house is empty, but I guess what might be of interest is the delay which looks like this;
delay: '{{ (range(120, 600)|random|int) }}'
which will delay randomly between the first and second number (which is in seconds) - in the above example the delay could be anywhere between 2 and 10 minutes.
You may be able to use this idea to meet your need? Full automation below for info:
- id: '1596710261541'
alias: Evening - Away - Auto All Off
description: ''
trigger:
- at: '22:00'
platform: time
condition:
- condition: state
entity_id: input_boolean.occupied
state: 'off'
action:
- type: turn_off
device_id: 2e129ef32164754524c569ed36cd9d27
entity_id: switch.garden_lights
domain: switch
- delay: '{{ (range(120, 600)|random|int) }}'
- type: turn_off
device_id: f7956afaf7894ee68e8df772e43fa6a9
entity_id: light.loungedz
domain: light
- delay: '{{ (range(600, 900)|random|int) }}'
- type: turn_off
device_id: fd6a3a043eda167f170c42008d40b245
entity_id: light.kitchendz
domain: light
- type: turn_off
device_id: 1c3aacce79e6c25591ab11e87e1e7372
entity_id: switch.front_room_uplighter
domain: switch
- delay: '{{ (range(60, 120)|random|int) }}'
- type: turn_off
device_id: ce4c9894075393f7c9aabc0f054e555c
entity_id: light.halldz
domain: light
- type: turn_off
device_id: ba5c5d1b574064c1c69612a5eff22016
entity_id: light.porchdz
domain: light
- service: input_boolean.turn_on
entity_id: input_boolean.overnight
data: {}
- type: turn_off
device_id: 37492e2ae1bdbccac30849700a5f7c30
entity_id: light.utilitydz
domain: light
mode: single
Thanks for the reply. I already have an automation to arm my alarm and turn all lights off when I’m away, but I’d like for random lights to switch on and off when I’m away (to give the appearance that differing rooms are occupied) - I could do this with Smartthings, but doesn’t appear to be easily achievable with homeassistant?
Not to be argumentative but isn’t the point of presence simulation to be as normal & realistic with the automatic lighting as possible?
What could more natural than to just replay the way lights were turned on & off organically while you were actually home?
it seems that just randomly switching lights would look just like that (random unnatural light switching) from someone outside your house & observing.
That’s exactly what I’m after.
Oh, well OK then…
Sorry I misunderstood.
Most people want the lights to simulate someone is home.
Kind of like this:
Allow me to make a couple of points. First of all, YAML isn’t all that complex. It’s more like a configuration file, or if you recall early versions of Windows, an “ini” file. Plain ole’ text. You can embed logic in it, but that’s pretty easy to just copy-and-paste from some example somewhere.
Second, just the normal routine of turning lights on and off would be a regular pattern in many homes. I don’t see people breaking in just because the lights came on at the same time today as yesterday. And if you have teams of burglars lurking around for days on end with stopwatches, you have bigger problems.
For my “away” automations I just picked some rooms we use often, and set their lights to come on at a set number of minutes before or after sunset, then go off at a seemingly normal time later, but not on an even hour or half-hour. That seems like it would be random enough for the casual observer.
If you’re looking unnatural lights they don’t get any better than these.
Can’t be done then?
I don’t think anybody said that.
unfortunately you are going to have to dig into the automation UI editor and figure out how you want it to work using your own parameters.
@woodmj74 gave you an outline to follow in his post above but since you won’t use yaml you will need to figure out how to convert that yaml code to the UI editor mouse click equivalents.
I doubt anyone is interested in going step thru step with mouse clicks to help youi make this in the UI editor.
the editor is fine for the more basic stuff but it gets unwieldy for more complex automations. And you will see that most advanced users very rarely use the UI editor due to it’s limitations.
if you refuse to use yaml then you are arbitrarily limiting yourself on the more advanced automations you will be able to reasonably expect to acheive.
Shame - it was so useful and easily done with Smartthings