Lights not switching off

When switching from the basic automation blueprint to one with a sun condition, lights are not switching off anymore. Lights are KNX and sensor is Homematic

mode: restart
max_exceeded: silent
trigger:
  platform: state
  entity_id: binary_sensor.bewmelder_auffahrt
  from: 'off'
  to: 'on'
condition:
  - condition: or
    conditions:
      - condition: sun
        after: sunset
        after_offset: 60
      - condition: sun
        before: sunrise
        before_offset: 45
action:
  - service: light.turn_on
    target:
      entity_id:
        - light.lampe_auffahrt
        - light.lampe_aufgang
  - wait_for_trigger:
      platform: state
      entity_id: binary_sensor.bewmelder_auffahrt
      from: 'on'
      to: 'off'
  - delay: 120
  - service: light.turn_off
    target:
      entity_id:
        - light.lampe_auffahrt
        - light.lampe_aufgang
id: '1641295954243'
alias: Lampen Auffahrt durch BewMelder
description: 

What does the debugger say.

What is binary_sensor.bewmelder_auffahrt?
The automation will only run when that binary sensor state changes, independently of the sun, you realize that, do you?

As a newby I never did an automation outside a blueprint, so I’m not sure I can answer these questions.
What I know is that the basic blueprint did the job perfectly well, outside the fact, that ligfhts switched on even during daylight (see below)

 id: '1641233539751'
  alias: Auffahrt
  description: ''
  use_blueprint:
    path: homeassistant/motion_light.yaml
    input:
      motion_entity: binary_sensor.bewmelder_auffahrt
      light_target:
        entity_id:
        - light.lampe_auffahrt
        - light.lampe_aufgang
      no_motion_wait: 120

With my current knowledge I’m not in a position to add/merge the sun conditions into this code.
How should the lines in automations.yaml look like to get this done (ignoring the blueprints)?

Thanks a lot

Niels

have a look at Conditions - Home Assistant
your offset values are possibly invalid after_offset: "-01:00:00"

First thanks for the responses. The whole things with these lights is getting more and more confusing.
I tried to make use of your comments, but realized that my basics are not in a good shape:
I deleted all automations defined in automations.yaml or configuration.yaml. I deleted all automations from the blueprint GUI section. Nevertheless,

  • the light switches on 7:49 every morning and off at 18:40
  • when I create a blueprint, it’s not visible butr shows up in automations.yaml

Looks like a ghost is active from previous settings which makes new settings not working as well

any ideas to get me back to normal ?

Thanks

Niels

Did you restart HA or reload automations ? If not (even if deleted) the previous configuration is still active

This.
If they still show up in the automations list in UI, you can click the ‘i’ symbol and delete the entity from there.
Then restart again.

Thanks AntonH. That worked