How do I set the value of a sensor?

Hi,
I’m trying to implement a “dual rate” tariff. I believe that there is a bug in the current Utility Meter integration (I’ve no idea how to quote this assumption - but this is not relevant to my question except to prevent answers along the line of “I should use the Utility Meter Integration” - which I’d love to).

This is a snippet from my /config/configuration.yaml:

template:
  sensor:
  - name: "dual rate tariff"
    state: "0.00"
    unit_of_measurement: "£"

Which I would like to update via an Automation.


The “Turn on Blue LED” is just a debug device to test that the trigger is working. I would now like to add another action to set the value in my Template Sensor (is that the correct description?) to a numeric value.
How do I do that?

Thanks in advance, Martin

You can’t set a value of a sensor. Sensors are read-only.

Alternatively, you can use number helper:

https://www.home-assistant.io/integrations/input_number

…/Frenck

Thanks Frank,
One more gem in my HA library…
Regards, M.