Hey
Currently all my hue sensor / switch / scenes are setup in hue it’s self rather than HA but I’m thinking I want to move these over.
In our bathroom often have the issue when having a bath the motion sensor turns off the lights which is frustrating- but as it’s the bathroom the door is always closed when in use so am wondering if I could do something like:
Motion sensor detects motion = turn lights on
Door goes from closed to open = turn lights off (maybe after a 5 second delay?)
Think this would solve the bathroom issues I have without putting in something like an occupancy sensor or the like.
Anyone done anything like this - I assume should be fairy straight forward?
Thanks
Marc
EdwardTFN
(Edward Firmo)
October 16, 2022, 11:15pm
2
I have this from a long time ago, probably needing some review/improvement, but as it is working rock solid I don’t touched since a while…
alias: Bathroom - Lights - Motion based
description: ""
trigger:
- platform: state
entity_id:
- binary_sensor.bathroom_motion_dual_sensors_state
to: "on"
action:
- choose:
- conditions:
- condition: or
conditions:
- condition: not
conditions:
- condition: device
type: is_on
device_id: 3cdd74bfe34c054238c9d0f07cccffb5
entity_id: light.bathroom_ceiling_lights
domain: light
- condition: numeric_state
entity_id: light.bathroom_ceiling_lights
below: 14
sequence:
- service: light.turn_on
data:
transition: 1
brightness_pct: 15
target:
entity_id: light.bathroom_ceiling_lights
default: []
- choose:
- conditions:
- condition: not
conditions:
- condition: device
type: is_on
device_id: 3cdd74bfe34c054238c9d0f07cccffb5
entity_id: light.bathroom_ceiling_lights
domain: light
sequence:
- type: turn_on
device_id: f1e32768b729bd9e1f146c4511f96613
entity_id: light.bathroom_mirror_light
domain: light
- device_id: 3cdd74bfe34c054238c9d0f07cccffb5
domain: button
entity_id: button.bathroom_ceiling_lights_reboot
type: press
default: []
- service: switch.turn_on
data: {}
target:
device_id: ffa52bb00dbef0f6146c0fc0b93ef80f
- wait_for_trigger:
- platform: state
entity_id:
- binary_sensor.bathroom_motion_dual_sensors_state
to: "off"
continue_on_timeout: false
- delay:
hours: 0
minutes: 0
seconds: 15
milliseconds: 0
- choose:
- conditions:
- type: is_not_open
condition: device
device_id: a2e059c66daa6661b4793e090e03c994
entity_id: binary_sensor.bathroom_door
domain: binary_sensor
sequence:
- wait_for_trigger:
- type: opened
platform: device
device_id: a2e059c66daa6661b4793e090e03c994
entity_id: binary_sensor.bathroom_door
domain: binary_sensor
default: []
- choose:
- conditions:
- type: is_open
condition: device
device_id: a2e059c66daa6661b4793e090e03c994
entity_id: binary_sensor.bathroom_door
domain: binary_sensor
- condition: not
conditions:
- condition: device
type: is_off
device_id: 3cdd74bfe34c054238c9d0f07cccffb5
entity_id: light.bathroom_ceiling_lights
domain: light
sequence:
- choose:
- conditions:
- condition: not
conditions:
- condition: device
type: is_on
device_id: 3cdd74bfe34c054238c9d0f07cccffb5
entity_id: light.bathroom_ceiling_lights
domain: light
sequence:
- type: turn_on
device_id: f1e32768b729bd9e1f146c4511f96613
entity_id: light.bathroom_mirror_light
domain: light
default: []
- service: light.turn_on
target:
entity_id: light.bathroom_ceiling_lights
data:
transition: 5
brightness_pct: 5
- delay:
hours: 0
minutes: 0
seconds: 15
milliseconds: 0
default: []
- choose:
- conditions:
- type: is_open
condition: device
device_id: a2e059c66daa6661b4793e090e03c994
entity_id: binary_sensor.bathroom_door
domain: binary_sensor
- condition: or
conditions:
- condition: device
type: is_on
device_id: 3cdd74bfe34c054238c9d0f07cccffb5
entity_id: light.bathroom_ceiling_lights
domain: light
- condition: device
type: is_on
device_id: f1e32768b729bd9e1f146c4511f96613
entity_id: light.bathroom_mirror_light
domain: light
sequence:
- service: light.turn_off
target:
entity_id:
- light.bathroom_ceiling_lights
- light.bathroom_mirror_light
data:
transition: 5
default: []
mode: restart
Note that I have 2 lights, so I use one as a backup in case the other one fails for some reason (very rarely). The ceiling light have a dimmer (Shelly) changing the brightness when someone opens the door and turns off after a few seconds.
I made a blueprint but it also controls a fan. You could modify it easily. I like to use timers, so you would need to create a couple of them.
I created this from an automation I have been using for awhile. Its not made in the traditional way most lighting automations are done. I prefer to use timers as they seem to be much more reliable especially if you are tinkering with automations alot. This method has proven to be pretty reliable in turning off the lights and fan.
This blueprint requires 2 sensors. A motion and a door/contact sensor.
It also requires 2 timers. One for the light and one for the fan.
It operates under the assump…
4n551p0h
(Anssi)
October 17, 2022, 4:14am
4
This is how I solved it.
#in binary_sensors.yaml
- platform: template
sensors:
toilet_occupancy:
friendly_name: Toilet occuoancy
device_class: occupancy
delay_off:
minutes: 2
value_template: >-
{{is_state('binary_sensor.adult_toilet_motion_sensor_occupancy', 'on') or is_state('binary_sensor.adult_toilet_door_sensor_contact', 'off')}}
There is also simple automation, Turn on or off lights when that sensor is on or off.
The light won’t go out even if you don’t move for a while because the door is closed
Moe1
(m0e)
September 25, 2024, 1:21pm
5
Hello. Is there a blueprint for this that I can import?