I have a simple automation that should turn on a switch(code is below). I have tried this so many ways but cannot get it to work at all. I am executing this manually through the automation editor and it executes, but the switch is not turning on. I can manually call the service service swith.turn_on which works fine. I have tried adding the entity ID of the switch(entity_id: switch.welle_garage) however I cannot seem to even get the proper syntax so save the changes. Any ideas? I know the automation is working because I put a push notification in the action and that gets triggered.
alias: Garage Door is closed!
trigger:
platform: time
at: “20:32:00”
condition:
condition: state
entity_id: binary_sensor.welle_garage_door
state: ‘off’ # off means closed and on means open
action:
Hard to comment because your code as it appears here has no formatting. Can you post a screenshot or something? Otherwise you can use a code block - see section 11 here.
Ahhh, sorry about that, thank you. Here is my formatted code
- alias: Garage Door is closed!
trigger:
platform: time
at: "20:32:00"
condition:
condition: state
entity_id: binary_sensor.welle_garage_door
state: 'off' # off means closed and on means open
action:
- service: switch.turn_on
- delay: 500 ms
- service: switch.turn_off
My automations are all created through Configuration in HA. When I look at them in automations.yaml I notice that they all have times enclosed in single quotes. Does that make any difference?
I don’t think it matters whether I use double quotes or single quotes. I know the automation is getting triggered under the condition, because if I replace the action of the switch.on service to a push notification, I get the push notification. So it is something with the switch action.
OMG, I swear I tried everything! Thank you Tom_I, that did the trick! This YAML stuff is very finicky, the compile errors don’t seem to help me that much. Hopefully I will pick it up at some point.
Well that makes sense then. Because I know I had this working at one point, I have it shutting my garage door if it is open past 22:00:00. I only have one switch so that is not a problem, but now I know you have to specify. Thanks!