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
  platform: state
  entity_id: binary_sensor.bewmelder_auffahrt
  from: 'off'
  to: 'on'
  - condition: or
      - condition: sun
        after: sunset
        after_offset: 60
      - condition: sun
        before: sunrise
        before_offset: 45
  - service: light.turn_on
        - 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
        - light.lampe_auffahrt
        - light.lampe_aufgang
id: '1641295954243'
alias: Lampen Auffahrt durch BewMelder

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: ''
    path: homeassistant/motion_light.yaml
      motion_entity: binary_sensor.bewmelder_auffahrt
        - 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


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 ?



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

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