atc1441 / ATC_MiThermometer

Custom firmware for the Xiaomi Thermometer LYWSD03MMC and Telink Flasher via USB to Serial converter
2.84k stars 476 forks source link

TelinkFlasher web app - send settings to custom firmware not working #168

Open KlosiakMK opened 3 years ago

KlosiakMK commented 3 years ago

Hi All,

At the beginning I would like to thank @atc1441 for his great job with providing flashing tool and custom firmware support. Thank you!

I followed instructions and flashed the latest custom firmware to my LYWSD03MMC device. Everything went good. Then I flashed stock firmware again. I would like to change some default options in custom firmware and I wanted to use that "Send settings to custom firmware" for that purpose but when I hit any button or use text field and hit "Send" button I got in the log messags like "Error on sending setting AF", "Error on sending setting B0", etc. Below screenshot of my log. I am not very familiar with C programming and compiling stuff so web UI allowing to update values in custom firmware is a huge convenience for me but unfortunately it does not work for me.

obraz

I tested the latest versions of Chrome/Edge browsers and on both found similar issue. My question is what I am doing wrong? And how to make it to work for me?

Additionaly I would like to ask how to properly add humiditiy offset when I want to add negative number? For offset +10 it is FB+0A, right? For offset -10 it is FB+?? (I don't know as simple conversion of -10 gives me FFFF FFFF FFFF FFF6 result).

Can anyone explain how I should convert int8 to hex when it comes to negative numbers, please?

Thanks in advance for any tips and tricks regarding web flashing tool.

EDIT1: OK. I know where I made a mistake when sending settings to custom firmware. This section works fine when custom firware is already installed on the device so I was able to disable battery info and change advertising type to "Mi Like". I thought that after changing advertising type to "Mi Like" I will be able to use my sensor with Xiaomi Home app but when there is an issue there. Sensor is visible fo Xiaomi Home app but I can't connect it...it fails on verification step. What should I do to use sensor with flashed custom firmware with original Xiaomi Home app?

EDIT2: I think that app MijiaTemp will solve my issue. I can use it on my phone with sensors flashed with custom firmware. Nevertheless I would like to know if it is true that Xiaomi Home app won't work with custom firmware and that it is not possible to overrdie, please?

So at the moment I have two questions.

  1. How to correctly add negative humidity or temp offset? I don't know how to convert int8 to hex to FB+"XX" format.
  2. Are there any plans to make custom firmware to work with Xiaomi Home app? Custom firmware gives a possibility to personalize sensors and add offsets which is great.

Cheers!

fraagol commented 3 years ago

Hi @KlosiakMK, for the offsets, they are hexadecimal values, being:

positive values from 01(+0.1) to 7F(+12.7), negative values from 80(-12.7) to FF (-0.1) and the value 0 is represented by 00.

Sample commands for adjusting the temp offset, being FA the command and the last 2 digits the offset: FA01 : +0.1 FA02: +0.2 FAFF: -0.1 FA80: -12.7 FA7F: +12.7

Cheers!

brain-work commented 2 years ago

Hi @KlosiakMK, for the offsets, they are hexadecimal values, being:

positive values from 01(+0.1) to 7F(+12.7), negative values from 80(-12.7) to FF (-0.1) and the value 0 is represented by 00.

Sample commands for adjusting the temp offset, being FA the command and the last 2 digits the offset: FA01 : +0.1 FA02: +0.2 FAFF: -0.1 FA80: -12.7 FA7F: +12.7

Cheers!

Hi, sure that FA80 is -12,7 ? I think it must be FA81 or is there an mistake in my table? Please check!

FF -0,1 FE -0,2 FD -0,3 FC -0,4 FB -0,5 FA -0,6 F9 -0,7 F8 -0,8 F7 -0,9 F6 -1,0 F5 -1,1 F4 -1,2 F3 -1,3 F2 -1,4 F1 -1,5 F0 -1,6 EF -1,7 EE -1,8 ED -1,9 EC -2,0 EB -2,1 EA -2,2 E9 -2,3 E8 -2,4 E7 -2,5 E6 -2,6 E5 -2,7 E4 -2,8 E3 -2,9 E2 -3,0 E1 -3,1 E0 -3,2 DF -3,3 DE -3,4 DD -3,5 DC -3,6 DB -3,7 DA -3,8 D9 -3,9 D8 -4,0 D7 -4,1 D6 -4,2 D5 -4,3 D4 -4,4 D3 -4,5 D2 -4,6 D1 -4,7 D0 -4,8 CF -4,9 CE -5,0 CD -5,1 CC -5,2 CB -5,3 CA -5,4 C9 -5,5 C8 -5,6 C7 -5,7 C6 -5,8 C5 -5,9 C4 -6,0 C3 -6,1 C2 -6,2 C1 -6,3 C0 -6,4 BF -6,5 BE -6,6 BD -6,7 BC -6,8 BB -6,9 BA -7,0 B9 -7,1 B8 -7,2 B7 -7,3 B6 -7,4 B5 -7,5 B4 -7,6 B3 -7,7 B2 -7,8 B1 -7,9 B0 -8,0 AF -8,1 AE -8,2 AD -8,3 AC -8,4 AB -8,5 AA -8,6 A9 -8,7 A8 -8,8 A7 -8,9 A6 -9,0 A5 -9,1 A4 -9,2 A3 -9,3 A2 -9,4 A1 -9,5 A0 -9,6 9F -9,7 9E -9,8 9D -9,9 9C -10,0 9B -10,1 9A -10,2 99 -10,3 98 -10,4 97 -10,5 96 -10,6 95 -10,7 94 -10,8 93 -10,9 92 -11,0 91 -11,1 90 -11,2 8F -11,3 8E -11,4 8D -11,5 8C -11,6 8B -11,7 8A -11,8 89 -11,9 88 -12,0 87 -12,1 86 -12,2 85 -12,3 84 -12,4 83 -12,5 82 -12,6 81 -12,7

01 0,1 02 0,2 03 0,3 04 0,4 05 0,5 06 0,6 07 0,7 08 0,8 09 0,9 0A 1,0 0B 1,1 0C 1,2 0D 1,3 0E 1,4 0F 1,5 10 1,6 11 1,7 12 1,8 13 1,9 14 2,0 15 2,1 16 2,2 17 2,3 18 2,4 19 2,5 1A 2,6 1B 2,7 1C 2,8 1D 2,9 1E 3,0 1F 3,1 20 3,2 21 3,3 22 3,4 23 3,5 24 3,6 25 3,7 26 3,8 27 3,9 28 4,0 29 4,1 2A 4,2 2B 4,3 2C 4,4 2D 4,5 2E 4,6 2F 4,7 30 4,8 31 4,9 32 5,0 33 5,1 34 5,2 35 5,3 36 5,4 37 5,5 38 5,6 39 5,7 3A 5,8 3B 5,9 3C 6,0 3D 6,1 3E 6,2 3F 6,3 40 6,4 41 6,5 42 6,6 43 6,7 44 6,8 45 6,9 46 7,0 47 7,1 48 7,2 49 7,3 4A 7,4 4B 7,5 4C 7,6 4D 7,7 4E 7,8 4F 7,9 50 8,0 51 8,1 52 8,2 53 8,3 54 8,4 55 8,5 56 8,6 57 8,7 58 8,8 59 8,9 5A 9,0 5B 9,1 5C 9,2 5D 9,3 5E 9,4 5F 9,5 60 9,6 61 9,7 62 9,8 63 9,9 64 10,0 65 10,1 66 10,2 67 10,3 68 10,4 69 10,5 6A 10,6 6B 10,7 6C 10,8 6D 10,9 6E 11,0 6F 11,1 70 11,2 71 11,3 72 11,4 73 11,5 74 11,6 75 11,7 76 11,8 77 11,9 78 12,0 79 12,1 7A 12,2 7B 12,3 7C 12,4 7D 12,5 7E 12,6 7F 12,7

cristidobrescu commented 1 year ago

Hi @brain-work @fraagol @KlosiakMK @scy , for offset the humidity command is FB following the value you provide? So, if my sensor shows 50% and I want to be 55%, I have to enter this offset value: FB32? Please help

EDIT: I managed to offste humidity value:

  1. Using this link https://codebeautify.org/decimal-hex-converter I type the value I want it: 10%
  2. Result an value "A"
  3. Using TelinkFlasher App I set the value FBA, send and than save
  4. that`s it
BSOD-beaver commented 1 year ago

I found useful this site: https://www.simonv.fr/TypesConvert/?integers 1) select decimal radio button 2) enter your decimal offset with sign 3) took HEX value from SINT8 (without 0x of course) 4) Put value right after FA or FB. f. e. I had 33% humidity on sensor. the right value is 27% I entered -6 and got 0xFA so i took FA and my offset command is FBFA don't forget to press Save current settings in flash or send DF command