LordMike / MBW.BlueRiiot2MQTT

Utility to map between Blue Riiots pool API, and Home Assistant MQTT
47 stars 2 forks source link

Leveraging latest Home Assistant developments related to statistics #61

Closed barto64 closed 2 years ago

barto64 commented 2 years ago

First of all, great thanks for this integration, it is wonderful and one of my favourites and by far more used and usefull.

Would it be possible to enrich the sensors created for this integration in order to leverage the new statistics features of HA

I leave you this link as reference:

In here https://www.home-assistant.io/more-info/statistics/ you can read the below:

Open an issue with the author of the integration and link them to https://developers.home-assistant.io/docs/core/entity/sensor#long-term-statistics

LordMike commented 2 years ago

Which metrics do you think could qualify for Statistics?

I'm thinking all the measurement values, like temperature, pH, ..

barto64 commented 2 years ago

Fully agree. Temperature, ph, oro, etc.

LordMike commented 2 years ago

Would they have to be new sensors, or retask the existing ones?

They don't have any class today, so it wouldn't change anything, but will they continue as sensors today if they get one of those classes?

I'm updating my models library, I've noticed I'm behind on changes. Once that's done, I can utilize it here.

barto64 commented 2 years ago

I do believe you only need to add the new property to tHe existing sensors. At least that is what I understand by reading the documentation.

But in any case worthy to make some testing.

barto64 commented 2 years ago

Making the new property state_class as "measurement" represents what, at the end of the day, your sensor do effectively.

LordMike commented 2 years ago

Latest :dev applies measurement state_class to the measurement values, pH, orp etc.

I can't visually see anything within HASS, yet, .. so it'll be exciting to see what happens.. :P

barto64 commented 2 years ago

You need to add the sensor to statistics-graph card and wait at least 2 hours as far as I recall to see the statistics of the sensors

LordMike commented 2 years ago

image

Well, it seems to have worked. :)

barto64 commented 2 years ago

You are great Mike, well done Sir. Willing to download the next release. Great thanks

barto64 commented 2 years ago

Hey @LordMike ,

Not really in a hurry, but do you have an ETA for the deployment in PRD of the modified sensors ?

Thanks, @barto64

LordMike commented 2 years ago

If you're able to, you can always opt to run the :dev image. It will continuously be with the latest changes.

If not, then I can try to get a new version out soon.