Hello,
I’ve started using Home Assistant just recently, but I have to say it has been a joy all the possibilities it brings to monitoring and automation.
…Well, the same with spending more money on smart devices, because of that.
Anyway.
I’ve been checking posts everywhere, for weeks now, trying to find a solution to what would seem to me quite a simple situation; but alas. I’m not sure if it’s because of code changes, throughout the years, or just my own ineptitude. I could only find solutions (2017-2018-2019) pointing to “boolean”; but my failed attempts didn’t gave much results beyond error notifications and so on…
I put a motion sensor in front of the bedrooms, so it would trigger, On/Off(after some time), a smart plug-floor lamp at a corner of the living room, during the night.
It seemed quite a simple automation, but even before executing it I was wondering how it would differentiate the fact that no one was in the living room, during that time, and those moments where someone was there - and didn’t want the light to go Off.
At the time I thought, in my naivety masked as ingenuity, that I would only have to create a condition, connecting both automation (On/Off), so the “On” automation wouldn’t be triggered if the light (plug) was already On, and so it would also not trigger the “Off” automation after a while. But, well, you can imagine how that didn’t work out.
- id: '1610753048709'
alias: Motion ON
description: ''
trigger:
- type: motion
platform: device
device_id: ca6dc31cd6275a2caa117b92bc270d9a
entity_id: binary_sensor.motion_sensor
domain: binary_sensor
condition:
- condition: time
after: '21:00'
before: 08:00
- condition: device
type: is_off
device_id: 8ba5ced6df1f42572b012e360f44091e
entity_id: switch.lamp
domain: switch
action:
- type: turn_on
device_id: 8ba5ced6df1f42572b012e360f44091e
entity_id: switch.lamp
domain: switch
mode: single
- id: '1610753339131'
alias: Motion OFF
description: ''
trigger:
- type: no_motion
platform: device
device_id: ca6dc31cd6275a2caa117b92bc270d9a
entity_id: binary_sensor.motion_sensor
domain: binary_sensor
for:
hours: 0
minutes: 0
seconds: 0
condition:
- condition: time
after: 00:00
before: 08:00
action:
- type: turn_off
device_id: 8ba5ced6df1f42572b012e360f44091e
entity_id: switch.lamp
domain: switch
mode: single
Hope someone can give me some help, beyond telling me - like my wife - that I should start using other lights if someone is in the living room, at night, as a solution.