Closed smarthomejunkie closed 1 year ago
I guess you found a bug! Could you please attach a picture of the sensor attributes?
I updated the post with the attribute values. Is that what you need?
I think I understand the issue here.. You are using an energy sensor that resets every day, while the integration is currently is set up to handle sources that are constantly increasing (without resetting). I think I can add support for such sensors as you have quite quickly, but if you can't wait for it, you could change to a different type!
I think I understand the issue here.. You are using an energy sensor that resets every day, while the integration is currently is set up to handle sources that are constantly increasing (without resetting). I think I can add support for such sensors as you have quite quickly, but if you can't wait for it, you could change to a different type!
That's correct, my energy provider integration only sends the daily consumption (which I find odd). I do not have the total consumption in my system. I can add a P1 meter myself to get that info or create a custom template, but it would be great to work with daily consumption as well. Not sure if other users face the same issue that they do not get the total consumption from their provider's integration.
I think this could be a problem for many actually. If you have developer tools active for your installation, could you please attach the information on your energy sensor so I can have a look at it to understand how to implement this feature? Particularly interested in state_class and last_reset attributes.
Here you go!
It might also be an idea to let people use the utility meter integration for this so that they can create their own sensor based on whatever input. And use that sensor in your configuration in the configuration.yaml. Just an idea. Not sure if it makes sense.
It might also be an idea to let people use the utility meter integration for this so that they can create their own sensor based on whatever input. And use that sensor in your configuration in the configuration.yaml. Just an idea. Not sure if it makes sense.
Should be possible already 😀
It might also be an idea to let people use the utility meter integration for this so that they can create their own sensor based on whatever input. And use that sensor in your configuration in the configuration.yaml. Just an idea. Not sure if it makes sense.
Should be possible already 😀
I'm a bit puzzled. The utility meter resets too (daily, weekly, monthly, yearly). Doesn't that mean that this results in the same issue that I currently have with the daily measurements?
Oh wait, I now see that cycle is optional. Never knew that. Let's try this...
I think most people's energy sensors are native, usually not resetting I would guess. Home Assistant docs recommends to treat totals like this (state class:total
with nolast reset
), docs available here.
I have been meaning to dive into this, so thanks for reporting this and pushing me to understand this! I should have a fix for all state class types ready within the hour.
@smarthomejunkie That was way more complicated than I thought at first, especially testing all the edge cases. But I think I have a good solution for this now. This was released in version 0.4.1, should be available in HACS within the hour. Thanks for reporting!
Thank you so much for fixing this. Will download it as soon as it's available!
Seems to be fixed! Great job!
Hmmm, I think it was an old value. I created a template and automation to calculate the total value and that worked today. After I installed the update, I guess that value was still shown. Now, after running it for about an hour with the old sensor reinstated, I get this value. Let's see tomorrow morning what the result is.
Wow, that seems like an odd number. To recreate that, I need to understand the data. Please paste the sensor attributes if the problem persists!
This morning the value is as follows:
These are the values of the sensor:
State: 453383
state_class: measurement energy_entity: sensor.zonneplan_p1_electricity_consumption_today price_entity: sensor.zonneplan_current_electricity_tariff quality: 0.96 total_energy: 2022-12-30T09:00:00+0100: 6.42 2022-12-30T10:00:00+0100: 6.79 2022-12-30T11:00:00+0100: 7.13 2022-12-30T12:00:00+0100: 7.74 2022-12-30T13:00:00+0100: 14940 2022-12-30T14:00:00+0100: 15950 2022-12-30T15:00:00+0100: 16250 2022-12-30T16:00:00+0100: 16680 2022-12-30T17:00:00+0100: 16940 2022-12-30T18:00:00+0100: 20830 2022-12-30T19:00:00+0100: 21290 2022-12-30T20:00:00+0100: 21510 2022-12-30T21:00:00+0100: 14.31 2022-12-30T22:00:00+0100: 14.79 2022-12-30T23:00:00+0100: 15.11 2022-12-31T00:00:00+0100: 0.3 2022-12-31T01:00:00+0100: 0.63 2022-12-31T02:00:00+0100: 0.96 2022-12-31T03:00:00+0100: 1.27 2022-12-31T04:00:00+0100: 1.59 2022-12-31T05:00:00+0100: 1.93 2022-12-31T06:00:00+0100: 2.43 2022-12-31T07:00:00+0100: 2.81 2022-12-31T08:00:00+0100: 3.2 price: 2022-12-30T09:00:00+0100: 0.11 2022-12-30T10:00:00+0100: 0.1 2022-12-30T11:00:00+0100: 0.1 2022-12-30T12:00:00+0100: 0.1 2022-12-30T13:00:00+0100: 0.1 2022-12-30T14:00:00+0100: 0.1 2022-12-30T15:00:00+0100: 0.11 2022-12-30T16:00:00+0100: 0.1 2022-12-30T17:00:00+0100: 0.11 2022-12-30T18:00:00+0100: 0.1 2022-12-30T19:00:00+0100: 0.1 2022-12-30T20:00:00+0100: 0.11 2022-12-30T21:00:00+0100: 0.08 2022-12-30T22:00:00+0100: 0.08 2022-12-30T23:00:00+0100: 0.08 2022-12-31T00:00:00+0100: 0.08 2022-12-31T01:00:00+0100: 0.08 2022-12-31T02:00:00+0100: 0.08 2022-12-31T03:00:00+0100: 0.08 2022-12-31T04:00:00+0100: 0.08 2022-12-31T05:00:00+0100: 0.08 2022-12-31T06:00:00+0100: 0.08 2022-12-31T07:00:00+0100: 0.08 2022-12-31T08:00:00+0100: 0.08 last_updated: '2022-12-31T08:17:43.424392+01:00' unit_of_measurement: '%' icon: mdi:speedometer friendly_name: Total Energy Score
I see some strange values in the afternoon yesterday, but I think that was before I updated the integration. Is there a way to delete these values? Just to make things clear. I used a custom template, helper and automation for a while yesterday to create the total energy used. It might be an issue on my side with that that created these huge values.
Yes, this is probably because of the automation and custom template that I've created. Is there a possibility to delete these data?
Yes, there is something off with your energy values. They will go out of the data set within today, since EnergyScore only holds 24 hours of data. Not a way to purge the data, but good idea, think I will create a service for that!
I will try to replicate the score using your data, and see if there is something off here.
I do think those strange values are totally my fault for experimenting with creating a custom sensor to create the total energy consumption. I believe it will solve itself during the day. Thank you for your support! I think I will create a YouTube video of this integration. Love the idea!
@smarthomejunkie : With the help of your code, I found a serious bug in the code. Thanks for reporting again. Release v0.4.2 should be on its way to HACS within the hour with a fix!
You're welcome 😂
Since version 0.4.0 the score adds up constantly. It shows a value higher than 100%. This did not happen before this version.
The attributes show this:
state_class: measurement energy_entity: sensor.zonneplan_p1_electricity_consumption_today price_entity: sensor.zonneplan_current_electricity_tariff quality: 1 total_energy: 2022-12-28T12:00:00+0100: 8.65 2022-12-28T13:00:00+0100: 9.1 2022-12-28T14:00:00+0100: 9.68 2022-12-28T15:00:00+0100: 10.2 2022-12-28T16:00:00+0100: 10.81 2022-12-28T17:00:00+0100: 11.52 2022-12-28T18:00:00+0100: 12.34 2022-12-28T19:00:00+0100: 13.08 2022-12-28T20:00:00+0100: 13.68 2022-12-28T21:00:00+0100: 14.12 2022-12-28T22:00:00+0100: 14.54 2022-12-28T23:00:00+0100: 14.95 2022-12-29T00:00:00+0100: 0.38 2022-12-29T01:00:00+0100: 0.8 2022-12-29T02:00:00+0100: 0.96 2022-12-29T03:00:00+0100: 1.63 2022-12-29T04:00:00+0100: 2.03 2022-12-29T05:00:00+0100: 2.45 2022-12-29T06:00:00+0100: 3.04 2022-12-29T07:00:00+0100: 3.47 2022-12-29T08:00:00+0100: 3.89 2022-12-29T09:00:00+0100: 4.54 2022-12-29T10:00:00+0100: 5.02 2022-12-29T11:00:00+0100: 5.34 price: 2022-12-28T12:00:00+0100: 0.21 2022-12-28T13:00:00+0100: 0.19 2022-12-28T14:00:00+0100: 0.16 2022-12-28T15:00:00+0100: 0.19 2022-12-28T16:00:00+0100: 0.2 2022-12-28T17:00:00+0100: 0.21 2022-12-28T18:00:00+0100: 0.21 2022-12-28T19:00:00+0100: 0.18 2022-12-28T20:00:00+0100: 0.18 2022-12-28T21:00:00+0100: 0.15 2022-12-28T22:00:00+0100: 0.12 2022-12-28T23:00:00+0100: 0.1 2022-12-29T00:00:00+0100: 0.08 2022-12-29T01:00:00+0100: 0.08 2022-12-29T02:00:00+0100: 0.07 2022-12-29T03:00:00+0100: 0.07 2022-12-29T04:00:00+0100: 0.07 2022-12-29T05:00:00+0100: 0.08 2022-12-29T06:00:00+0100: 0.08 2022-12-29T07:00:00+0100: 0.08 2022-12-29T08:00:00+0100: 0.12 2022-12-29T09:00:00+0100: 0.18 2022-12-29T10:00:00+0100: 0.2 2022-12-29T11:00:00+0100: 0.19 last_updated: '2022-12-29T11:59:46.345340+01:00' unit_of_measurement: '%' icon: mdi:speedometer friendly_name: Total Energy Score