Take the difference of two numbers and store into a variable

Hi All,

I want to ready an electrical energy meter twice a day, after the second reading, take the difference and store it into an entity.

I created three Number Helpers to do this. Then, I was going to use a time trigger automation to read and store the current values of the energy meter at the two different times.

Unfortunately, it seems that the Number Helpers don’t show up in Automation Actions using Set Number. What am I doing wrong? And/or how else can I go about this?


use input_number.set_value to set the value of a number helper (which is of entity type input_number)

as a general rule. if it’s a certain entity type (e.g. input_number vs number) use the corresponding entity methods to manipulate it.

You need to use Yaml for this (at least I don’t know of any UI solution)

          - service: input_number.set_value
              value: "{{ states('sensor.waschmaschine_energy') | float }}"
              entity_id: input_number.energy_start

To complete the picture, note the note from the docs:

Building block integration

This number is a building block integration that cannot be added to your Home Assistant directly but is used and provided by other integrations.