Here is the error that came up from what you provided…
Testing configuration at /config
2018-01-28 22:49:35 ERROR (SyncWorker_0) [homeassistant.util.yaml] mapping values are not allowed here
in “/config/automations.yaml”, line 2, column 8
2018-01-28 22:49:35 ERROR (MainThread) [homeassistant.bootstrap] Error loading /config/configuration.yaml: mapping values are not allowed here
in “/config/automations.yaml”, line 2, column 8
If you have several automations in your automations.yaml file you’ll need to put a - in front of the “id:”. make sure you put a space after the dash. like this
This is my only automation, I applied the dash just for the sake of trying it and now i have this error…
Testing configuration at /config
2018-01-29 02:20:32 ERROR (SyncWorker_0) [homeassistant.util.yaml] mapping values are not allowed here
in “/config/automations.yaml”, line 2, column 10
2018-01-29 02:20:32 ERROR (MainThread) [homeassistant.bootstrap] Error loading /config/configuration.yaml: mapping values are not allowed here
in “/config/automations.yaml”, line 2, column 10
Here is my configuration…
- id: timed_off_bathroom_fan
alias: Bathroom fan timer
trigger:
platform: state
entity_id: switch.tplink_switch
to: 'on'
for:
seconds: 5
action:
service: homeassistant.turn_off
entity_id: switch.tplink_switch
In most cases your code should be starting on an odd numbered column. If you see an error saying column 8 or 10 I would be looking at it all being off by one spot in either direction. Everything should be on 1,3,5,7,9 and so on.
I’m having a very similar issue. The current setup, using device or state, only triggers after a light/switch gets turned on while all conditions are true. I want it to trigger without having to go from an off to an on state. For example, I have it set to turn the porch light off after 30 minutes, but only after sunset. If I turn it on before sunset nothing happens. If I turn it on after sunset it works as intended.
The “from” and “to” states are actions, a “to” state only triggers when it goes from another state to “to”. Is there an “is” state that I’m missing? This would solve the problem (there would probably be a polling interval attached)
You could simplify your trigger to just be 30 minutes after sunset. Turn off the light.
You can keep your current automation as well, so that if its turned on after sunset, it will turn off after 30 minutes as well.