Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retrieving logged data #36

Open
Juul opened this issue Jul 23, 2020 · 10 comments
Open

Retrieving logged data #36

Juul opened this issue Jul 23, 2020 · 10 comments

Comments

@Juul
Copy link

Juul commented Jul 23, 2020

According to this the sensor stores three months of values locally.

Does anyone know how to retrieve this logged data?

@jaggil
Copy link

jaggil commented Jul 23, 2020

There can be done a lot more with that sensor. It stores highest and lowest values at hour level, has an integrated realtime clock and a few things more like changing the values for the comfort icon on the display. You find the results here #1 Just search for jaggil.

@JsBergbau
Copy link
Owner

Hi Juul,

have a look at #1 (comment)

Currently one of my sensors never connected to the script has about 1298 values stored according to

grafik

@Juul
Copy link
Author

Juul commented Jul 23, 2020

Wow thanks! Exactly what I was looking for. Great work!

@guessvic
Copy link

guessvic commented Sep 1, 2020

Hi JsBergbau,

Thank you for all the effort! I am newbie to all this. I want to know how did you know your equipment has stored 1298 values from that value (0x) 11-05-00-00-12-05-0-00?

I've tried your solution connecting LYWSD003MMC with instance to my raspberry pi 4 8gb and send them to domoticz, but I also want to keep records when LYWSD003MMC advertises its results every 6 seconds locally. I've read your instruction on using callback with a bash file so data can be written whilst LYWSD003MMC is triggered, but only one way or the other. So this intrigued me as I saw the device itself can store data upto 3 months locally, but I just don't know how to retrieve them.

Please help... Thanks!

@JsBergbau
Copy link
Owner

Hi guessvic,

Thank you for all the effort! I am newbie to all this. I want to know how did you know your equipment has stored 1298 values from that value (0x) 11-05-00-00-12-05-0-00?

Because of 12-05-00-00 is in "human byte order" 05-12 so 512 Hex which is 1298 decimal.

I've tried your solution connecting LYWSD003MMC with instance to my raspberry pi 4 8gb and send them to domoticz, but I also want to keep records when LYWSD003MMC advertises its results every 6 seconds locally. I've read your instruction on using callback with a bash file so data can be written whilst LYWSD003MMC is triggered, but only one way or the other. So this intrigued me as I saw the device itself can store data upto 3 months locally, but I just don't know how to retrieve them.

Please help... Thanks!

I've also never tried to retrieve locally stored values, so I can't help. Sorry.

@guessvic
Copy link

guessvic commented Sep 2, 2020

Hi guessvic,

Thank you for all the effort! I am newbie to all this. I want to know how did you know your equipment has stored 1298 values from that value (0x) 11-05-00-00-12-05-0-00?

Because of 12-05-00-00 is in "human byte order" 05-12 so 512 Hex which is 1298 decimal.

I've tried your solution connecting LYWSD003MMC with instance to my raspberry pi 4 8gb and send them to domoticz, but I also want to keep records when LYWSD003MMC advertises its results every 6 seconds locally. I've read your instruction on using callback with a bash file so data can be written whilst LYWSD003MMC is triggered, but only one way or the other. So this intrigued me as I saw the device itself can store data upto 3 months locally, but I just don't know how to retrieve them.
Please help... Thanks!

I've also never tried to retrieve locally stored values, so I can't help. Sorry.

Thank you for the reply with answers. I will keep up searching and if I find something, I will share with you. Again, big thank you for the efforts put into this MiTemperature2!!!

@pvvx
Copy link

pvvx commented Mar 4, 2021

All firmware versions save the measurement history. In addition to the firmware version from ATC1441.
An example of reading history from the original Xiaomi LYWSD03MMC:
pvvx/ATC_MiThermometer#54

@qwandor
Copy link

qwandor commented Mar 4, 2021

In case it's useful, this is a utility in Rust to fetch all historical data from a set of sensors and dump it to InfluxDB: https://github.com/alsuren/mijia-homie/blob/master/mijia-homie/src/mijia-history-influx.rs

The actual code to fetch historical data is here in get_all_history, if you want to reimplement it: https://github.com/alsuren/mijia-homie/blob/master/mijia/src/lib.rs#L424

@JsBergbau
Copy link
Owner

All firmware versions save the measurement history. In addition to the firmware version from ATC1441.
An example of reading history from the original Xiaomi LYWSD03MMC:
pvvx/ATC_MiThermometer#54

Thanks. A very helpful tool. Where does the LYWSD03MMC get its time from? I've never set the time on this sensor.

@qwandor
Copy link

qwandor commented Mar 5, 2021

There's a characteristic (ebe0ccb7-7a0a-4b0c-8a1a-6ff2997da3a6) to get and set it. Unfortunately the onboard clock is not very accurate. Here's a utility to check the time and fix it: https://github.com/alsuren/mijia-homie/blob/master/mijia/examples/fix-clock.rs

Note that historical data stored on the sensor retains the time from when it was saved though, even if that was wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants