The value1 is the water used for today in L , and the value2 is the gas used today in m3 , need divided to /100 … The values are resetted to 0 each day
How can i make sensors from it , so they can be used in energy management? Will it give problems that they are resetted to 0 each time? I have it now configured as below…
sensor:
- name: Smappee Water Consumption
unit_of_measurement: "L"
state_class: total_increasing
device_class: water
state: >-
{{ state_attr('sensor.smappee_water_gas', 'records')[0]["value1"] }}
- name: Smappee Gas Consumption
unit_of_measurement: "m³"
state_class: total_increasing
device_class: gas
state: >-
{{ state_attr('sensor.smappee_water_gas', 'records')[0]["value2"] | int / 100 }}
If you want to add gas and water to the energy dashboard, the values needs to be of the state_class total_increasing (= increasing total sum of usage in kWh or m3).
Resetting every day is not total_increasing, so that will not work for the dashboard.
Can’t you get the real meter readings from the smappee device/integration?
Those values are total_increasing and can be using in the energy dashboard.
hi, no thats the problem, the smappee integration doesnt provide gas/water, those values are only online, i created a rest sensor to retrieve them with the API they supply…
How can i proceed now then?
Just my first idea.
First you need a dirivate sensor with the current sensor as input and filter out negative values. The result is that you only get changes. This way the daily reset is filtered out.
The second step is a integration sensor that adds up al the values from the derivate sensor.
The result is a sensor of which the value is total_increasing.
Can you try this approach?
I think the API from smappee also allow to retrieve the water/gas values from last hour only, and not the total from the day , then i can make an integration sensor that just sums up ? isnt that easier maybe?
Yes, if the consumption per hour is available, thats better to use.
Is the last_hour value resetting every hour or constantly updating?
You need to understand when you need to poll (via the rest sensor).
That’s only to make sure that state_attr(‘sensor.smappee_water_gas’, ‘records’)[0][“value1”] is a number when deviding by 1000. But when it’s already a number, is makes no difference