Automation based motion sensor

Anybody have a working example of an automation based on motion the one i have listed below is not working. Thanks in advance.

- id: '1603832103094'
  alias: Turn on living room light when there is movement
  description: ''
  trigger:
  - type: turned_on
    platform: device
    device_id: f55feaed189111eb9c28b9e783ce2528
    entity_id: binary_sensor.zooz_zse40_4_in_1_sensor_sensor
    domain: binary_sensor
  condition:
  - condition: time
    after: 00:00:00
    before: 08:00:00
  action:
  - entity_id: switch.bedroom_lamp
    service: switch.turn_on
  mode: single
- id: '1603832103095'
  alias: Turn off living room light when there is movement
  description: ''
  trigger:
  - type: turned_off
    platform: device
    device_id: f55feaed189111eb9c28b9e783ce2528
    entity_id: binary_sensor.zooz_zse40_4_in_1_sensor_sensor
    domain: binary_sensor
  condition:
  - condition: time
    after: 00:00:00
    before: 08:00:00
  action:
  - entity_id: group.living_room_lamps
    service: light.turn_off
  - data: {}
    entity_id: switch.aeon_labs_zw096_smart_switch_6_switch_2
    service: switch.turn_off
  mode: single

That doesn’t look right

Sorry that was a typo. I’ve corrected the post and added the code to turn off when there’s no motion during the giving time frame.