Hello.
I’m trying to carry out an automation in which the trigger is before a time stored in the state of a sensor and one of the conditions is also after a time stored in the state of a sensor.
I have 2 sensors like this:
sensor.time_from 20:30:00 sensor.time_to 08:30:00
And my automation:
- alias: 'Tomada Diogo' trigger: platform: time after: '{{ strptime(states.sensor.time_to, "%T") }}' condition: condition: and conditions: - condition: time before: '{{ strptime(states.sensor.time_from, "%T") }}' - condition: state entity_id: 'switch.tomada_diogo' state: 'on' action: - service: switch.turn_off entity_id: 'switch.tomada_diogo'
Hass always starts with errors in automation:
ERROR (MainThread) [homeassistant.config] Invalid config for [automation]: Invalid time specified: {{ strptime(states.sensor.time_to, "%T") }} for dictionary value @ data['trigger'][0]['after']. Got None extra keys not allowed @ data['condition'][0]['conditions'][0]['before']. Got None not a valid value for dictionary value @ data['condition'][0]['conditions'][0]['condition']. Got None required key not provided @ data['condition'][0]['conditions'][0]['entity_id']. Got None. (See /home/homeassistant/.homeassistant/configuration.yaml, line 65). Please check the docs at https://home-assistant.io/components/automation/
Can anyone help me achieve this automation, please?
Thanks in advance for any insights.