Open danielkucera opened 4 years ago
On the original firmware you can. I don't know if it is possible in the custom firmware. Write 0x0010 to the handle characteristic 0x0031 You will receive notifications on handle 0x00f2 Which looks like:
00 00 00 00 10 0e 00 00 06 01 57 d8 00 35
01 00 00 00 20 1c 00 00 d8 00 3b d4 00 3a
02 00 00 00 30 2a 00 00 ed 00 3c d3 00 39
....
Each notification can be decoded this way
struct.unpack('<IIHBHB', bytes.fromhex(line))
This gives something like
[(0, 3600, 262, 87, 216, 53),
(1, 7200, 216, 59, 212, 58),
(2, 10800, 237, 60, 211, 57),
...
]
This is how the Xiaomi Home is getting the history.
I have the device since only 16 days and have over 380 notifications ! I don't know if there i a way to limit the amount of data but you have to wait for the last notification to have values for the last hours :(
I'd like to have min/max stored. When the device starts, it will save the current value of temp and humidity as both minimum and maximum. Over the time, it will compare each value measured and adjust min/max values. For my application, it would be enough to be able to read and reset min/max using the web application. For some advanced usage, it could store hourly min/max values and display 24hour min/max values.
Or...
then it is easily possible to return min/max for each hour or for last N hours (where N<LOG_LEN)
What do you think?