I’ve updated my system a couple of days ago and since then, my statistics sensors are no longer working as expected.
It’s been a while, since I’ve created those sensors, so I’m not perfectly sure, what I did, but I’ve created a statistics sensor and then some template sensors to extract the values a wanted to display.
The statistics sensor is still working, meaning I can still see a value there, but extracting min, mean and max values are no longer working.
I’m sure that I might have missed something in some recent release notes, but I cannot figure out, what it was. Could someone please point me to the missing piece.
Yes, sure, but I didn’t find anything directly related to the constellation I have. I don’t remember precisely, how I did set up those sensors, but I was happy that it did what it was supposed to do.
Now it would help me to find some release notes saying ‘until now, you did this, but now we have something better’.
Hint: you can google for ste:https://community.home-assistant.io statistics, which brings you to the 2021.12 release notes, under which you have Breaking changes, including a part on Statistics
Of note is “Many characteristics were renamed and additional ones were added”, which lead you to the updated documentation.
Thanks for pointing me to the lines I have missed. While reading those lines, I think I remember that there was something, but I thought I could figure it out in case it would concern something in my system after the update.
Unfortunately, I still have the impression that HA is a hobby taking more time than I normally have. I want the update, because I want to have feature X or a new device needs Y and this has X as prerequisite.
But that those ~10 lines in the release notes will cost me hours to figure out, what happened and then many more hours to adapt my code accordingly (unsure, whether my statistics can be continued or I have to start new ones) is not expected.
Just to complete this thread instead of simply having a link to some kind of documentation and I’ve seen other questions like mine (after I’ve asked ).
I’ve added two additional sensors and set the corresponding ‘state_characteristic’ attribute. Just to be able to continue my graphs, I’m still using the template sensors. It might be that I could have named the new statistics sensors like the existing template sensors to reach the same goal, but this is something I can try out later - before I do the same steps for roughly 20 other sensors, because of a questionable change
Last comment from my side on this one: you can rename it accordingly, but in this case the displayed name is like the internal name of the sensor. I didn’t find a way to set a friendly name for the statistic sensors, so I had to stick to my template sensors. There might be a way, but …
After creating lots of duplicated code lines, lots of copy&paste errors and wrongly created sensor entities, it seems to be done. Still this change does not make any sense to me. An entity created for statistic purposes is used to contain and to visualize data on the long run. Replacing or changing it without a significant reason only causes a lot of work for users not changing their HA code on a daily base and the code did not get better or easier to maintain.
Next step for me is to start looking for ways to clean up the influx database to get rid of now useless entities in there.
Hello @fridolin,
I am the one who has implemented the changes you were troubled with. First I want to apologize for the inconvenience. I agree that maintaining something like a Home Assistant hobby setup shouldn’t be constant work and surprises, and the maintainers do a great job keeping breaking changes to a minimum. Still, if a breaking change is worth the benefits and helps to mature Home Assistant it is (in my opinion) important to welcome these changes and support progress. As users we need to read the detailed release note to learn about relevant changes. Everything you needed to understand the changes and how you adapt your setup was included in the release notes, hence why I am generally surprised by your thread.
That said, let me respond constructively to your questions and critique.
Replacing or changing it without a significant reason
That might be your impression but let me assure you that the change was one of many enhancements and improvements to the statistics component over the last couple of weeks. The breaking change was necessary to enable many of the other changes you might not have seen so far, and future additions and improvements you might benefit from at a later point.
Just to complete this thread instead of simply …
Thanks for that!
I’m still using the template sensors.
You can delete those. That was certainly one of the reasons for the big change
didn’t find a way to set a friendly name for the statistic sensors, so I had to stick to my template sensors.
That is a very interesting thought. I will certainly consider to add the ability to define a friendly name with the statistics sensor.
Apart from that, remember that you can always define a friendly name while accessing an entity in a custom Lovelace view, alternatively you can use customization to define a friendly name:
Thank you, for your kind words. I appreciate that.
Let’s agree to disagree in some points, from an end user perspective, and let’s wait for the additions and improvements you’ve vaguely mentioned.
Actually I was expecting additional ways to set a friendly name, but I simply forgot about them. So I’m happy that you’ve brought up the customization aspect. I guess I’ll change one of my sensors to be labeled that way and concerning the rest, I’m satisfied that it again works. If template sensors will be removed in the future, it seems I have a backup plan.