Idea for turning off lights

So many lights in my home get left on. I’m trying to think of a good, minimally annoying, automation to turn them off again. Basically my best idea is a combination of two timers, first and simplest, an “if light is on more than x time, turn it off”, second a timer that disables the first timer if the time off between cycles was less than y amount of time (where y is maybe 2 minutes), the idea being if the switch was manually turned on right after the automation turned off, it wouldn’t automatically turn off again, until turned off manually.
Also, if you know you want to disable the automation for a given light you can turn it off and right back on again.
Has anyone tried something like this? How did it work?

I would buy some Aqara P1 Motion sensors and get some automations set up on them. They are amazing. You can set the lights to turn off if motion hasnt been detected for X amount of time.

With just timers your always going to be annoyed by the off chance they turn off exaccly when you would them to not turn off.

1 Like

This is what I have done for my upstairs hallway light. I have a contact sensor on the bedroom door, and I have motion sensors at the top and bottom of the stairs. When motion is detected, it checks to see if the other one is detected, that way it knows if I’m going up or down the stairs.

I’m going to add a luminosity sensor in the future so I can go by the actual light level instead of the sun position, and I’d like to come up with a way to determine if the light switch was pressed after motion was detected to cancel the shutoff timer (I’ll probably add a trigger when the brightness changes, but that won’t work if the level is already at the same value). But for now, it works well for me.

alias: Upstairs Hallway Light
description: ""
trigger:
  - platform: state
    entity_id:
      - light.upstairs_hallway_main_lights
    id: Lights ON
    to: "on"
  - platform: state
    entity_id:
      - light.upstairs_hallway_main_lights
    to: "off"
    id: Lights OFF
  - platform: state
    entity_id:
      - binary_sensor.top_stairs_motion_sensor_iaszone
    to: "on"
    id: Top stairs motion
  - platform: state
    entity_id:
      - binary_sensor.bottom_stairs_motion_sensor_iaszone
    to: "on"
    id: Bottom stairs motion
  - platform: state
    entity_id:
      - binary_sensor.master_bedroom_door_sensor_contact
    to: "on"
    id: Door Open
  - platform: state
    entity_id:
      - binary_sensor.master_bedroom_door_sensor_contact
    to: "off"
    id: Door Closed
  - platform: state
    entity_id:
      - timer.upstairs_hallway_light_timer
    from: active
    id: Timer
condition:
  - condition: state
    entity_id: input_boolean.master_disable_upstairs_hallway_lighting_automation
    state: "off"
action:
  - choose:
      - conditions:
          - condition: trigger
            id: Door Open
          - condition: state
            entity_id: light.upstairs_hallway_main_lights
            state: "off"
          - condition: numeric_state
            entity_id: sun.sun
            attribute: elevation
            below: 0
        sequence:
          - service: input_text.set_value
            data:
              value: Bedroom Door
            target:
              entity_id: input_text.upstairs_hallway_light_trigger
          - service: light.turn_on
            data:
              brightness_pct: 12
            target:
              entity_id: light.upstairs_hallway_main_lights
          - service: timer.start
            data:
              duration: "600"
            target:
              entity_id: timer.upstairs_hallway_light_timer
      - conditions:
          - condition: trigger
            id: Door Closed
          - condition: state
            entity_id: light.upstairs_hallway_main_lights
            state: "on"
        sequence:
          - service: light.turn_off
            data:
              transition: 30
            target:
              entity_id: light.upstairs_hallway_main_lights
          - service: timer.cancel
            data: {}
      - conditions:
          - condition: trigger
            id: Timer
            enabled: true
        sequence:
          - service: light.turn_off
            data:
              transition: 30
            target:
              entity_id: light.upstairs_hallway_main_lights
      - conditions:
          - condition: trigger
            id: Lights OFF
        sequence:
          - service: input_text.set_value
            data:
              value: "Off"
            target:
              entity_id: input_text.upstairs_hallway_light_trigger
          - service: timer.cancel
            data: {}
            target:
              entity_id: timer.upstairs_hallway_light_timer
      - conditions:
          - condition: trigger
            id: Bottom stairs motion
          - condition: not
            conditions:
              - condition: state
                entity_id: binary_sensor.top_stairs_motion_sensor_iaszone
                state: "on"
        sequence:
          - if:
              - condition: state
                entity_id: light.upstairs_hallway_main_lights
                state: "off"
              - condition: numeric_state
                entity_id: sun.sun
                attribute: elevation
                below: 0
            then:
              - service: input_text.set_value
                data:
                  value: Bottom motion
                target:
                  entity_id: input_text.upstairs_hallway_light_trigger
              - service: light.turn_on
                data:
                  brightness_pct: 20
                target:
                  entity_id: light.upstairs_hallway_main_lights
              - service: timer.start
                data:
                  duration: "600"
                target:
                  entity_id: timer.upstairs_hallway_light_timer
      - conditions:
          - condition: trigger
            id: Lights ON
        sequence:
          - if:
              - condition: state
                entity_id: input_text.upstairs_hallway_light_trigger
                state: "Off"
            then:
              - service: input_text.set_value
                data:
                  value: Switch
                target:
                  entity_id: input_text.upstairs_hallway_light_trigger
              - service: timer.cancel
                data: {}
                target:
                  entity_id: timer.upstairs_hallway_light_timer
      - conditions:
          - condition: trigger
            id: Top stairs motion
          - condition: not
            conditions:
              - condition: state
                entity_id: binary_sensor.bottom_stairs_motion_sensor_iaszone
                state: "on"
        sequence:
          - service: light.turn_off
            data:
              transition: 30
            target:
              entity_id: light.upstairs_hallway_main_lights
mode: queued
max: 10

Problem here is I don’t live alone….

Problem with motion sensors is getting a good, accurate enough distribution. In the past (admittedly 30ish years ago), I always used to have issues with if for example I was reading a book in bed, or wasn’t quite at a good angle to the sensor. Right now, the area I’d need to cover would be so big, I have a hard time believing the sensors could be useful without stupid amounts of extra coding, even if detection in their range was perfect.
I’m also reluctant to add more battery powered devices if I can avoid.

You can try to guess if there’s presence in a room with multimedia players states, computers states, with what ppl are interacting ?

You can stop your timer each time someone interact with something like opening fridge door, pausing video, changing channel on TV, turning on or off the lights or the heaters…

The best solution personally is to have a button and the door and at the bed side to turn everything off.

Sensor will be used for the toilets and the bathroom when there’s must be continues mouvement if light is required

I would buy some Aqua FP1’s, I just ordered 2 to test and the reviews are raving…

I just ran some back of the napkin calculation based on a 5m range and 120 degree sweep. I’d need about 40 assuming perfect placement to cover my house (I could use some more strategic placement of course)

You can already check which light mostly stay on for no reason and automate these first.

Anyway the need to tell " I’m still here please don’t turn lights off" will bother anyone.

Motions sensors and timers can be used in room where you don’t stay still, and presence sensor maybe used for places like the living room.

You should adapt your automation to each room needs

Thought this was relevant to the FP1 / motion sensor / presence detection discussion:

You would have got a similar device for about $5, the LD2410B

You should be careful when creating those procedures that only you will know. That could be quite frustrating when other people (from your family or guests) try to use it.
I believe a good smart home should be natural to everyone interacting with, so if it would be only you using this, you are probably good on doing something “coded” like this, but if you share your home with others, talk to them and get everyone onboard with your idea before you invest time on this. Maybe they will come with other ideas you could use. :wink:

This was actually part of the reason I chose the “turning it right back on disables the auto off”. That way someone who doesn’t know the secret sauce will inadvertently disable the automation when they get frustrated and turn the light back on.

1 Like

My lights are dimmed based on the time of day, if someone press the light button long enough the automations is disabled 15 minutes then turned back on.

If I tell Google Home " I am cooking" the automation is paused 2 hours.

It’s still intuitive enough for anyone, they wouldn’t even notice that’s the automation was disabled.

But in your case it’s all or nothing behaviour, if your guest have to turn light back on after it was powered off automatically he might be freaked out and not even knowing where is the light switch

1 Like

Similar in concept, not performance. It is $5 for a reason :wink:

I don’t know.
I have ordered 10 of the LD2410B.
The reviews of the FP1 I have seen hasn’t been great.
Not great enough in my mind to justify the price at least.

Agreed. I think the LD is the same way. Its hype isn’t justified by performance. Just the price :wink: