zivillian / ism7mqtt

GNU General Public License v3.0
61 stars 11 forks source link

Home assistant: add more data to the long term statistics #127

Open krusta4711 opened 2 months ago

krusta4711 commented 2 months ago

Historical data in home assistant is purged after 10 days unless a sensor has defined the attribute state_class. At present ism7mqtt only treads temperatures and percentages as valuable for the home assistant long term statistics. Only for "°C" and "%" the state_class will be send.

I think nearly all values are important to have them long term to be able to compare certain situations. So I added a few more units in this PR: https://github.com/zivillian/ism7mqtt/pull/126

Other user might think different and do not want to have the data long term. So it should maybe even be configurable per unit.

THE CHANGE IS NOT TESTED YET as due to my other long running test which I do not want to stop at present (#115 ). So the PR cannot be merged. Would be good if someone could test whether it works or whether it at least do no harm. ;-)

krusta4711 commented 2 months ago

One day after I changed the code, suddenly enabling the long term statistic in home assistant via customize entry works. 8-P

I was not able to enable LTS via customize before. So I started changing the code. But now it works.

So the code changes I did are not needed right now. Nevertheless for long term it might be the better way to be able to control LTS via ism7mqtt rather than customize. To use customize seems not to be a preferred way by the home assistant developrs.