🪄 Manual Light Control With Auto OFF

I have a motion sensor set. Today, the motion sensor was accidentally unplugged and the lights turned off after the time delay. Is there a way to have the automation stop working if the motion sensor is not active? Essentially, a way to have it work as a bypass?

@Dr.proctor

You could probably make a sensor that when your motion sensor is unavailable it turns ON. Then use it in the bypass option 3.

Blacky :grinning:

1 Like

Did just that, thanks!

1 Like

Hello, great automation.
However, I have a problem with the Grace Period.
If I have Trigger - Lights 1 light entity for 30 seconds + Motion Sensor + Grace Period for 10 seconds, the Grace Period works.
If I have Trigger - Lights 3 light entities for 30 seconds + Motion Sensor + Grace Period for 10 seconds, the Grace Period doesn’t work.

Trace timeline:
"
Triggered by the state of binary_sensor.pokoj_slawek_motion_occupancy at December 7, 2025 at 10:52:19 PM
Test If any of 13 conditions matches
Test If any of 9 conditions matches
Choose: No action executed
Choose: No action executed
Choose: Motion detected
Stopped because an error was encountered at December 7, 2025 at 10:52:19 PM (runtime: 0.01 seconds)
Error rendering service target template: TypeError: unhashable type: ‘list’
"

@gordziej

You need to add the following inputs that are missing in Grace Period.

  1. Grace Period Timer Helper
  2. Text Helper to Save ON Lights

You can only use the 2 helpers in these inputs and can’t be used anywhere else.

TIP: If you click on the input and scroll down to the bottom you will see a ADD option.

Blacky :grinning:

Awesome! Thanks.

1 Like

Hello.
Version: 1.3 Home Assistant OS 2025.12.5
I noticed that when I set “Use The Synchronized Option (Optional)” to “Enable the synchronize option,” the following errors start appearing in the log:
The service homeassistant.turn_on cannot be called without a target
I tried with both.
I tried testing it on the old Version: 1.0.
Everything is fine here, no errors.

@alexamig

Could you please provide us your YAML of the automation? This YAML code are the settings you have selected in the automation so I can help. To do this go into your automation, top right 3 dots, Edit in YAML, copy all the code, come back to the forum and in your reply at the top tool bar click on “</>” and paste code in there.

Blacky :grinning:

Yes, of course, the code is simple. One lamp, switch via a relay to the light, motion sensor.

  timer:
    svet_tualet:
      name: time_ven
      duration: '00:05:00'

      alias: Manual Tualet Light
      description: ''
      use_blueprint:
        path: Blackshome/manual-light.yaml
        input:
          trigger_input:
          - light.marpou_rgbcw_30_light
          - switch.ventilation
          time_delay:
            hours: 0
            minutes: 0
            seconds: 10
          include_timer_helper: enable_timer_helper
          timer_helper: timer.svet_tualet
          include_motion_trigger: enable_motion_trigger
          motion_trigger: binary_sensor.marpou_rgbcw_30_presence
          include_trigger_sync: enable_trigger_sync
          include_grace_period: enable_grace_period

@alexamig

Thanks for your YAML. The reason you will be getting these errors and not in a Version 1.0 is because your using a new feature called Grace Period. If you would like to use this feature your will need 2 new helpers (Time & Text). You then need to add the helpers into Grace Period Timer Helper & Text Helper to Save ON Lights.

Note: The time helper must be a new helper and not the one you used in Time Helper option timer.svet_tualet.

Blacky :grinning:

Thanks for your reply.
I needed a simple action in the code: turning on the light based on a presence sensor, with the option to use the light and switch together, and then turning the light off with a timer delay when leaving the room, with the option to restore it and reset the timer when returning. I couldn’t find a way to implement motion-activated activation in the code here, it didn’t work.
I didn’t want to bother with the code, but I had to write my own Blueprint code with my own coding requirements and other additions and protections, but thanks for the help anyway! :handshake: