Make a sensor to store a value from another sensor

Hi,

I have a sensor: “sensor.solveien_total_lifetime_energy_output_2”. This sensor counts lifetime kWh produced by my solar panels.

I like to make two new sensors that gets it value from the “solveien_total_lifetime_energy_output_2” sensor.

The two new sensors need to be updated with new values, once each month, day 1 at 00:00:01, and the second sensor need to be updated once a year, January 1. at 00:00:01.

The monthly sensor can be named: growatt_lifetime_mnd_value

The yearly sensor can be named: growatt_lifetime_year_value

I run my manually made sensors (ie not made in visual editor) written in yaml, in the file: configuration.yaml

Someone that can help me?

Take a look at triggers for sensors, they allow the sensor to be updated only on the trigger instead of constantly.

Maybe you want the Utility Meter integration? Utility Meter - Home Assistant (home-assistant.io)

Hi. Today I use Utility meters. But when the input sensors i use in the Utility meter, has some down time, eg after each HA update, the sum of the Utility meters get lagging the correct value. This is the reason behind my question above. Because with your help, I will have fixed values set every 1. day of month, and 1. day of a new year. :-). These fixed values I plan to use in again new sensor I will write, where I write and store of of my own written sensors today, in the configuration.yaml.

Post deleted

Thanks. I made this work, copy value of one sensor to a new. Now I need to find out how I run this only once a month and once a year. And not like now, where it is updated all the time

If you use a trigger on it as I linked above then you are defining when it will update.

image

Need to make my reply as a picture, as the #'ed lines, became in a big font