h4 / lywsd02

MIT License
169 stars 34 forks source link

Historic Data #7

Closed 53RT closed 4 years ago

53RT commented 4 years ago

Hi,

thanks for the effort you put into this library. It made it possible for me to set and use the clock.

Is there anything planned with the historic data feature? I saw the TODO label in the code and was curious about it because I saw the temperature and humidity plot in one of the Mi Home app review videos.

So far I figured out that the device stores one entry for every hour passed. The fourteen bytes contain:

Byte 1 2 3 4 5 6 7 8 9 10 11 12 13 14
Content index 0 0 0 Ti me Sta mp Max Temp ? Avg Temp Avg Humidity

The meaning of byte 11 is unknown to me and it varies a lot so I don't think its the battery or related to humidity.

So far I have received ~200 of those packages since I have inserted the battery about 8 days ago. I don't know how many entries it will store and if they will be overwritten.

Does somebody has some more information?

If there is anything planned with it I am happy to help. I just wanted to create this Issue for some discussion about the historic data and what could be done.

h4 commented 4 years ago

@53RT thank for your investigation! I try to integrate in the library in near future.

h4 commented 4 years ago

@53RT implemented in v0.0.5.

53RT commented 4 years ago

Thanks @h4 for letting me know. Those are great news

First I thought the clock records and average value and that the min and max as can be seen here are calculated per day but my freezer told me otherwise :-)

I created a pull request for some changes that corrected the decoding in my case using Celsius unit.

I think the issue is solved and I can close it