What is the best way to turn on a light with a pir sensor?

why you use after sunset and also between 19 and 23?

is indentation like this?

  - alias: "Motion Kitchen"
    initial_state: True
    hide_entity: False
    trigger:
      platform: event
      event_type: motion
      event_data:
        entity_id: binary_sensor.motion_sensor_158d000127acc3
    condition:
      condition: or
      conditions:
        - condition: sun
          after: sunset
        - condition: numeric_state
          entity_id: sensor.Esszimmer_Miflora_light_intensity
          below: 100
    action:
      - service: switch.turn_on
        entity_id: switch.kitchen

The time condition is still in because I’m currently working on my automations :slight_smile: I think I can remove it but I guess especially in the summer when it is longer bright outside it might make sense…

it might be good if you have animals:
PIR triggered, AND is 3am in the night NO action

you may want to keep the light off, and not on because of a cat walking

this is not good for me: since I switch a 433MHz transmitter (Broadlink TC2), every few seconds I see the RMPRO firing the signal ON

I need help with this script:

- alias: Turn on lights after sunrise, when no movement, when doors open
  trigger:
    - platform: state
      entity_id: binary_sensor.home__door
      to: 'on' 
  condition:
    condition: and
    conditions:
      - condition: sun
        event: sunset
        offset: "-00:45:00"
      - condition: state
        entity_id: binary_sensor.home__motion
        state: 'off'  
  action:
    service: homeassistant.turn_on
    entity_id: light.yeelight_lights_1    

As you can see, I want to turn on lights, when door is open, after sunrise, when no motion is detected. Only problem, that I get error:

Invalid config for [automation]: extra keys not allowed @ data['condition'][0]['conditions'][0]['event']. Got None
extra keys not allowed @ data['condition'][0]['conditions'][0]['offset']. Got None
not a valid value for dictionary value @ data['condition'][0]['conditions'][0]['condition']. Got None
required key not provided @ data['condition'][0]['conditions'][0]['entity_id']. Got None. (See /config/configuration.yaml, line 415). Please check the docs at https://home-assistant.io/components/automation/

see here and scroll down to sun conditions:

it says you need to use “after_offset:”