-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added state_class 'TOTAL' to todays cost sensors #36
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks 🙏
Hi, I've had some issues with the total cost in the energy dashboard. Unfortunately, I don't think the 'TOTAL' state class is the correct thing to use, unless a 'last_reset' attribute is added. Every day, the sensor resets to 0 (this is because the calculation uses the daily import) and so at the start of every day, the energy dashboard is taking away the cost from the previous day. For example, if you use £10.00 on Monday and then £8.00 on Tuesday, the energy dashboard will show a cost of -£2.00 on Tuesday. It looks to me that 'TOTAL_INCREASING' is correct state class to use, but I note that it was changed away from 'TOTAL_INCREASING' in version 1.6.1. Was something breaking when it was set to 'TOTAL_INCREASING'? |
You might want to log this as an issue, I have the same problem with negative values. Happy to log it but your description covers it. |
I recently started observing the same behaviour you described. I agree, the state class
I believe |
@vladimir-babichev I find the explanation on the Long-term Statistics confusing but I agree it looks like Edit: I'm not a developer so not sure if this is relevant but I remember having all sorts of problems getting last_reset working with my manually created mqtt sensors during the introduction of long term statistics and prior to "total_increasing". looking at old configs I ended up using customize.yaml to add in last_rest but I think it really needed an |
Happy to accept a working PR here but since these values are not accurate for me (I have a dual tariff and my IHD reports the wrong cost). As mentioned above, I removed the previous state_class because of the warning logs but would reinstate them if we can avoid them with another setting. |
I wanted to also flag this does calculate costs wrong for dynamic rates tariffs like Agile Octopus, where rates change every half an hour - is there a working or workaround solution for those? |
This PR addresses #35 by adding
state_class
SensorStateClass.TOTAL
toSmart Meter Electricity: Cost (Today)
andSmart Meter Gas: Cost (Today)
sensors.