How to create entities based on the state of one entity and added values in another sensor. Electricity billing in Slovenia


I have a sensor that shows which electricity block is currently in use for later monthly billing.


I created the second sensor using Integral to convert the current electricity consumption from W to kWh

I would like to create new entities based on which block sensor.elektro_network_tariff(range of blocks from 1 to 5) is currently in use, so that they track the cumulative electricity consumption sensor.p1_meter_power_phase_3_w_to_kwh for a period of one month and continue this each month.

Does anyone have any ideas?

Thanks.

Finali solved.