I have created a few automation within the UI and after gaining confidence I have tried to write my own. And for the life of me, I cannot figure out what I am doing wrong. I read in one post the entity_id has replaced the id created by UI.
I have tried different variations changing my config file with automation: !include.yaml either active or commented out. If I commented it out I would place automation: at the top of the automations.yaml file.
Any suggestions are greatly appreciated. I have experience writing VBA, but yaml has been a bit tricky. I have used yamllint.com to proof my code before adding.
You seem to be mixing the new style “device” services (and triggers???) with traditional ones. The “device” ones are not meant to be used “manually.” You should read the docs, but I think maybe you’re looking for this:
- alias: Porch_Light_On
trigger:
platform: state
entity_id: binary_sensor.ecolink_door_window_sensor_sensor
to: 'on'
condition:
- condition: state
entity_id: sun.sun
state: below_horizon
action:
service: switch.turn_on
entity_id: switch.honeywell_unknown_type_4952_id_3036_switch
Thank you so much! I have read the the docs, but I do need to spend more time with them. I will admit I get a little confused state, entity, or platform.
you need to use an actual file name here. Any file name will work but it’s easier to keep track of of you use a descriptive name - like “automations.yaml”
so you would put the following in your configuration.yaml to reference that file:
automation: !include automations.yaml
then you need to remove any other “automation:” line from your configuration.yaml file. “There can be only one!” (he said in a rich Scottish brogue)
No. You never put “automation:” (or any top-level key) at the top of any included file. That is already included in the configuration.yaml and will not work if you add it again in the file.