I currently obtain the value of daily consumption from a device. I want to create a sensor to obtain the increasing value of the daily consumption.
- sensor:
- name: "Venta de electricidad (total) v3"
unit_of_measurement: 'kWh'
device_class: energy
state_class: total_increasing
state: >-
{{ states.sensor.homekit_91000hku21501076.attributes.Charts_sell }}
- name: "Compra de electricidad (total) v3"
unit_of_measurement: 'kWh'
device_class: energy
state_class: total_increasing
state: >-
{{ states.sensor.homekit_91000hku21501076.attributes.Charts_buy }}
Problem is that the created sensors give exactly the same information as the original sensors. What I mean is that even when stating total_increasing the created sensors reset daily to 0. On developer tools/states both sensors are stated as total_increasing.
If anyone has any advice please tell. I don’t know where to look for the problem. Thanks.
states.sensor.homekit_91000hku21501076.attributes.Charts_sell already gets me the total (kWh) by day (resets daily). Im just looking to make a new sensor that doesn’t reset daily but keeps adding.
I dont need the integration, I already have energy (kWh) and not power (kW) so no point in using the integration. I do use the integration for other things to get the energy from a power sensor but thats not what I need here.
I need to create a total_increasing sensor (kWh) from a total sensor (kWh) that has a daily reset.
Thanks
Thanks for confirming my suspicion. Its the next thing I was going to try. Lets see if it doesn’t reset today.
states.sensor.homekit_91000hku21501076.attributes.Charts_sell isn’t being recorded on database as its part of an “array” of data thats constantly changing and being updated through URL. I created a new normal sensor from states.sensor.homekit_91000hku21501076.attributes.Charts_sell to then create the total_increasing sensor from this new normal sensor. Hoping it works.
you don’t need states.sensor.homekit_91000hku21501076.attributes.Charts_sell in the database, just the template sensor. Then you have to wait until you have data.
As I was interested in this setup for a near future other project, I tried to the same, i.e. summing up the consumption of my power plug and I see the same unexpected behavior as above…only the current not a increasing value…odd, also no errors
configyaml has default_config: in it
my sensor:
- name: "GosundPlug1 Total Increasing"
unit_of_measurement: "kWh"
device_class: energy
state_class: total_increasing
state: "{{ states.switch.gosundplug1.attributes.current_consumption | float(0) | default(0) }}"
So similar as an integration sensor with rieman integral?
Is there another way to have a total increasing sensor that resets daily…i.e. not necessarily related to energy?
Or, I could use a second object alike input_number Total and then a update input_number state using its current state and the value of the source sensor