Open h4 opened 5 years ago
Hey, so I'm actually using HACS with HomeAssistant to read the eink miija device and when I get it it was 12 hours off so livable, but when the time changed it was now 12 + 1 and I had to fix it. I found this page and then did this:
gatttool -b AA:BB:CC:DD:EE:FF:GG -I
Exchange MTU for GATT/ATT
[AA:BB:CC:DD:EE:FF:GG][LE]> connect
Attempting to connect to AA:BB:CC:DD:EE:FF:GG
Connection successful
[AA:BB:CC:DD:EE:FF:GG][LE]> char-read-uuid ebe0ccb7-7a0a-4b0c-8a1a-6ff2997da3a6
handle: 0x002f value: cd ff a1 5f 08
[AA:BB:CC:DD:EE:FF:GG][LE]> char-write-req 0x002f 6f05a25ffb
Characteristic value was written successfully
[AA:BB:CC:DD:EE:FF:GG][LE]>
In order to get the time value 6f05a25ffb
I used the above code in an online groovy console, like so:
ts=System.currentTimeMillis();
byte offsetHours = (byte) (SimpleTimeZone.getDefault().getOffset(ts) / (1000 * 60 * 60)); // oops, UTC, server?
ts /= 1000l;
ts= (long)ts;
offsetHours = -5; // FORCE it to eastern
def printable = [
(byte) (ts & 0xff),
(byte) ((ts >> 8) & 0xff),
(byte) ((ts >> 16) & 0xff),
(byte) ((ts >> 24) & 0xff),
offsetHours
] as byte[];
printable.encodeHex();
And then I cut and pasted the output value at the end of char-write-req 0x002f
,
So anyways it looks like the gatttool
can do it so if you can emit those commands you can too.
I had trouble connecting the mi home app to some of my clocks. I wrote a simple node app that connects to every lywsd02 in range and sets the time. Only tested it on my 4 clocks and in my time zone. https://github.com/Olsenius/lywsd02
I've also created a one-time script for clock-sync that you can run from the browser. https://saso5.github.io/LYWSD02-clock-sync/
I've also wanted to add an option to change the unit (F/C) but it doesn't update the clock/sensor. Did anybody try this? The value does get set but the interface doesn't update.
Hello, what is the state of this feature? Seems that there is official "Xiaomi BLE" integration now. Could it be integrated into it?
Hi,
I was looking into this also, and found an example of setting time on this device: I found this on the Gadget Bridge application github. (Line87 in https://github.com/Freeyourgadget/Gadgetbridge/blob/461842a945d43f68d2eea0d99d1f70c8a6fd666e/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/mijia_lywsd02/MijiaLywsd02Support.java)
My Python isnt that good, and my Java is even worse, but this is what looks like the UUID and bytes needed to set the time:
Maybe this is helpful for you also.