I have a pretty simple automation set up which, in theory, should set the relevant expected charge target based on the forecast for tomorrow using Solcast. I can set the charge target using a slider and that works fine, but I want to try to setup something a little more automatic.
This script appears to give a valid output when I push it through Developer tools, but doesn’t change the value of the entity (I’ve removed the trigger section, which is working):
action:
- service: input_number.set_value
target:
entity_id: number.deye_sunsynk_sol_ark_capacity_point_1
data:
value_template: >
{% set forecast = states('sensor.solcast_pv_forecast_forecast_tomorrow')
| float(1) | int %} {% if forecast >= 25 %}
{{ 20 }}
{% elif forecast <= 5 %}
{{ 100 }}
{% else %}
{{ 100 - (forecast - 5) * 4 }}
{% endif %}
Can anyone point out where I’m going wrong on what would appear to be a very simple task please? I’ve checked the trace and it shows an error:
Executed: April 28, 2024 at 9:22:07 AM
Error: extra keys not allowed @ data['value_template']
Result:
params:
domain: input_number
service: set_value
service_data:
value_template: 52
entity_id:
- number.deye_sunsynk_sol_ark_capacity_point_1
target:
entity_id:
- number.deye_sunsynk_sol_ark_capacity_point_1
I think I should stick to my day-job!
Thanks