Write template to helper - expected float for dictionary value @ data['value']. Got None

Hi

I’m trying to run this in an automation to calculate electricity usage at particular times of day

service: input_number.set_value
data:
  value: >-
   “{{ states('sensor.solis_daily_energy_imported') | float(0) - states('input_number.off_peak_electricity') | float(0) }}”
target:
  entity_id: input_number.peak_electricity

This is a copy of the action the sets the helper for off-peak electricity but uses the template to subtract the off-peak usage from the total usage to work out peak usage. It works in the template page but when I run the automation I get the following error @ data[‘value’]. Got None

I’ve tried using both data: and data_template with the same results. what am I missing?

Thanks
Grant

You don’t need quotes if you use a multi-line quote symbol…

service: input_number.set_value
data:
  value: >-
    {{ states('sensor.solis_daily_energy_imported') | float(0) - states('input_number.off_peak_electricity') | float(0) }}
target:
  entity_id: input_number.peak_electricity

Perfect thanks.