My first automation isn’t working. When I check the config via Configuration Validation, I get this error:
Invalid config for [automation]: [entitiy_id] is an invalid option for [automation].
Here’s my automation
####################################################
# #
# Outside Lights On at Sundown #
# #
####################################################
alias: Outside Lights On at Sundown
trigger:
platform: sun
event: sunset
action:
service: switch.turn_on
entitiy_id: Switch.Outside_FrontDoor, Switch.Outside_Garage
I’ve also tried entities like this:
entities:
-switch.outside_frontdoor
-switch.outside_frontdoor
I WANT to learn. I’ve searched these forums, Reddit, and Google, but I can’t find this exact issue.
Yes, my configuration.yaml file contains “automation: !include automations.yaml” without quotes
Thanks in advance for any pointers, tips, and help.
More than likely it’s just that you’re missing the dash in front of alias:
####################################################
# #
# Outside Lights On at Sundown #
# #
####################################################
- alias: Outside Lights On at Sundown
trigger:
platform: sun
event: sunset
action:
service: switch.turn_on
entity_id: switch.Outside_FrontDoor, switch.Outside_Garage
EDIT: Oh, and switch should be all lower case. (I changed the above accordingly.) I’d have to guess that the names of your switches (i.e., their entity_id’s) should also be all lower case. You’ll probably need to change those, too.
EDIT2: Oh, and a typo - entitiy_id should be entity_id. (Changed again.)
1 Like
THANKS!! That was it. 3 errors. Now my configuration shows good. Let’s see if it works tonight. Fingers are crossed.
Thanks again.
No problem. By the way, you can at least test the action part by manually triggering the automation. If the automation shows in your UI, click the name (not the toggle) so that it opens a new window. In that window at the bottom should be the word TRIGGER. Click on it to manually trigger the automation. You might want to make sure the lights are off before you do to see if they turn on.
If they don’t turn on, then check for errors.
Also, you can look on the States page to see what the actual entity_id’s are for the switches. Again, I’m guessing all lowercase.
1 Like
Now I’m confused again. This is what I have for one switch:
node name switch.outside_frontdoor
friendly_name: Switch.Outside_FrontDoor
entity name zwave.ge_12727_inwall_smart_switch_toggle
I have 4 others with this name, so how would the automation know to select the correct one?
Which one is correct?
For z-wave devices there will be a zwave.xxx entity and another entity whose domain (the part before the dot) depends on the type of device (switch, light, etc.) You should not need to worry about the zwave.xxx entities (you don’t really “use” them.) So, given names you provided, switch.outside_frontdoor is what you want to use. The friendly_name is just an attribute of that entity (mostly used for displaying in the UI.)
I’m not sure what you might mean by “I have 4 others with this name”.
FWIW, here are the entities associated with my z-wave switch that controls the lights on the front of the house:
zwave.house_front is the entity associated with the low-level z-wave control. Other than renaming it so I know what it is, I don’t ever “use” it.
switch.house_front_lights is the entity I use in automations, etc. (Actually, switch.house_front_lights is the entity_id.)
automation.house_front just happens to be an automation I created to control that switch. ![:slight_smile: :slight_smile:](https://community.home-assistant.io/images/emoji/twitter/slight_smile.png?v=9)
1 Like
Ok, so once again, I made the mistake of capitalizing. I have just now changed from Switch.Outside_FrontDoor to switch.outside_frontdoor. I’m restarting HAAS right now.
BTW, I meant that I have 3 switches with the factory name of zwave.ge_12727_inwall_smart_switch_toggle. No big deal, as now I realize that I don’t need to use that name.
Ok, my automation now contains:
action:
service: switch.turn_on
entity_id: switch.outside_front_do_switch, switch.ge_14291_inwall_smart_switch_switch_3
Because:
AND IT IS WORKING !!!
I’ll figure out how to rename those tomorrow.
I can’t thank you enough for all of the guidance and help that you’ve given me tonight. I only hope to pay it forward in the future, when I know a little more.
Edit: I manually triggered it last night and it worked great. I crossed my fingers and waited for sunrise.
(I duplicated this automation, but changed service to switch.turn_off, and trigger: sunrise)
The lights were turned off by the automation ! Yippee!!
Thanks again for all of your help.
1 Like
Glad to hear it’s working!
FYI, if you’re just turning the light on and off at sunset and sunrise, you can actually do this in one automation using service_template:
- alias: Outside Lights On/Off at Sunset/Sunrise
trigger:
- platform: sun
event: sunset
- platform: sun
event: sunrise
action:
service_template: >
{% if trigger.event == 'sunset' %}
switch.turn_on
{% else %}
switch.turn_off
{% endif %}
entity_id: switch.outside_front_do_switch, switch.ge_14291_inwall_smart_switch_switch_3
When there are multiple triggers, the automation will run when any of them occur. And in the condition and action parts of the automation there is an automatically created variable named trigger that contains information about what trigger just happened. E.g., for sun triggers see here.
And if you want to get even fancier
:
- alias: Outside Lights On/Off at Sunset/Sunrise
trigger:
- platform: sun
event: sunset
- platform: sun
event: sunrise
action:
service_template: "switch.turn_{{ 'on' if trigger.event == 'sunset' else 'off' }}"
entity_id: switch.outside_front_do_switch, switch.ge_14291_inwall_smart_switch_switch_3
1 Like