i’m getting some problems with my automation. I’m fairly new to this and i cant figure out the error.
I just want to turn on the light when i power on my tv after sunset.
2018-01-22 16:37:17 ERROR (MainThread) [homeassistant.config] Invalid config for [automation]: extra keys not allowed @ data['condition'][0]['after']. Got None
extra keys not allowed @ data['condition'][0]['offset']. Got None
not a valid value for dictionary value @ data['condition'][0]['condition']. Got None
required key not provided @ data['condition'][0]['entity_id']. Got None. (See /config/configuration.yaml, line 106). Please check the docs at https://home-assistant.io/components/automation/
So this is the error i see in the log. And here is my automation
#Turn on the light after sunset when tv is started
- alias: 'Turn on Light with TV'
trigger:
platform: state
entity_id: media_player.living_room_tv
to: 'playing'
condition:
condition: sun
after: sunset
offset: '+00:30:00'
action:
service: light.turn_on
entity_id: light.yeelight_living_room
Sun triggers have an offset value, as you have clearly identified.
But CONDITIONS use before_offset and after_offset for sun.
You can find that documentation for sun condition at the link I previously supplied:
#Turn on the light after sunset when tv is started
- alias: 'Turn on Light with TV'
trigger:
platform: state
entity_id: media_player.living_room_tv
to: 'playing'
condition:
#condition: sun
#after: sunset
#after_offset: '+00:30:00'
- condition: state
entity_id: sun.sun
state: 'below_horizon'
action:
service: light.turn_on
entity_id: light.yeelight_living_room