Motion, light, condition

Hi, i have an automation i cant figure out, love to hear if any one of you have the same automation and it works and how you have set it up.

I have a couple of motion sensors that should turn on a couple of lights if the time is between 20.00-06.00 and the lights is off and when no motion has been detected for 1 min they should turn off.

Check the examples or post your code.

I have some RF PIR Sensors connected through a Sonoff RF Bridge controlling some lights.

You could use it as a starting point and change the “Condition” section to the times you want.
I have it setup as a package.

This was the solution,
- alias: '[Lights] Kids Nightlights On'

`  initial_state: 'on'`

    trigger:
    - platform: state
      entity_id: binary_sensor.motion_playroom, binary_sensor.motion_oliwers_room, binary_sensor.motion_eliaz_room, binary_sensor.motion_lowas_room, binary_sensor.motion_bathroom
      to: 'on'
      condition:
    - condition: time
      after: '20:00:00'
      before: '06:00:00'
    - condition: state
  state: 'off'
  entity_id: switch.fibaro_system_fgs221_double_relay_switch_2x15kw_switch
- condition: state
  state: 'off'
  entity_id: light.playroom_lamp
  action:
- service: homeassistant.turn_on
  entity_id:
    - switch.fibaro_system_fgs221_double_relay_switch_2x15kw_switch
    - light.playroom_lamp
- service: homeassistant.turn_on
  entity_id: input_boolean.nightlight_timer_on
  
- alias: '[Lights] Kids Nightlights Off'
  initial_state: 'on'
  trigger:
platform: state
entity_id: binary_sensor.motion_playroom, binary_sensor.motion_oliwers_room, binary_sensor.motion_eliaz_room, binary_sensor.motion_lowas_room, binary_sensor.motion_bathroom
to: 'off'
for:
  minutes: 1
  condition:
- condition: state
  state: 'on'
  entity_id: input_boolean.nightlight_timer_on
  action:
- service: homeassistant.turn_off
  entity_id: 
    - switch.fibaro_system_fgs221_double_relay_switch_2x15kw_switch
    - light.playroom_lamp
- service: homeassistant.turn_off
  entity_id: input_boolean.nightlight_timer_on