I have a smart plug that I can switch off and on.
The smart plug also reports the consumed power.
I also have a home energy meter that will report excess solar power returned to the grid.
I want to make an automation that will switch on the plug when there’s excess solar power and switch it off otherwise.
here’s my trial:
- alias: Solar Excess Smart Plug
trigger:
- platform: sun
event: sunrise
condition:
- condition: numeric_state
entity_id: sensor.grid_return_power
above: 0
action:
action: >
{% if states('sensor.grid_return_power') | float > 0 %}
switch.turn_on
{% else %}
switch.turn_off
{% endif %}
target:
device_id:
- 97434adc00b9b29f11bbf385f366bc18
but I get this error:
Automation with alias 'Solar Excess Smart Plug' could not be validated and has been disabled: Unable to determine action @ data['action'][0]. Got None
Can someone help me on the syntax, please ?