#hi, is there any way in an Action to

1 messages · Page 1 of 1 (latest)

molten pilot
#

Yes, use the light.turn_on service call and target the Area

midnight otter
#

hello, ok but how does that apply to all the lights in that Area?

#

sorry I'm new to this

molten pilot
#

By ... targeting the area

#

Literally

midnight otter
#

ok so long as all my Leviton switches are in that area, it will trigger that action to them

#

and HA does the rest

molten pilot
#

Pick Area

#

Job done

midnight otter
#

I don't get the Area option in my Action

molten pilot
#

You picked the same service?

#

This only works if you use services, not device actions

midnight otter
#

here is my YAML script ```description: ""
mode: single
trigger:

  • type: motion
    platform: device
    device_id: 1e...
    entity_id: fa7...
    domain: binary_sensor
    condition:
  • condition: and
    conditions:
    • condition: time
      after: "00:00:00"
    • condition: sun
      before: sunrise
      action:
  • device_id: ""
    domain: ""
    entity_id: ""```
#

ah ok services is key then

#

i had picked Device I think

molten pilot
#

Devices are limiting, don't use them

midnight otter
#

where is that Services? I am looking everywhere for it

#

my Automations screen shows this

molten pilot
#

That's from 2024.1

midnight otter
#

weird i can't add an attachment here for screenshot

sick heronBOT
#

Please use imgur or other image sharing web sites, and share the link here.

Image posting is blocked in most channels to discourage people from sharing text as images. Sharing text as images assumes that everybody sees the world as you do, which isn't the case. Some people are colour blind, or have visual impairment that means they can't make sense of an image of text.

molten pilot
#

That's blocked by default because too many people post images of text, or walls of irrelevant images

midnight otter
#

ok found it

#

would Sun Next dusk be equivalent to Sunrise?

molten pilot
#

No

midnight otter
#

i want the condition to be: after 12.00 and before Sunrise

molten pilot
#

Ok, so that's an or with two conditions

#

One for after 12:00 and one for before sunrise

midnight otter
#

ok

#

ok here is my Automation ```description: ""
mode: single
trigger:

  • type: motion
    platform: device
    device_id: 1e..
    entity_id: fa7..

    domain: binary_sensor
    condition:

  • condition: time
    after: "00:00:00"
    weekday:

    • sun
    • mon
    • tue
    • wed
    • thu
    • fri
    • sat
  • condition: and
    conditions:

    • condition: sun
      before: sunrise
      action:
  • service: light.turn_on
    target:
    entity_id: []
    device_id: []
    area_id:
    - outdoors
    data: {}

  • delay:
    hours: 0
    minutes: 15
    seconds: 0
    milliseconds: 0

  • service: light.turn_off
    target:
    area_id: outdoors
    data: {}

indigo hatch
#

you don't need to obfiscate the enttiy_id and device_id, they are just randomly genereated id's which are created when you integrate the device. Nobody can do anything with them

midnight otter
#

ah lol ok ok

#

wasn't sure

indigo hatch
#

I would advice to use a state trigger anyway, so the total thing would be

description: ""
mode: single
trigger:
  - platform: state
    entity_id: binary_sensor.motion_outdoor #change to correct sensor
    to: "on"
condition:
  - condition: time
    after: "00:00:00"
  - condition: sun
    before: sunrise
action:
  - service: light.turn_on
    target:
      area_id:
        - outdoors
  - delay:
      minutes: 15
  - service: light.turn_off
    target:
      area_id: outdoors
#

note that this will turn off your light regardless if there is still motion

midnight otter
#

yup, the motion sensor triggers once and then stops

indigo hatch
#

you might want to use either mode: restart or use a wait_for_trigger instead of the delay

midnight otter
#

the wait_for_trigger would be for?

molten pilot
#

Waiting for no motion

midnight otter
#

ah the motion sensor don't work this way unfortunately... it's a ON then off for 1 min... then a new trigger if new motion is sensed

molten pilot
#

Then just use the restart mode

#

(ugly, but works)

midnight otter
#

so i see this working as follows (rural long driveway about 300 feet long and winding) - sensor trips, all lights go on.. the only way for a driver to get out now is to continue up the driveway, turn around, then go back out... another trigger happens, but the lights are already on

molten pilot
#
  - service: light.turn_on
    target:
      area_id:
        - outdoors
  - wait_for_trigger:
      - platform: state
        entity_id: binary_sensor.motion_outdoor #change to correct sensor
        to: "off"
        for: "00:15:00"
  - service: light.turn_off
    target:
      area_id: outdoors
#

That's the other way

midnight otter
#

ok

#

as i can see, so many ways to slice and dice this

#

will play with a few and see which works in my situation, will add a few more sensors once I see how this works and add even more specific lighting to zones etc

#

thank you for the help, very very helpful

midnight otter
#

how do i close this room if no longer needed?