Simple Light automation to turn light ON and OFF according to motion in a room

As I said just starting out so very confusing

I will have look when I get a chance.

Thanks for taking the time to point me in the right direction

Would this be any better

action:
  - choose:
    - condition:
        condition: and
        conditions:
          - "{{ trigger.to_state.state == 'on' }}"
          - condition: state
            entity_id: target_light
            equals: 'off'
  1. I don’t know where you got equals from but it’s not a valid option for a State Condition

  2. choose can’t accept a direct condition statement like that. It uses a conditions statement which contains conditions.

  3. You can’t reference target_light like that. Look at how it’s used in the original blueprint and/or refer to the documentation for Blueprint Inputs.

You should validate whatever you create using Configuration > Settings > Server Controls > Check Configuration. It will inform you if you have introduced anything invalid into your configuration.

Try this version:

action:
  - choose:
    - conditions:
        - "{{ trigger.to_state.state == 'on' }}"
        - condition: state
          entity_id: !input target_light
          state: 'off'
      sequence:
        - service: light.turn_on
          data:
            brightness_pct: 100
          target: !input target_light
    default:
      - service: light.turn_off
        data: {}
        target: !input target_light

Once again I thank you for your time.

This really needs to have a condition option to allow you to execute it only within a certain time frame. Sunset to sunrise for example.

1 Like

@123 Is your blueprint for the light on and off posted in the blueprint area? I think this will do exactly what I need - but being a novice, would like to install/download the “blueprint”, vice just randomly copying code.

And if I follow the post, did you add the State Condition to prevent turning on the light if it is already on?

Thank you!

The only blueprint I created is the code posted above. It was a suggested replacement for the one in shadynafie’s first post.

@123 Thanks! As a (very) novice, I do all my automation in the visual editor.

Here is what I have and what I am trying to do:

In my garage: I have three EP1 sensors, one IRIS motion sensor, two SmartThings multifunction sensors, and one Kasa plug).

What I am trying to do is:

when the house garage door is opened
or
when the pantry to garage door opens,

garage light comes on.

Light stays on while movement in the garage
or
Light stays on when the kasa plug is “on”
or
Light stays on when the garage door open
or
Light stays on when pantry to the garage door is open

After 4 minutes of no movement and the pantry to garage door is closed and the garage door is closed and the kasa plug is off

then turn off the garage light.

Seems like your routine would work in my situation. But - your guidance and counsel would be appreciated.

Unfortunately, I don’t have free time available to guide you through the process of copy-pasting blueprint code into a new blueprint file on your system. Perhaps someone else can help you with it. If not, I suggest you consider simply composing an automation, with the Automation Editor, based on your stated requirements.

@123 Ok - all good. many thanks.