Weird issue, with my automations.yaml file in place and with rules, when i restart HAss (systemctl restart hass), the system doesn’t restart, the log file has a message in there about automations is taking more than 10 seconds to set up but it never completes.
Having a blank file and then starting the system, it all works, i can then copy the blank file to a backup file and restore my original file with the detail in it, reload automations from the config menu and it all loads fine and works perfectly.
So this is the yaml file, i have tried commenting out each item in turn and no difference, hass does not get to a running state with text in this file, BTW this is an included file, as per the general setup instructions suggests.
The yaml checker is all happy with it, i did find an extra - in the final automation action entity_id but everything was firing off ok, i removed it and still have the same issue.
- id: '1'
alias: Turn on sensor when sun sets
trigger:
platform: sun
event: sunset
action:
service: switch.turn_on
entity_id: switch.hall_sensor_light
- id: '2'
alias: Turn off sensor when sun rises
trigger:
platform: sun
event: sunrise
action:
service: switch.turn_off
entity_id: switch.hall_sensor_light
- id: '3'
alias: Turn on the tree lights at sunset
trigger:
platform: sun
event: sunset
action:
service: switch.turn_on
entity_id: switch.dining_outlet_1
- id: '4'
alias: Turn off the tree lights at midnight
trigger:
platform: time
at: 00:00:00
action:
service: switch.turn_off
entity_id: switch.dining_outlet_1
- id: '5'
alias: Turn on the front Xmas lights at sunset
trigger:
platform: sun
event: sunset
action:
service: switch.turn_on
entity_id: switch.front_xmas_lights
- id: '6'
alias: Turn off the front Xmas lights at midnight
trigger:
platform: time
at: 00:00:00
action:
entity_id: switch.front_xmas_lights
service: switch.turn_off
- id: '7'
alias: Turn on all cameras when alarm is armed
trigger:
platform: state
entity_id: switch.alarm_state
from: 'off'
to: 'on'
action:
service: switch.turn_on
entity_id: group.cctv_switches
- id: '8'
alias: Turn off all cameras when alarm is disarmed
trigger:
platform: state
entity_id: switch.alarm_state
from: 'on'
to: 'off'
action:
service: switch.turn_off
entity_id: group.cctv_switches
ok so taking the ’ from the ID threw errors all over the place, the two other sets for the alias and time make no difference
- id: '4'
alias: 'Turn off the tree lights at midnight'
trigger:
platform: time
at: '00:00:00'
action:
service: switch.turn_off
entity_id: switch.dining_outlet_1
No joy there, i just re-created the file entirely to rule out nay weird non printing characters but i’ve only used VI to edit them so that shouldn’t be an issue, my tiles are in single quotes now but the issue remains, the systemctl command above only shows errors with sensor values and this is to do with the calculation of a power cost per day as it hasn’t received and update from mqtt for what the daily consumption has been (Sonoff POW with Tasmota firmware).
No hint of any issues with the automation file, i have changed the mode to 777 and checked the owner and that all matches up but still no change, like i said if i load a blank file to start with and then copy the one with rules in it over the top once the system is running and reload the automation subsystem then all the rules work and the yaml checker doesn’t complain.
I see where you are coming from but the issue was there before i put those lines in, plus i wanted to ensure that the on and off states were matched between the cameras being activated and the state of the alarm system.
The to and from conditions are still valid, just optional and need to be in single quotes to avoid them being interpreted as boolean values according the the published docco.
Your yaml validates so it’s not an issue with spacing or yaml formatting. When you launch HA with your automation file in place and HA fails to load, it will create a homeassistant.log. the last few lines will point to what it is getting hung up on and even tell you the line of the file it doesn’t like. if for some reason it is just telling you it doesn’t like your automations file and doesn’t provide specifics, you will need to go one by one and restart HA with one automation added at a time. do this until you find the automation (or automations) that doesn’t allow HA to launch. My guess is you are trying to use a component, entity, etc that doesn’t exist in your states tab of HA or there’s a spelling error and it’s getting hung up on that.
I’ve had that happen too. The validator mostly catches YAML errors and that’s about it. I’ve had the occasional spelling error slip past it and still report “Valid!” I use an external YAML Lint to validate before I reload in HA. I threw the config posted above into it and it spit out valid syntax at least.