Automation didn't work

Hello to all,

I’ve created an automation but it didn’t work and I have no idea why.
Does somebody have an Idea?

I want to create the automation in the gui.

trigger:
The light in front of my house should be switched on by different triggers.

  1. schedule (provided by an helper)
  2. brithness outside (provided by an KNX weatherstation)
  3. start of home assistant

condition:
an condition is that the light should only be switched on when the autmation is switched on by an switch (provided by KNX)

action:
switch light depending on schedule and brightness outside.

This is my automation but it didn’t work and I cant finde the mistake in it.
Absolute beginner with problems understanding the automation here.
![Automation light in front of the house|615x500]

Edit: Changed screenshots to english language.

![Automation light in front of the house_02|500x500]

Edit: Changed screenshots to english language.

Post the full YAML for the automation. Click the three dots, , “edit as YAML”, copy and paste the code in here as a code block (</> button or surround with three backticks:

```
code pasted here
```

It should look like this:

alias: "your automation"
description: ""
trigger:
  - platform: state
[usw]

Don’t hit Reply until it looks like that :slight_smile: .

alias: Außenbeleuchtung_Zeitgesteuert
description: |-
  This automation ...
trigger:
  - platform: state
    entity_id:
      - schedule.zeitschaltuhr_aussenbeleuchtung
    from: "on"
    to: "off"
  - platform: state
    entity_id:
      - schedule.zeitschaltuhr_aussenbeleuchtung
    from: "off"
    to: "on"
  - platform: numeric_state
    entity_id:
      - sensor.wetterstation_helligkeitswert
    for:
      hours: 0
      minutes: 1
      seconds: 0
    above: 25
  - platform: numeric_state
    entity_id:
      - sensor.wetterstation_helligkeitswert
    for:
      hours: 0
      minutes: 1
      seconds: 0
    below: 25
  - platform: state
    entity_id:
      - switch.zentral_automatik_beleuchtung_garten
  - platform: homeassistant
    event: start
condition:
  - condition: state
    entity_id: switch.zentral_automatik_beleuchtung_garten
    state: "on"
action:
  - if:
      - condition: state
        entity_id: schedule.zeitschaltuhr_aussenbeleuchtung
        state: "on"
      - condition: numeric_state
        entity_id: sensor.wetterstation_helligkeitswert
        below: 25
    then:
      - service: switch.turn_on
        metadata: {}
        data: {}
        target:
          entity_id: light.licht_hofeinfahrt
  - if:
      - condition: state
        entity_id: schedule.zeitschaltuhr_aussenbeleuchtung
        state: "off"
      - condition: numeric_state
        entity_id: sensor.wetterstation_helligkeitswert
        above: 25
    then:
      - service: switch.turn_off
        data: {}
        target:
          entity_id: light.licht_hofeinfahrt
mode: single

    then:
      - service: switch.turn_off
        data: {}
        target:
          entity_id: light.licht_hofeinfahrt

You’re calling switch.turn_off on a light entity. Either use light.turn_off or the generic homeassistant.turn_off.

Same for the turn_on call.

Not sure how you set that up in the UI. If I select the switch.turn_on service, it only gives me a choice of switch entities.

thank yout Troon for the hint.

I haven’t seen this. Because in my mind a light is switched on with a switch. But understand in concept of home assistant it might not work.

I changed it from switch to light and will double check if it is working now.

Aditionally I tried to recreate the combination of switch and light. But as you mentioned it is not possibel to combine both. Don’t now how I set it up, maybe it is beacause of the huge amount of changes during the creation of the automation.

Look at the entity ID: you must call the corresponding service. If it starts with light. call a light service.

The Automation works well with your help. Thanks.

But I have a further question. In the following code there are two different entities listed below if.
What is the connection of the entities? “OR” or “AND” wenn I don’t add a separate connection block?

Unlike a trigger, which is always or , conditions are and by default - all conditions have to be true.

1 Like