Nothing seems to work

hi everyone,
i am stuck ,I cant seem to get home assistant to do any automatons. When i try to use ui to create an automation it will not save the automation i press the save button a black box comes up on the left bottom, but it says nothing just a black box and it does not save the automation.
when i go to file editor and put the automation in the /config/automations.yaml
it does nothing
here is the way i have it in /config/automations.yaml
automation:
condition:
- condition: state
entity_id: binary_sensor.ecolink_4655bc0_r_1a5b1f11_ias_zone
state: ā€˜openā€™
- condition: state
entity_id: sun_sun
state: ā€˜below_horizonā€™
action:
- service: light.turn_on
entity_id: light.ledvance_a19_w_10_year_f91d0300_level_light_color_on_off

am i doing something wrong ui will not save and putting this in as yamil nothing works

Please see the sticky post which covers how to format code.

Itā€™s possibly a problem with your indenting, but we canā€™t tell.

It does nothing because the example you posted doesnā€™t have a trigger.

According to Understanding Automations, an automation has three parts and your example only contains two of them.

We can break up this automation into the following three parts:

(trigger)    When Paulus arrives home
(condition)  and it is after sunset:
(action)     Turn the lights on in the living room

The first part is the trigger of the automation rule. Triggers describe events that should trigger the automation rule. In this case, it is a person arriving home, which can be observed in Home Assistant by observing the state of Paulus changing from ā€˜not_homeā€™ to ā€˜homeā€™.

ok i am new to this so please have some patience with me i am old and not very smart i am just trying to wrap my head around this, I thought that this was the trigger
condition: state
entity_id: binary_sensor.ecolink_4655bc0_r_1a5b1f11_ias_zone
state: ā€˜openā€™
i thought that this is saying when this senser is open then turn on the light will you please explane trigger more and what i might should have done

I did. I provided you with a link to the documentation as well as an excerpt explaining the purpose of trigger.

What you believe is achieved by condition is actually performed by trigger.

The condition serves as an optional filter.

For example, a trigger is like saying ā€œTell me when you see a car.ā€ An optional condition would be ā€œOnly yellow cars and the current time must be between 08:00 and 12:00 on a Sundayā€.

Without a trigger, an automation looks for nothing and just sits there dormant.

so something like this

- trigger: state
  entity_id: binary_sensor.ecolink_4655bc0_r_1a5b1f11_ias_zone
  from: closed
  to: open
- condition: state
  entity_id: sun_sun
  state: 'below_horizon'

action:
- service: light.turn_on
entity_id: light.ledvance_a19_w_10_year_f91d0300_level_light_color_on_off

thank you very much

Thatā€™s almost correct. The options called trigger and condition and action donā€™t require a hyphen and trigger and condition arenā€™t composed correctly.

In addition, thereā€™s a little quirk that needs special attention. You must wrap the words on and off with quotes to indicate they should be handled as strings (meaning as literal text). Without quotes, those two words happen to have special meaning in Home Assistant because they are the names of variables (like a placeholder).

You must also add an alias to assign a name to the automation. Depending on how and where you are creating the automation, it may require a hyphen in from of the word alias.

- alias: Example 1
  trigger: 
  - platform: state
    entity_id: binary_sensor.ecolink_4655bc0_r_1a5b1f11_ias_zone
    from: 'off'
    to: 'on'
  condition:
  - platform: state
    entity_id: sun.sun
    state: 'below_horizon'
  action:
  - service: light.turn_on
    entity_id: light.ledvance_a19_w_10_year_f91d0300_level_light_color_on_off
  1. This automation use a State Trigger to listen to a binary_sensor for when it changes state from off to on.
  2. When triggered, it use a State Condition to check if the state of sun.sun is below_horizon.
  3. If the condition is satisfied, it proceeds to execute the action which is a service to turn on a light.
1 Like