GithubHelp home page GithubHelp logo

pvvx / atc_mithermometer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from atc1441/atc_mithermometer

2.7K 78.0 191.0 21.51 MB

Custom firmware for the Xiaomi Thermometers and Telink Flasher

Home Page: https://github.com/pvvx/pvvx.github.io/tree/master/ATC_MiThermometer

License: Other

Python 6.88% C 89.40% Makefile 0.53% Batchfile 0.12% Assembly 3.05% Dockerfile 0.02%

atc_mithermometer's Introduction

Custom firmware for BLE thermometers on the Telink chipset.

Warning: Firmware LYWSD03MMC version 2.1.1_0159 is temporarily not supported!

Please post questions about using and setting up Home Assistant integrations on the appropriate resources!

Next year (2024), a transition to modern Bluetooth SIG standards is planned. Linux has not supported Bluetooth open-standards since 2014. There is no point in waiting more than 10 years for progress in Linux. The path will sink into oblivion :).

This repository contains custom firmware for several Bluetooth Thermometer & Hygrometer devices. The download of the appropriate firmware for your device will be presented automatically in TelinkMiFlasher.html. Downloading files from this repository is not required. Alternative firmware and configurator from ATC1441 (variant ATC_Thermometer.bin) can be found here: atc1441/ATC_MiThermometer. Custom firmware is not supported in MiHome. But it is possible to work LYWSD03MMC with 'Xiaomi Gateway 3' by first registering in MiHome on the official firmware, flashing to custom firmware with restoring the binding key from MiHome, replacing the device name with "LYWSD03MMC" and setting the advertising type to "MIJIA (MiHome)" marked "encrypted".

Support for Zigbee firmware is in the ZigbeeTLc repository.

Support for BLE-Zigbee firmware is in the BZdevice repository.

There is an alternative firmware from Ivan Belokobylskij for LYWSD03MMC to work in Zigbee 3.0 mode.

The custom firmware can be flashed via a modern browser and over-the-air (OTA) without opening the device and unlocks several customization options. You can go back to the original firmware at any time. OTA and configuration main page - TelinkMiFlasher.html.

Key features

  • Extended battery life (over a year)
  • Improved measurement accuracy and extended format in 0.01 units
  • Full support Home Assistant 'BTHome integration', 'Passive BLE Monitor' and other.
  • Supports encrypted connections using PIN-code and encrypted bindkey beacon
  • Supports Bluetooth v5.0+ LE Long Range (LE 1M/2M/Coded 500K/125K), CSA1/CSA2 (Channel Selection Algorithm), Advertising Extensions: primary and secondary Coded PHY S=8, Connectable. LE Long Range - distance of 1 km in a straight line at TX +0 dB.
  • 3 LCD Display Screens (Looping): Temperature & Humidity & Comfort, Temperature & Battery Level, Clock
  • Measurement values recording & Charting. See Reading Measurements from Flash
  • Adjustable correction offsets and Comfort zones
  • Support for 4 beacon formats: Xiaomi, ATC, Custom, BTHome v2 and encrypted options. Legacy and Extended Advertisements.
  • Adjustable RF TX Power (-20..+10dB) & Bluetooth advertising interval. +3..+10 dB require a more powerful power supply.
  • DIY improvements - relay control by temperature or humidity, transmission of the reed switch status - open / closed or pulse counter
  • Firmware download support for Zigbee
  • Flashing third party Zigbee OTA files.
  • Support Low cost BLE Advertisements Repeater into Zigbee:

b2z.gif

Supported models:

  • Thermometers with display
Xiaomi Mijia (LYWSD03MMC) Xiaomi Miaomiaoce (MHO-C401) Qingping Temp & RH Monitor (CGG1-Mijia) CGDK2 Qingping Temp & RH Monitor Lite Xiaomi Mijia MJWSD05MMC MHO-C122 (2AWMOMHOC122)
Xiaomi Mijia (LYWSD03MMC) Xiaomi Miaomiaoce (MHO-C401) E-ink CGG1 'Qingping Temp & RH Monitor', Xiaomi Mijia DevID: 0x0B48 CGDK2 Qingping Temp & RH Monitor Lite Xiaomi Mijia (MJWSD05MMC) MHO-C122 (2AWMOMHOC122)
OTA OTA OTA OTA OTA Programmator
BLE and Zigbee BLE and Zigbee BLE BLE and Zigbee BLE BLE and Zigbee
  • Thermometers without display
Tuya ZigBee TS0201 TZ3000 Tuya ZigBee TH03Z
Programmator/Zigbee OTA, OTA Programmator/Zigbee OTA, OTA
BLE and Zigbee BLE and Zigbee
  • Tuya devices
Tuya devices on SoC PHY62x2
Tuya PHY62x2
PHY62x2BTHome

Warnings

  1. Home Assistant SSD TBW. Using the Home Assistant with Bluetooth leads to rapid wear of the data carrier due to constant database recording and overwriting of small Bluez files in '/var/lib/bluetooth/'.

With a couple dozen BLE devices, a 256GB SSD is only enough for 2 years.

  1. If you have many BLE devices, the adapter must be able to receive BLE advertisements every 3 ms.

UART speeds of 921600 baud and even USB1.1 are not enough to transfer information in binary form in the HCI format.

Requires BT adapter with USB2.0 HS. Otherwise, there will be many gaps in the reception. Do not use ESP32xxx - it cannot work with BLE at normal speed and drains the batteries of all BLE devices when connected! ESPHome does not work with Bluetooth 5.0 and misses a lot of advertising packets from BLE devices.

  1. For reliable connection and refirmware on LYWSD03MMC, the battery level must be more than 40%. This is a design feature - a cheaper version of the hardware from Xiaomi.

On devices with missing power capacities, do not set 'Connect latency' to more than 1000 ms!

  1. Home Assistant in "Bluetooth" integration does not full support Bluetooth 5.0 and is not implied.

How to switch the USB-BT5.0+ adapter to work in LE Long Range in Home Assistant under Linux:

On thermometers with a button, if the button function is set to Connect, then a short application on the button for 80 seconds enables connection in BT4.0 mode.

If you accidentally set the 'LE Long Range' on the thermometer, and your device does not support BT5.0, remove and insert the battery - the thermometer will switch to BT4.2 support mode.

If you have a smartphone with BT5.0+ and the nRFConnect program, then you can reset all settings to default by connecting to a thermometer and sending the 0x56 command, as shown in the screenshot:

img nRFConnect_set_default.png

To disable only the 'Long Range' option, use the code 0xDD.

The Web Bluetooth API in Chrome does not yet allow scanning for Bluetooh 5.0+ devices.

  1. On Linux, when installing large advertising intervals, change the file '/etc/bluetooth/main.conf', variables: LEScanIntervalAutoConnect= LEScanWindowAutoConnect=. Value in ms.

Table of content

Getting Started

You can conveniently flash, update and configure the bluetooth thermometers remotely using a bluetooth connection and a modern web browser.

Flashing or Updating the Firmware (OTA)

To flash or update the firmware, use a Google Chrome, Microsoft Edge or Opera Browser.

  1. Go to the Over-the-air Webupdater Page TelinkMiFlasher.html *
  2. If using Android, Windows, Linux: Ensure you enabled "experimental web platform features". Therefore copy the according link (i.e. chrome://flags/#enable-experimental-web-platform-features for Chrome), open a new browser tab, paste the copied URL. Now sten the Experimental Web Platform features flag to Enabled. Then restart the browser.
  3. For all sensors with a button, before activation, it is necessary to reset the past bindings by holding the button for a long time.
  4. In the Telink Flasher Page: Press Connect: The browser should open a popup with visible Bluetooth devices. Choose the according target device (i.e. LYWSD03MMC) to pair.
  5. After connection is established a Do Acivation button appears. Press this button to start the decryption key process.
  6. Now you can press the Custom Firmware ver x.x button to directly flash the custom firmware. Alternatively you can choose a specific firmware binary (i.e. the original firmware) via the file chooser
  7. Press Start Flashing.
  • Use TelinkOTA to flash old or alternative versions (ATC1441). This is a program for OTA projects with Telink SDK, no third-party (mijia) protections.

  • Addition for CGG1-M: Press and hold the button on the back of CGG1-M for 2 seconds until the Bluetooth icon starts blinking on the e-ink display, and then click the 'Connect' and 'Do Activation' buttons on the TelinkMiFlasherl.

  • Addition for MJWSD05MMC: Press and hold both buttons for a few seconds until the screen blink (device resets). Next, briefly press the top side button, then briefly press the bottom button. The Bluetooth icon will start flashing. Next 'Connect' and 'Do Activation' in TelinkMiFlasher.

Configuration

After you have flashed the firmware, the device has changed it's bluetooth name to something like ATC_F02AED. Using the TelinkMiFlasher.html you have various configuration options.

General process:

  1. Press Connect
  2. Select the according device to connect/pair (i.e. ATC_F02AED)
  3. Several configuration options appear
  4. Choose Send Config to send changed value to the device. Or press Set default and then Send config to revert to the Defaults
Option Description
Temperature and Humidity offset Enter a value to correct the offset of the Temperature or Humidity displayed: For example -1.4 will decrease the Temperature by 1.4°
Smiley or Comfort Choose a static smiley or check the "Comfort" Radio box to change the smiley depending on current Temperature and Humidity.
Comfort Parameters Defines the Lower (Lo) and Upper (Hi) Range for Temperature and Humidity interpreted as comfort zone. In the default configuration a smiley will appear.
Advertising Type Type of supported Bluetooth Advertising Formats.
Set time sends the current time to the device
Comfort, Show batt, Clock Ticking the according boxes you can enable interval rotation between different LCD screens. See the example video below.
  • For SHTC3 in "lowPower" the accuracy is reduced.
  • For SHT4x in "lowPower" you get a delay for the polling period, but the accuracy remains.

Example of LCD display modes

You can configure different LCD Display modes using Comfort, Show batt and Clock configuration checkboxes. The enabled LCD Display Modes will appear one-by-one in a loop.

YoutubeVideo

Battery and clock display are enabled in the settings. The rest of the settings is kept default. The video contains 2 cycles.

  1. Temperature and humidity
  2. Temperature and % of battery
  3. Temperature and humidity
  4. Hours and minutes

Firmware

Firmware Binaries

You can directly update/flash the firmware without downloading the binaries below.

Custom Firmware Versions:

The download of the appropriate firmware for your device will be presented automatically in TelinkMiFlasher.html. Downloading files from this repository is not required.

Original Manufacturer Firmware Version

In case you want to go back to the original firmware, you can download them here:

Firmware version history

Version Changes
1.2 Bind, Set Pin-code, Support MHO-C401
1.3 Get/Set comfort parameters
1.4 Get/Set device name, Get/Set MAC
1.5 Add Standard Device Information Characteristics
1.6 Fix alternation of Advertising in mi mode
1.7 Authorization and encryption in permissions to access GAP ATT attributes, if pin code is enabled
1.8 Time display (instead of a blinking smile)
1.9 Recording measurements to flash memory (cyclic buffer for 20000 measurements)
2.0 Recording measurements with averaging to flash memory
2.1 Periodic display refresh for MHO-C401
'Erase mi-keys' option to return to original firmware
2.2 Added parameter "Encrypted Mi Beacon"
2.3 Added "Delete all records"
2.4 Added parameter "Clock time step"
2.5 Remove TRG/FLG errors, minor optimization
2.6 Expanding the ranges of threshold parameters (TRG)
2.7 Reducing power consumption of MHO-C401 (EDP update), adding version for CGG1-M 2020-2021
2.8 Added saving bindkey to EEP if mi-keys are erased, reduced TX power to 0 dB for defaults
2.9 Added additional id flags to advertising packages
3.0 Added toggle support for advertising package structures for third-party software
3.1 Fix security attributes (for pincode)
3.2 Added new encrypted beacon formats, reed switch maintenance
3.3 Added autodetection for LYWSD03MMC hardware versions B1.6 and B1.9. For CGG1-M and MHO-C401 - autodetection of SHTV3 or SHT4x sensors
3.4 Correct Hardware Version Setting for LYWSD03MMC B1.7
3.5 Correction of moisture readings for SHT4x sensors. Rounding off sensor values on display.. Saving HW string B2.0 on LYWSD03MMC. Eliminated battery voltage noise in CGG1-M. CGG1 - correction of the battery charge display. Added CGDK2 and modified (DIY) variant of CGDK2-2.
3.6 Additional parameters: Support BT5.0 PHY, Channel Selection Algorithm 2, Correct RF-TX Power in suspend
3.7 Added format 'HA BLE', reed switch operation mode: Switch and Count. Full support for "HA BLE" encryption. Speed correction I2C for LCD controller LYWSD03MMC HW:1.9. Support for CGG1-M hardware version 2022.
3.8 Fix clear_memo, renaming 'HA BLE' format to 'BTHome'
3.9 Changed the calculation of battery readings in %, optimization of consumption for the solar battery when the voltage drops below 2V (deep-sleep), added option to invert event for reed switch, small optimizations.
4.0 Improved stability in connected mode. I2C bus CLK and PullUp correction.
4.1 Changed "connection latency" for stability in connected.
4.2 Option Increasing Communication Distance: Bluetooth 5.0 LE Long Range (Advertising Extensions: primary and secondary Coded PHY S=8, Connectable). Added support MHO-C401 (2022.11) and MJWSD05MMC. Added function key: Connect
4.3 Increasing the degree of averaging (x64) of the sent values over the battery. Added "Screen Off" option. Check LYWSD03MMC HW: B1.5. Added MHO-C122 (2AWMOMHOC122) test support. LCD display stabilization LYWSD03MMC HW:B1.9
4.4 Adding an option to display only external data. Only the value from the "EEP BindKey" is now taken as the BindKey.
4.5 Replacing BTHome ver1 (HA_BLE) with BTHome ver2. Moving firmware after recovery to BLE from Zigbee OTA. Fixed a bug where the date was not displayed correctly for MJWSD05MMC.
4.6 All thermometers support EXT OTA. Flashing third party Zigbee OTA files (*.zigbee).
4.7 Changing sensor settings: Added slope factor, zero offset in 0.01 units.

Applications

Reading Measurements from Flash

GraphMemo.html

To record the measurement results, a cyclic buffer in the flash memory for 20000 measurements is used. The recording step interval is set in the interface. With the default settings, the recording step is 10 minutes, which gives a recording depth of 4 and a half months. During the step period, the sensor data and battery voltage are averaged, time stamped, and written to flash memory.

Setting the value to 0 disable logging to internal storage.

FlashData

Reading Measurements in Connected Mode

GraphAtc.html GraphAtc1.html GraphAtc2.html DevPoint.html

GraphAtc_html

Reading Measurements in Advertising Mode

This requires the Experimental Web Platform Features flag enabled in your browser. See Flashing or Updating the Firmware (OTA).

Advertising.html

Technical specifications

Average power consumption

Xiaomi Mijia (LYWSD03MMC B1.4)

Using the default settings for advertising interval of 2.5 seconds and measurement interval of 10 seconds:

  • Bluetooth Advertisement: 14..15 uA 3.3V (CR2032 over 1 years)
  • Bluetooth Connection: 14..25 uA 3.3V (CR2032 over 10 months)

PowerAdvInt

PowerLife.gif

Xiaomi Mijia (MJWSD05MMC)

Using the default settings for advertising interval of 5 seconds and measurement interval of 20 seconds:

  • Bluetooth Advertisement: 19..21 uA 3.3V (CR2450 over 2 years)
  • Bluetooth Connection: 25..30 uA 3.3V (CR2450 over 1.5 years)

Xiaomi Miaomiaoce (MHO-C401)

Using the default settings for advertising interval of 2.5 seconds and measurement interval of 20 seconds:

Xiaomi Miaomiaoce (MHO-C401N)

Using the default settings for advertising interval of 2.5 seconds and measurement interval of 20 seconds:

  • Bluetooth Advertisement: 10..14 uA 3.3V (depends on the amount of temperature or humidity changes over time to display)
  • Bluetooth Connection: 13..17 uA 3.3V (depends on the amount of temperature or humidity changes over time to display)

Qingping (CGDK2)

Using the default settings for advertising interval of 2.5 seconds and measurement interval of 20 seconds:

  • Bluetooth Advertisement: 18..21 uA 3.3V
  • Bluetooth Connection: 23..30 uA 3.3V

Qingping (CGG1)

Using the default settings for advertising interval of 2.5 seconds and measurement interval of 20 seconds:

  • Bluetooth Advertisement: 12..16 uA 3.3V
  • Bluetooth Connection: 23..30 uA 3.3V

Qingping (CGG1N)

Using the default settings for advertising interval of 2.5 seconds and measurement interval of 10 seconds:

  • Bluetooth Advertisement: 12..16 uA 3.3V
  • Bluetooth Connection: 23..30 uA 3.3V

Bluetooth Advertising Formats

The Firmware can be configured to support one of four different Bluetooth advertisements data formats:

Xiaomi, ATC, Custom, BTHome and encrypted options.

Supports bindkey beacon encryption.

Advertising formats.

Test program of used Bluetooth Advertising formats provided by Ircama.

Only the BTHome and Xiaomi support the native HA Xiaomi Integration, for the others use the Custom Component Passive BLE.

atc1441 format:

UUID 0x181A - size 16 (temperature in 0.1 °C, humidity in 1 %): atc1441 format

Custom format (all data little-endian):

UUID 0x181A - size 19: Custom extended format in 0.01 units (all data little-endian):

uint8_t     size;   // = 18
uint8_t     uid;    // = 0x16, 16-bit UUID
uint16_t    UUID;   // = 0x181A, GATT Service 0x181A Environmental Sensing
uint8_t     MAC[6]; // [0] - lo, .. [6] - hi digits
int16_t     temperature;    // x 0.01 degree
uint16_t    humidity;       // x 0.01 %
uint16_t    battery_mv;     // mV
uint8_t     battery_level;  // 0..100 %
uint8_t     counter;        // measurement count
uint8_t     flags;  // GPIO_TRG pin (marking "reset" on circuit board) flags: 
                    // bit0: Reed Switch, input
                    // bit1: GPIO_TRG pin output value (pull Up/Down)
                    // bit2: Output GPIO_TRG pin is controlled according to the set parameters
                    // bit3: Temperature trigger event
                    // bit4: Humidity trigger event

'BTHome' format

The 'BTHome' format

Encrypted beacon formats (uses bindkey):

Xiaomi Battery Charge

  1. UUID 0xFE95 - 0x0A: Xiaomi - battery charge level 0..100%, battery voltage in mV

Xiaomi Temperature & Humidity

  1. UUID 0xFE95 - 0x0D: Xiaomi - temperature x0.1C, humidity x0.1%

Xiaomi Encrypted (bindkey enable)

  1. UUID 0xFE95 - 0x0A, 0x04, 0x06 Xiaomi - battery charge level 0..100%, temperature x0.1C, humidity x0.1% (All data are averaged over a period of 16 measurements)

Bluetooth Connection Mode

  • Primary Service - Environmental Sensing Service (0x181A):
  • Characteristic UUID 0x2A1F - Notify temperature x0.1C
  • Characteristic UUID 0x2A6E - Notify temperature x0.01C
  • Characteristic UUID 0x2A6F - Notify about humidity x0.01%
  • Primary Service - Battery Service (0x180F):
  • Characteristic UUID 0x2A19 - Notify the battery charge level 0..99%
  • Primary Service (0x1F10):
  • Characteristic UUID 0x1F1F - Notify, frame id 0x33 (configuring or making a request): temperature x0.01C, humidity x0.01%, battery charge level 0..100%, battery voltage in mV, GPIO-pin flags and triggers.

Temperature or humidity trigger (GPIO PA5 LYWSD03MMC label on the "reset" pin)

Xiaomi LYWSD03MMC has a PCB soldering test point. Available without disassembling the case and marked "Reset". Use as a trigger output with adjustable temperature and / or humidity hysteresis. Hysteresis and thresholds are set in TelinkMiFlasher.html. The output status is displayed in the advertising package.

trg_menu

trg_grf

Hysteresis:

  • =0 off,
  • if less than zero - activation on decrease,
  • if more than zero - activation on excess

Setting the pin to "1" or "0" works if both hysteresis are set to zero (TRG off).

OnOff

ESP01Relay

Trigger and reed switch status receiver on JDY-10 module ($1).

Reed switch or button functions

For CGG1, MHO_C401, CGDK2, MJWSD05MMC, a button on the case is used.

It is possible to solder a reed switch on the LYWSD03MMC board to the pins marked "P8" (GPIO PA6) and GND.

The button on the body can turn the light on and off when creating a scenario in an external program...

The state of the reed switch or button is transferred to the advertising packet and events are sent in the "Switch" and "Ccounter" modes.

Setting the "Connect" option has several functions:

  1. Short press for 80 seconds turns on the ability to connect with a device in BLE 4.2 format
  2. Long press toggles temperature display to C or F.
  3. Holding more than 20 seconds will reset the device settings to default.

Interface for receiving and displaying data on the LCD.

  • LCD shows:
  • Big number: -99.5..1999.5
  • Small number: -9..99
  • Smiley, battery, degrees
  • Setting the display time limit in sec

ShowData

The USB-COM adapter writes the firmware in explorer. Web version.

USBCOMFlashTx.html - Uses a partial imitation of the Telink 1-Wire protocol on a USB-UART adapter, but only for transmission to the chip.

For programming and debugging, the chip uses a special hardware protocol Telink 1-Wire (not even close to UART!).

To match the frequencies of the Telink 1-Wite bus, no change in Baud-rate is required.

While the chip is sleeping and when the SWS pin is reassigned, there is no access to programming.

You can restore communication via “Telink 1-Wire” by rebooting the chip and sending a command to stop the CPU. This is called "Activation".

The USBCOMFlashTx.html program does not have feedback - it does not receive data from the chip. This is a simplified version and only works if all connections are made correctly.

USBCOMFlashTxHtml

webpgm.png

In difficult cases, when the chip contains an unknown FW, it is necessary to use a chip reset or power supply during "activation".

atime.png

At the same time, take into account that the chip can be powered from the TX output. This is solved by connecting TX and +Vbat during "activation".

Alternative programmers:

  1. TLSR825xComFlasher.py - partial simulation of Telink 1-Wire on a USB-UART adapter.
  2. TlsrComProg - uses a bootloader with the transition to working via the UART protocol.
  3. TLSRPGM - full hardware option Telink 1-Wire up to 2 mbit/s

Chipset LYWSD03MMC HW:B1.4

  • TLSR8251F512ET24 (TLSR8258 in 24-pin TQFN). SoC: TC32 32-bit MCU 48Mhz, 64 KiB SRAM, 512 KiB Flash (GD25LE40C), Bluetooth 5.0: Mesh, 6LoWPAN, Zigbee, RF4CE, HomeKit, Long Range, Operating temperature: -40°C to +85°C, Power supply: 1.8V to 3.6V.
  • SHTV3 sensor. Measurement range: Temperature -40°C to +125°C, Humidity 0 to 100 %RH. Power supply: 1.8V to 3.6V
  • IST3055NA0 LCD controller

LYWSD03MMC B1.4 B1.5 BoardPinout

TabPins

For LYWSD03MMC, the HW version is determined by the display and sensor addresses on I2C:

HW LCD I2C addr SHTxxx I2C addr Note
B1.4 0x3C 0x70 (SHTC3)  
B1.5 UART 0x70 (SHTC3)  
B1.6 UART 0x44 (SHT4x)  
B1.7 0x3C 0x44 (SHT4x) Test original string HW
B1.9 0x3E 0x44 (SHT4x)  
B2.0 0x3C 0x44 (SHT4x) Test original string HW

Version 1.7 or 2.0 is determined at first run by reading the HW line written in Flash. Display matrices or controllers are different for all versions, except B1.7 = B2.0.

Building the firmware

Windows:

  1. Go to wiki.telink-semi.cn and get the IDE for TLSR8 Chips.
  2. Install the IDE and import the 'ATC_MiThermometer' project
  3. Compile the project

Ubuntu:

  git clone https://github.com/pvvx/ATC_MiThermometer.git
  cd ATC_MiThermometer
  make

Related Work

ATC_MiThermometer is based on the original work of @atc1441, who developed the initial custom firmware version and the web-based OTA flasher (Source).

Resources & Links

CJMCU-2557 BQ25570

CJMCU-2557

Control function ID when connected

Primary Service UUID 0x1F10, Characteristic UUID 0x1F1F

ID Command
0x01 Get/Set device name
0x02 Get address of internal devices
0x03 I2C scan
0x04 I2C Universal TRansaction (UTR)
0x10 Get/Set MAC
0x11 Get/Set Mi key: DevNameID
0x12 Get/Set Mi keys: Token & Bind
0x15 Get all Mi keys
0x16 Restore prev mi token & bindkeys
0x17 Delete all Mi keys
0x18 Get/set binkey in EEP
0x20 Get/Set comfort parameters
0x22 Get/Set show LCD ext.data
0x23 Get/Set Time
0x24 Get/set adjust time clock delta
0x33 Start/Stop notify measures in connection mode
0x35 Read memory measures
0x36 Clear memory measures
0x44 Get/Set TRG config
0x45 Set TRG output pin
0x4A Get/Set TRG data (not save to Flash)
0x55 Get/Set device config
0x56 Set default device config
0x5A Get/Set device config (not save to Flash)
0x60 Get/Set LCD buffer
0x61 Start/Stop notify LCD buffer
0x70 Set PinCode
0x71 Request Mtu Size Exchange
0x72 Set Reboot on disconnect
0x73 Extension BigOTA (MJWSD05MMC)
0xDD Reset LE Long Range mode

foto

atc_mithermometer's People

Contributors

atc1441 avatar bam80 avatar cabalist avatar fabje avatar ircama avatar jiayiliujiayi avatar jmav avatar michapr avatar osigida avatar popsodav avatar pvvx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

atc_mithermometer's Issues

What is the max Measure Interval value?

Ideally I only want a reading every 10 minutes to save battery drain from frequent measurements, but also to stop my DB and graphs getting clogged with data.

So I need a measure interval of 240 x 2500ms (default adv interval) = 10 mins

It seems you can only enter 2 digits, so I tried 99 and saved config, but it always resets to 10x
I've also tried 20x and 30x, but it resets.

Am I doing something wrong? I set the value and then click "Send Config" and the log output says it was successful.

edit: I'm using the OTA flasher and the v1.9 fw

edit2: ok, I see in app.c that values over 10 get set to 10.
Why is that, is there a limit elsewhere?
I tried to increase advertising interval, but I lost connection, so the actual maximum is 25~30 seconds (or 100 seconds if I increase adv int and accept I won't be able to connect again)

Blank screen after flashing version 1.6

Hi,

I don't know if I'm missing something.

Just tested version 1.6 of your firmware, coming from an ATC firmware.

Screen is blank although I get data in the browser and can set things.

I reflashed ATC latest FW back again and works fine. Did it twice to double check and I get consistent results. No data shown with your firmware. Also speed when reflasing is very low if protocol is set to all. Setting it to MI flashes quickly.

Thanks

No periodic display refresh for MHO-C401

Victor, first I'd like to commend you for the wonderful job that you did evolving ATC's code to support the EPD display of MHO-C401 too!

I've updated the firmware on one of my devices yestarday with the latest code for MHO-C401 and I have to say that I'm quite impressed with the result!

I noticed a small issue on first sight, but I think that it is subtle for the longevity of the e-ink display. Your code doesn't seem to perform periodic full refresh of the display (showing all black segements, followed by showing all white segments, background ones included), and this causes some minor "ghosting" of the white segments:

image

The device on the left is running with Xiaomi's original firmware, the one on the right is running your code. I'm not sure if it can be noticed on this photo, but from afar the white background of the display on the right appears a bit more gray-ish compared to the original one (left).

During my reverse-engineering sessions of the e-ink display of MHO-C401, I noticed that the original firmware performs a full refresh after 32 partial updates. Generally e-ink displays need to have full refresh performed from time to time in order to de-energise the pigmented particles, otherwise they seem to become "sticky" and harder to operate, which shortens the life of the EPD.

TX Power: What means VANT vs VBAT

When I try to set the TX power to any VBAT value (>+3.01), it reverts to VANT-25.18 dbm.
What does it means?
I need to increase the TX power to make the signal more stable. Any suggestion?

Thanks.

Not working with OpenMQTTGateway?

Is your version compatible with OpenMQTTGateway? Don't know what exactly is needed. Thought it is just (ATC) advertisement format, but could not get it working. Tried with standard setting and all advertisement formats. "Original" ATC is working just with custom format.

Advertising types?

Is there already a documentation of the different advertising types that are now possible

Doesn't stay connected

Hi,

I OTA-flashed the thermometer but used the act1441 web flasher. It works but cannot stay connected to the phone. Paired it with nRF Connect or act1441's web flasher or pvvx web flasher, it disconnects in 6-10 seconds. Cannot reflash it too 'cause if it disconnects while flashing (and for sure it does) it'll become bricked... Maybe some advices what to do?

xiaomi-thb.ino and temperature below 0

Hi, I've tested 1.2 Fw on my devices.
Seems that esp32 code doesn't manage negative temperature.

Here .ino debug:

`[D][BLEAdvertisedDevice.cpp:247] parseAdvertisement(): Type: 0x16 (), length: 17, data: 1a181477c638c1a4fcffda1cd10a3f9d0d

[D][BLEAdvertisedDevice.cpp:247] parseAdvertisement(): Type: 0x09 (), length: 10, data: 4154435f433637373134

[D][BLEAdvertisedDevice.cpp:407] setName(): - setName(): name: ATC_C67714

Found service '181a' data len: 19, 12161a181477c638c1a4fcffda1cd10a3f9d0d

MAC: 5 Temp: 655.32°, Humidity: 73.86%, Vbatt: 2769, Battery: 63%, flg: 0x0d, cout: 157
FEED: MAC a4c138c67714
temp 655.320007 humidity 73.860001 bat 2769.000000

Found service '181a' data len: 19, 12161a181477c638c1a4f4ff041dcb0a3eaf0d

MAC: 5 Temp: 655.24°, Humidity: 74.28%, Vbatt: 2763, Battery: 62%, flg: 0x0d, cout: 175
FEED: MAC a4c138c67714
temp 655.239990 humidity 74.279999 bat 2763.000000
`

proposal: broadcast with historical data

Hello pvvx,

I'm working and analyzing data received from 4 thermometers around my house.
I'd like to create a daily graph like GraphAtc, but in different way.

Eg:

`
struct HistoryData {
int16_t tempMin;
int16_t tempMax;
int16_t humMin;
int16_t humMax;

HistoryData values[24];

`
Data can be shifted every hour:

  • values[0] = current hour
  • values[1] = previous hour
    ..

Since I don't have experience with this processor, questions are:

  • cpu can manage in memory (no flash) 8*24 bytes ?
  • is it possible to manage time like avr ?
  • do you think it is possible to create a new broadcast or it is better that server take data when needed ?

Thank you

Help in configuration

Hello, thanks for this amazing job.
I would like to ask you a question about configuration.
I would like to configure the sensor to:

  • send data every 10 mins (I want to limit the bluetooth chip usage if temperature does not change)
  • send data if temperature changed 0.2°
  • send data if humidity changed 2%
  • measure normally to show in the LCD more frequently

Is this something I can do with your firmware?
thanks

Connection to the sensor is dropped with Custom Firmware Version 1.8

First of all thank you for you effort and very cool customisation options.

I have following problem, after I have flashed two LYWSD03MMC via TelinkMiFlasher.html a custom firmawer ATC_Thermometer18.bin. Everything was ok so far, I can also read the data from my home assisntant instance.
But if I try to connect again to the sensor TelinkMiFlasher.html the connection is dropped after few seconds and I cant do nothing. I have also few sensor with Custom Firmware Version 1.9, and the connection is stable.

Is there a workaround to solve this issue? Unfortunately I dont have any hardware for reflashing the sensors.

[Feature Request] Show time instead of temperature

Hi,

I'm using LYWSD03MMC mostly as integrations in home-asisstant, so i'm watching for temperature / humidity on dashboards.
It would be much convenient to show time on actual device instead of temperature.

Is it possible to do ?

It can be synced with browser manually using TelinkFlasher (or yours) interface.

Thank you.

OTA flashing takes very long

Thanks for your effort on improving ATC's awesome work even further.

I just updated one of my thermometers to your version 1.1. The previous installed firmware was ATC's custom firmware.

It took around 50 MINUTES to flash the complete firmware. I'm not sure if that's related to the running custom firmware, the web-flasher or something else.

I used a 2017 MBP, Big Sur, Chrome 87 (same setup as when I flashed ATCs firmware). The thermometer had a distance of 30cm to the computer.

I haven't tried flashing the others yet, because I still have to test the new firmware a bit.

Here is the log:

Log:
08:56:34: Searching for devices
08:56:47: Connecting to: ATC_7B4211
08:56:50: Detected custom Firmware
08:57:18: File was selected, size: 48816 bytes
08:57:18: Count: 3051
08:57:25: Start DFU
09:46:06: Update done after 2919.46 seconds
09:46:13: Disconnected.

Console (last lines only):

TelinkMiFlasher.html:609 Status: Sending block nr: 3044 from 3051, 99% done, time since start 2911.411s
TelinkMiFlasher.html:609 OTA: e40bc2a5000004a6000028a600004aa600001a91
TelinkMiFlasher.html:609 Status: Sending block nr: 3045 from 3051, 99% done, time since start 2911.413s
TelinkMiFlasher.html:609 OTA: e50b6aa6000092a6000052a8000082a800008b63
TelinkMiFlasher.html:609 Status: Sending block nr: 3046 from 3051, 99% done, time since start 2911.415s
TelinkMiFlasher.html:609 OTA: e60b52a80000f4a800001ca90000c4a900008b65
TelinkMiFlasher.html:609 Status: Sending block nr: 3047 from 3051, 99% done, time since start 2911.417s
TelinkMiFlasher.html:609 OTA: e70b52a80000cea90000faa900001caa0000c2ff
TelinkMiFlasher.html:609 reading OTA
TelinkMiFlasher.html:609 Status: Sending block nr: 3048 from 3051, 99% done, time since start 2919.451s
TelinkMiFlasher.html:609 OTA: e80b44aa000052a8000068a8000068a8000008af
TelinkMiFlasher.html:609 Status: Sending block nr: 3049 from 3051, 99% done, time since start 2919.454s
TelinkMiFlasher.html:609 OTA: e90b68a80000ffffffffffffffffffffffff30af
TelinkMiFlasher.html:609 Status: Sending block nr: 3050 from 3051, 99% done, time since start 2919.456s
TelinkMiFlasher.html:609 OTA: ea0bffffffff02000000010000002856443ba463
TelinkMiFlasher.html:609 OTA: 02ffea0b15f4

Proposal - calculating showing dew point and absolute humidity

First of all: What Aaron initiated and you made even more valuable is one of the coolest hack I've seen so far.
Chapeau!
I play a lot with environmental sensors. A very precise measuring SHT85 from Sensirion is in one of my ESP32 gadgets.
Temperature and humidity are shown. I also calculate the dew point and the absolute humidity which is probably of better value than the relative humidity measured by the sensor.
They can easily be calculated from temperature and relative humidity. Wouldn't this be a nice enhancement to show these maybe alternating
ESP32_SHT85
?

Not connected for configuration

Latest firmware 2.3
What can I do?


19:29:24: Connecting to: ATC_24CECE
19:29:57: NotFoundError: No Services matching UUID 00010203-0405-0607-0809-0a0b0c0d1912 found in Device.
19:29:57: Reconnect 1 from 5
19:29:57: NotFoundError: No Services matching UUID 00010203-0405-0607-0809-0a0b0c0d1912 found in Device.
19:29:57: Reconnect 2 from 5
19:29:57: NotFoundError: No Services matching UUID 00010203-0405-0607-0809-0a0b0c0d1912 found in Device.
19:29:57: Reconnect 3 from 5
19:29:57: NotFoundError: No Services matching UUID 00010203-0405-0607-0809-0a0b0c0d1912 found in Device.
19:29:57: Reconnect 4 from 5
19:29:57: NotFoundError: No Services matching UUID 00010203-0405-0607-0809-0a0b0c0d1912 found in Device.
19:29:57: Reconnect 5 from 5
19:29:57: NotFoundError: No Services matching UUID 00010203-0405-0607-0809-0a0b0c0d1912 found in Device.
19:29:57: Something went wrong, to many reconnect's

iBeacon?

Hi victor,

strikes me that this hardware is so cheap in comparison to any form of 'iBeacon' that an iBeacon mode may be a useful addition.
I'm not sure what make something an 'iBeacon', but I'm guessing that the main features would be a known (and stable) tx power (and possibly adjustable?) included with the data. And for 'true' iBeacon functionality, an (additional?) advert in iBeacon format?

Possible applications:
Carry it with you for person location within the house.
Using a number of fixed location units for internal robot positioning (e.g. now the ESP32 seems more stable for BLE).
(indeed, use outside in even a large garden for external robot location).

questions that may need to answered:
How stable is the tx power with waking from sleep, etc. and battery condition?
How often does a 'normal' iBeacon advertise & affect on battery life?

For the adventurous, people could even upgrade to 3.3v power - I read somewhere that with 3.3v, the txpower can be higher....

thoughts?

s

p.s. another 'stupid' idea - I'm on the verge of completing the new BLE drivers for Tasmota. One of the features that I put in is to use the MAC from the advert data rather than the advert source for sensor identification. The effect being that theoretically adverts could be heard by one unit, and forwarded on to be heard by a more remote Tasmota - a bit like a sensor mesh. I'm assuming that this hardware would be capable of hearing advertisements, but that battery drain would be significant with radio reception being on all the time. The only advantage of having an 03mmc do the forwarding is that it is nicely packaged and batter powered, so it MAY be advantageous even if the battery only lasted 3 months. If the battery only lasted 2 weeks, another matter (unless 2 x AA are used instead...). Sorry to put two things in one issue!

Strange readings

I used your .bin file to update and now I get very strange readings compared to Aaron's. xx:xx:xx is your firmware and yy:yy:yy is Aaron's. Both are configured to used Custom and not MiLike and details on screen are showing correctly. Any thoughts?

2021-01-02 14:13:44 - Device: A4:C1:38:xx:xx:xx Temp: 1280.8c Humidity: 253% Batt: 16%
2021-01-02 14:13:49 - Device: A4:C1:38:yy:yy:yy Temp: 20.6c Humidity: 48% Batt: 92%

Question: Power consumption vs. Original Xiaomi firmware (LYWSD03MMC)

Victor, trying to understand all the graphs and power consumption. If I use the default settings of your firmware, am I right in thinking this use more power than the original Xiaomi formware even when connecting to the device every 5 minutes (for example). Any ideas on the battery life expected using the original firmware on the LYWSD03MMC?

No issue, need explanation regarding intervals and battery consumption

Hi, I flashed the software on 3 LYWSD03MMC. Its working well, but Im not an expert so Im kind of lost when trying to optimize life battery.

  • Advertising interval is 2500, this is milliseconds? Can I increase this as much as I want? Like I only need 5 minutes updates

  • What happen when the option Sensor in "Low Power mode" is active?

  • I understand The RF TX Power is the strength of the signal, can I lower it making sure the signal is received by my ble host? (rasp w)

Thanks for the help, nice work!

[Feature Request]: some way to identify device at power on

When you have lots of the same devices it very hard to differentiate between them. The old atc1441 firmware displayed the last 3 blocks of the MAC address on startup and this was very helpful.

Is there some way this feature could be reimplimented? Or something to provide similar ability to identify units

Showing NaN

I have flashed 4 thermometers with this tool which works great, but I think I need some suggestions in the parameters to set while flashing.
Randomly, the thermometers, starts to show NaN to my Home Assistant instance, I believe they lost connection. It's not a range issue, since atm, one thermometers just 20cm above the usb bluetooth key is showing NaN, while one other two rooms far is showing the correct temperature.
What can cause this issue? Should I increase the range via the flasher tool? Attaching a screenshot for reference.

Screenshot 2021-01-26 at 09 32 29

LowPower mode and RF TX Power

What a brilliant evolution of atc1441's project! Very happy with the new developments.

I have about 20 of these installed at various off-site locations and want to find a balance between sufficient temp/hum/bat updates and battery life.

Also some locations have quite a few signal blockers between the sensor and the esp32 dev board (receiving the BLE signal), so want to make sure that we're getting at least a decent signal as well.

Any suggestions for fine-tuning?

Can't build

I'm trying to build with this environment: https://github.com/AlmightyFrog/BuildEnvironmentATCMiThermometer

Result:
./01_make.sh
rm -f ./out/application/app/usbaud.o ./out/application/app/usbcdc.o ./out/application/app/usbkb.o ./out/application/app/usbmouse.o ./out/application/keyboard/keyboard.o ./out/application/print/putchar.o ./out/application/print/u_printf.o ./out/application/usbstd/usb.o ./out/application/usbstd/usbdesc.o ./out/application/usbstd/usbhw.o ./out/common/breakpoint.o ./out/common/log.o ./out/common/selection_sort.o ./out/common/string.o ./out/common/utility.o ./out/drivers/8258/adc.o ./out/drivers/8258/aes.o ./out/drivers/8258/analog.o ./out/drivers/8258/audio.o ./out/drivers/8258/bsp.o ./out/drivers/8258/clock.o ./out/drivers/8258/emi.o ./out/drivers/8258/flash.o ./out/drivers/8258/gpio_8258.o ./out/drivers/8258/i2c.o ./out/drivers/8258/lpc.o ./out/drivers/8258/qdec.o ./out/drivers/8258/rf_pa.o ./out/drivers/8258/s7816.o ./out/drivers/8258/spi.o ./out/drivers/8258/timer.o ./out/drivers/8258/uart.o ./out/drivers/8258/watchdog.o ./out/vendor/common/blt_common.o ./out/vendor/common/blt_fw_sign.o ./out/vendor/common/blt_led.o ./out/vendor/common/blt_soft_timer.o ./out/vendor/common/tl_audio.o ./out/tinyFlash/tinyFlash.o sizedummy ./out/ATC_Thermometer.elf ./out/../ATC_Thermometer.bin ./out/ATC_Thermometer.lst

mkdir -p ./out/application/app ./out/application/keyboard ./out/application/print ./out/application/usbstd ./out/application/TLV_Flash ./out/common ./out/drivers/8258 ./out/vendor/common ./out/tinyFlash

Building file: ../../SDK/components/application/app/usbaud.c
In file included from ../../SDK/components/application/app/../../common/config/user_config.h:25:0,
from ../../SDK/components/application/app/usbaud.c:22:
../../SDK/components/application/app/../../common/config/../../vendor/common/user_config.h:25:24: fatal error: app_config.h: No such file or directory
compilation terminated.
make: *** [../../SDK/make/application.mk:24: out/application/app/usbaud.o] Error 1

C401 fw - error correction

Hi,

I'm testing the latest version (12) for 401 - it is working great, thanks!
Energy usage is minimal, so now the device can be used as expected ;)

Only one thing - I have got within the last 24hours 3 wrong results of temp/hum (>200 each).
Had it never before with atc or your older fw.
Possible any wakeup issue?

Maybe you can add a simple check before sending? temp <100 and hum<100 ?
I think it is a simple way...

Thanks again!

Michael

PS: I would recommend to set the comfort smiley as default in the bin ;)

Humidity offset

Adjusting the humidity offset:
in the web flasher causes e.g. a change of 5 x 0.1% a change on the sensor of 5%.

Domoticz

Hello,

What a great job, thanks !!
Not an issue but a request.

I try to use [mijia sensor domoticz]. It works with original firmware but not with yours. It can't connect to the device.

I think there is something to change in the code in "mitemp2_bt_poller.py" file like "_HANDLE_READ_BATTERY_LEVEL = 0x001B" and in "domoticz_mijaa.py" but i'm completely newbie...

Could you help to find the correct changes ?

Regards

Unable to connect anymore to LYWSD03MMC after changing Advertising interval

Hello,

I set "Advertising interval" to 10000 (I did it on 2 devices) and now I'm unable to connect anymore to the thermometers (via TelinkMiFlasher).
Is there any way to reset settings of the thermometer with firmware version 1.6? I tried to short reset pins but with no effect.

Thank in advance for your help,
Best Regards

[Q] Data format documentation?

Hi Victor,
if I understand correctly, you've introduced a "custom" format for advertising the data in addition to the initial ATC1441 format while sharing the same UUID for it.

I'm using this script for receiving the data and forward it to MQTT: https://github.com/JsBergbau/MiTemperature2

This script messed up with the 19 byte data when sent along with the initial 16 byte format from @atc1441 . Meanwhile the author of the script included a fix which filters out the (additional) 19 byte data. This means, if you set format to All or ATC1441, in your firmware the script decodes correctly the 16 byte variant of the broadcast. Good so far...

BUT: If someone want to leverage the addtional information you broadcast (eg. the battery level in addtion to the voltage ;-) ), a more precise documentation of your data format will be appreciated ;-)

Mind sharing your custom format similar to how atc1441 did, like:


> The format of the advertising data is as follow:
> Byte 5-10 MAC in correct order
> Byte 11-12 Temperature in int16
> Byte 13 Humidity in percent
> Byte 14 Battery in percent
> Byte 15-16 Battery in mV uint16_t
> Byte 17 frame packet counter

... adopted to your format?

Many thanks!

Incorrect negative temperature values retrieved using GetMemo

Hi @pvvx,
thank you for this great fork of the Aaron's work!

I was playing around and found out that the GetMemo returns incorrect values for negative temperatures, see log below.

Temperature received by normal advertising looks fine (-4°C), but temperature from memory is at about 171°C. One would almost say, that simply adding the magic constant 175 from the datasheet of Sensirion would solve this 😄

Any ideas what could be the cause?

Logs
Send cmd ok
TelinkMiFlasher.html:810 Vbat: 2546 mV , Temp: -4.12°C, Humi: 56.27%, Count: 53, flg: 22
TelinkMiFlasher.html:810 Send cmd GetMemo: (3532000000)...
TelinkMiFlasher.html:814 Send cmd GetMemo ok
TelinkMiFlasher.html:814 2021-02-12 21:44:28 # Vbat: 2541 mV , Temp: 170.67°C, Humi: 56.71%, Count: 1
TelinkMiFlasher.html:814 2021-02-12 21:34:27 # Vbat: 2542 mV , Temp: 170.78°C, Humi: 56.72%, Count: 2
TelinkMiFlasher.html:814 2021-02-12 21:24:26 # Vbat: 2542 mV , Temp: 170.82°C, Humi: 56.62%, Count: 3
TelinkMiFlasher.html:814 2021-02-12 21:14:25 # Vbat: 2547 mV , Temp: 170.9°C, Humi: 56.45%, Count: 4
TelinkMiFlasher.html:814 2021-02-12 21:04:24 # Vbat: 2546 mV , Temp: 170.95°C, Humi: 56.34%, Count: 5
TelinkMiFlasher.html:814 2021-02-12 20:54:24 # Vbat: 2544 mV , Temp: 171.03°C, Humi: 56.17%, Count: 6
TelinkMiFlasher.html:814 2021-02-12 20:44:23 # Vbat: 2542 mV , Temp: 171.11°C, Humi: 56.08%, Count: 7
TelinkMiFlasher.html:814 2021-02-12 20:34:23 # Vbat: 2543 mV , Temp: 171.15°C, Humi: 55.91%, Count: 8
TelinkMiFlasher.html:814 2021-02-12 20:24:22 # Vbat: 2545 mV , Temp: 171.22°C, Humi: 55.84%, Count: 9
TelinkMiFlasher.html:814 2021-02-12 20:14:21 # Vbat: 2540 mV , Temp: 171.35°C, Humi: 55.5%, Count: 10
TelinkMiFlasher.html:814 2021-02-12 20:04:20 # Vbat: 2523 mV , Temp: 171.4°C, Humi: 55.15%, Count: 11
TelinkMiFlasher.html:814 2021-02-12 19:54:20 # Vbat: 2537 mV , Temp: 171.46°C, Humi: 54.96%, Count: 12
TelinkMiFlasher.html:814 2021-02-12 19:44:19 # Vbat: 2594 mV , Temp: 171.52°C, Humi: 54.56%, Count: 13
TelinkMiFlasher.html:814 2021-02-12 19:34:19 # Vbat: 2547 mV , Temp: 171.63°C, Humi: 54.13%, Count: 14
TelinkMiFlasher.html:814 2021-02-12 19:24:16 # Vbat: 2543 mV , Temp: 171.75°C, Humi: 53.8%, Count: 15
TelinkMiFlasher.html:814 2021-02-12 19:14:15 # Vbat: 2556 mV , Temp: 171.79°C, Humi: 53.42%, Count: 16
TelinkMiFlasher.html:814 2021-02-12 19:04:15 # Vbat: 2581 mV , Temp: 171.78°C, Humi: 53.1%, Count: 17
TelinkMiFlasher.html:814 2021-02-12 18:54:15 # Vbat: 2592 mV , Temp: 171.83°C, Humi: 52.77%, Count: 18
TelinkMiFlasher.html:814 2021-02-12 18:44:11 # Vbat: 2595 mV , Temp: 171.92°C, Humi: 52.44%, Count: 19
TelinkMiFlasher.html:814 2021-02-12 18:34:07 # Vbat: 2603 mV , Temp: 172.05°C, Humi: 51.9%, Count: 20
TelinkMiFlasher.html:814 2021-02-12 18:24:03 # Vbat: 2602 mV , Temp: 172.23°C, Humi: 51.26%, Count: 21
TelinkMiFlasher.html:814 2021-02-12 18:14:00 # Vbat: 2589 mV , Temp: 172.39°C, Humi: 50.44%, Count: 22
TelinkMiFlasher.html:814 2021-02-12 18:03:56 # Vbat: 2590 mV , Temp: 172.5°C, Humi: 49.76%, Count: 23
TelinkMiFlasher.html:814 2021-02-12 17:53:52 # Vbat: 2572 mV , Temp: 172.66°C, Humi: 48.75%, Count: 24
TelinkMiFlasher.html:814 2021-02-12 17:43:49 # Vbat: 2573 mV , Temp: 172.94°C, Humi: 47.88%, Count: 25
TelinkMiFlasher.html:814 2021-02-12 17:33:45 # Vbat: 2584 mV , Temp: 173.19°C, Humi: 47.21%, Count: 26
TelinkMiFlasher.html:814 2021-02-12 17:23:41 # Vbat: 2578 mV , Temp: 173.47°C, Humi: 46.5%, Count: 27
TelinkMiFlasher.html:814 2021-02-12 17:13:38 # Vbat: 2576 mV , Temp: 173.85°C, Humi: 45.37%, Count: 28
TelinkMiFlasher.html:814 2021-02-12 17:03:34 # Vbat: 2580 mV , Temp: 174.35°C, Humi: 44.41%, Count: 29
TelinkMiFlasher.html:814 2021-02-12 16:53:30 # Vbat: 2589 mV , Temp: 0.32°C, Humi: 43.11%, Count: 30
TelinkMiFlasher.html:814 2021-02-12 16:43:26 # Vbat: 2591 mV , Temp: 0.64°C, Humi: 42.58%, Count: 31
TelinkMiFlasher.html:814 2021-02-12 16:33:22 # Vbat: 2587 mV , Temp: 0.39°C, Humi: 42.43%, Count: 32
TelinkMiFlasher.html:814 2021-02-12 16:23:19 # Vbat: 2586 mV , Temp: 0.36°C, Humi: 42.31%, Count: 33
TelinkMiFlasher.html:814 2021-02-12 16:13:15 # Vbat: 2586 mV , Temp: 0.43°C, Humi: 42.3%, Count: 34
TelinkMiFlasher.html:814 2021-02-12 16:03:11 # Vbat: 2588 mV , Temp: 0.56°C, Humi: 42.47%, Count: 35
TelinkMiFlasher.html:814 2021-02-12 15:53:07 # Vbat: 2591 mV , Temp: 0.86°C, Humi: 42.13%, Count: 36
TelinkMiFlasher.html:814 2021-02-12 15:43:04 # Vbat: 2590 mV , Temp: 0.9°C, Humi: 41.82%, Count: 37
TelinkMiFlasher.html:814 2021-02-12 15:33:00 # Vbat: 2590 mV , Temp: 0.9°C, Humi: 40.58%, Count: 38
TelinkMiFlasher.html:814 2021-02-12 15:22:56 # Vbat: 2592 mV , Temp: 0.98°C, Humi: 40.6%, Count: 39
TelinkMiFlasher.html:814 2021-02-12 15:12:53 # Vbat: 2594 mV , Temp: 1.19°C, Humi: 39.57%, Count: 40
TelinkMiFlasher.html:814 2021-02-12 15:02:49 # Vbat: 2596 mV , Temp: 1.43°C, Humi: 40.38%, Count: 41
TelinkMiFlasher.html:814 2021-02-12 14:52:45 # Vbat: 2597 mV , Temp: 1.52°C, Humi: 40.57%, Count: 42
TelinkMiFlasher.html:814 2021-02-12 14:42:41 # Vbat: 2595 mV , Temp: 1.45°C, Humi: 40.64%, Count: 43
TelinkMiFlasher.html:814 2021-02-12 14:32:37 # Vbat: 2595 mV , Temp: 1.43°C, Humi: 39.92%, Count: 44
TelinkMiFlasher.html:814 2021-02-12 14:22:33 # Vbat: 2598 mV , Temp: 1.63°C, Humi: 40.69%, Count: 45
TelinkMiFlasher.html:814 2021-02-12 14:12:29 # Vbat: 2600 mV , Temp: 1.89°C, Humi: 41.43%, Count: 46
TelinkMiFlasher.html:814 2021-02-12 14:02:25 # Vbat: 2598 mV , Temp: 1.88°C, Humi: 41.36%, Count: 47
TelinkMiFlasher.html:814 2021-02-12 13:52:22 # Vbat: 2599 mV , Temp: 1.82°C, Humi: 39.65%, Count: 48
TelinkMiFlasher.html:814 2021-02-12 13:42:18 # Vbat: 2604 mV , Temp: 2.22°C, Humi: 40.15%, Count: 49
TelinkMiFlasher.html:814 2021-02-12 13:32:14 # Vbat: 2604 mV , Temp: 2.3°C, Humi: 40.94%, Count: 50
TelinkMiFlasher.html:810 Memo end: 0
TelinkMiFlasher.html:810 Vbat: 2533 mV , Temp: -4.13°C, Humi: 56.2%, Count: 54, flg: 22
TelinkMiFlasher.html:810 Vbat: 2539 mV , Temp: -4.14°C, Humi: 56.11%, Count: 55, flg: 22

[Feature request] Support for CGG1 possible?

Hello, great firmware / solution you have build. Works perfectly - love it on my LYWSD03MMC.
Incredible what is possible and how a commercial product can be made so much better! Thank you!

I´m wondering if it was possible to add the CGG1 model. It seems to use the same type of encrypted advertisement in recent FW, but has a very nice e-paper display with low energy consumption.
Link to respective model here: www.aliexpress.com/item/1000008051178.html

Would love to see that supported. Thanks again for making and documenting all this for us.

Regards - MacSass

nodered function

var payload = msg.payload;

if(payload.address.startsWith("a4:c1:38") &&
  payload.advertisement.localName.startsWith("ATC_")) {
    var buffer = payload.advertisement.serviceData[0].data;
    var mac = payload.address

  
    if(buffer.length >= 15 && payload.advertisement.serviceData[0].uuid == "181a") { // pvvx
        msg.payload = {
        "mac": mac,
        "temperature": buffer.readIntLE(6, 2) / 100.0,
        "humidity": buffer.readIntLE(8, 2) / 100.0,
        "battery": buffer.readIntLE(12, 1),
        "vbat": buffer.readIntLE(10, 2)/ 1000.0
    };	
       return msg;	       
    }
}
return null;

Battery level on MI advertising mode

Hi,

First I want to thank your amazing work on this.

I have some of this devices (LYWSD03MMC) on my home connected to HomeAssistant using ESPHome.

I installed this firmware and configured MI advertising mode.
I get values for temperature and humidity but do not receive updates for battery level.

Looking at https://pvvx.github.io/ATC_MiThermometer/Advertising.html I get this values:

15:32:40: Watching advertisements from "ATC_5FF9B6"...
15:32:58: ServiceData Data: 0000fe95-0000-1000-8000-00805f9b34fb, 50305B051FB6F95F38C1A40D1004B800B102
15:32:58: MAC: A4C1385FF9B6, Count: 31, Temp: 18.4°C, Humi: 68.9%
15:32:58: ServiceData Data: 0000fe95-0000-1000-8000-00805f9b34fb, 50305B051FB6F95F38C1A40D1004B800B102
15:32:58: MAC: A4C1385FF9B6, Count: 31, Temp: 18.4°C, Humi: 68.9%
15:33:59: ServiceData Data: 0000fe95-0000-1000-8000-00805f9b34fb, 50305B0525B6F95F38C1A40D1004B700B102
15:33:59: MAC: A4C1385FF9B6, Count: 37, Temp: 18.3°C, Humi: 68.9%
15:33:59: ServiceData Data: 0000fe95-0000-1000-8000-00805f9b34fb, 50305B0525B6F95F38C1A40D1004B700B102
15:33:59: MAC: A4C1385FF9B6, Count: 37, Temp: 18.3°C, Humi: 68.9%
15:35:49: ServiceData Data: 0000fe95-0000-1000-8000-00805f9b34fb, 50305B0530B6F95F38C1A40D1004B800B102
15:35:49: MAC: A4C1385FF9B6, Count: 48, Temp: 18.4°C, Humi: 68.9%
15:35:49: ServiceData Data: 0000fe95-0000-1000-8000-00805f9b34fb, 50305B0530B6F95F38C1A40D1004B800B102
15:35:49: MAC: A4C1385FF9B6, Count: 48, Temp: 18.4°C, Humi: 68.9%
15:36:10: ServiceData Data: 0000fe95-0000-1000-8000-00805f9b34fb, 50305B0532B6F95F38C1A40D1004B800B102
15:36:10: MAC: A4C1385FF9B6, Count: 50, Temp: 18.4°C, Humi: 68.9%
15:36:10: ServiceData Data: 0000fe95-0000-1000-8000-00805f9b34fb, 50305B0532B6F95F38C1A40D1004B800B102
15:36:10: MAC: A4C1385FF9B6, Count: 50, Temp: 18.4°C, Humi: 68.9%
15:36:27: ServiceData Data: 0000fe95-0000-1000-8000-00805f9b34fb, 50305B0534B6F95F38C1A40D1004B800B102
15:36:27: MAC: A4C1385FF9B6, Count: 52, Temp: 18.4°C, Humi: 68.9%
15:36:27: ServiceData Data: 0000fe95-0000-1000-8000-00805f9b34fb, 50305B0534B6F95F38C1A40D1004B800B102
15:36:27: MAC: A4C1385FF9B6, Count: 52, Temp: 18.4°C, Humi: 68.9%
15:36:57: ServiceData Data: 0000fe95-0000-1000-8000-00805f9b34fb, 50305B0537B6F95F38C1A40D1004B800B102
15:36:57: MAC: A4C1385FF9B6, Count: 55, Temp: 18.4°C, Humi: 68.9%
15:36:57: ServiceData Data: 0000fe95-0000-1000-8000-00805f9b34fb, 50305B0537B6F95F38C1A40D1004B800B102
15:36:57: MAC: A4C1385FF9B6, Count: 55, Temp: 18.4°C, Humi: 68.9%
15:37:17: ServiceData Data: 0000fe95-0000-1000-8000-00805f9b34fb, 50305B0539B6F95F38C1A40D1004B800B102
15:37:17: MAC: A4C1385FF9B6, Count: 57, Temp: 18.4°C, Humi: 68.9%
15:37:17: ServiceData Data: 0000fe95-0000-1000-8000-00805f9b34fb, 50305B0539B6F95F38C1A40D1004B800B102
15:37:17: MAC: A4C1385FF9B6, Count: 57, Temp: 18.4°C, Humi: 68.9%
15:37:40: ServiceData Data: 0000fe95-0000-1000-8000-00805f9b34fb, 50305B053BB6F95F38C1A40D1004B800B102
15:37:40: MAC: A4C1385FF9B6, Count: 59, Temp: 18.4°C, Humi: 68.9%
15:37:40: ServiceData Data: 0000fe95-0000-1000-8000-00805f9b34fb, 50305B053BB6F95F38C1A40D1004B800B102
15:37:40: MAC: A4C1385FF9B6, Count: 59, Temp: 18.4°C, Humi: 68.9%
15:37:43: ServiceData Data: 0000fe95-0000-1000-8000-00805f9b34fb, 50305B053BB6F95F38C1A40D1004B800B102
15:37:43: MAC: A4C1385FF9B6, Count: 59, Temp: 18.4°C, Humi: 68.9%
15:37:43: ServiceData Data: 0000fe95-0000-1000-8000-00805f9b34fb, 50305B053BB6F95F38C1A40D1004B800B102
15:37:43: MAC: A4C1385FF9B6, Count: 59, Temp: 18.4°C, Humi: 68.9%

Shouldn't be there advertising data for battery also?

Thanks again!

Marco

Test it

Hi i have some of this thermomethers, i have all of them with the ATC firm.

How can i test / upload yours?

i can't find your flasher url to try it

OTA flashing with this version ?

Hi, just became aware of this version firmware.
To clarify, in the repo's 'About' info it only mentions USB-Serial hard wired flashing for this firmware, does this mean it can not be flashed over the air like the ATC1441 version ?
Thanks.

external sensor?

Just wondering, have you looked at the possibility of using an external sensor? I'm thinking about monitoring a fridge having the display on the outside, while sensing the inside temperature.

OTA update

I have used your repo again ;) - complete sync from TODAY in the morning.
Have you tried the OTA firmware update? I have some problems here (using your flasher page)
At first flashed from original FW to your current release - all fine.
Then have changed the frequency to 16MHz, tried to update via OTA.

...
12:14:13: Detected custom Firmware
12:14:15: Start DFU
12:14:21: Update error: NotSupportedError: GATT operation failed for unknown reason.

After beginning with upload upload is stopped.
After that device is "dead".
I must use serial update (python) with new compiled FW, then is all again ok. Tried two times, same result.
Any idea? ;)

bad readings with tasmota32 with advertising type all or custom

I have upgraded my LYWSD03MMC sensors (there are 10 of them) to your firmware (originally either the Xiaomi or atc1441 firmware) and now Im getting a really wierd mis reading when using tasmota32 v9.2.0 using internal BLE.

I get a duplicate sensor with very wrong temperature & dewpoint readings eg

Temp 3021.6 °C
Humidity 40.0 %
Dew point 1680.2 °C
Battery 12 %
clearly wrong

And the mac address is backwards eg it reverses the 6 blocks so instead of left to right they are right to left. (pictures are attached)
image

If you use all or custom format.

From the readme.md it appears that atc1441 and custom format advertise the same, but it would appear some of the fields are transmitted differently compared to each other

I didnt know which part the issue is with but as it didnt happen with the other firmware my thinking is it could be this firmware)

Emulate LCD in the WebFlasher

Hey, again you made such nice improvements i love it.

I just had the idea that we maybe could ad an canvas with the Thermometer in Web so we can see live what is being displayed on the LCD without the need to go to each one.

its more like a gimmick but i think it would add a lot to the user experience.

it would kind of look like this image https://github.com/atc1441/ATC_MiThermometer/blob/master/Mi_LCD_Segments.jpeg
but drawn in a canvas based on the status of the LCD from the device, could be even reproduced based on the Notification with the Sensor data

Different ADC values for advertisements

Hi,

thanks for this great project. I really appreciate your work.

I use the LYWSD03MMC with firmware 1.8 and advertising typ "Custom".

I try to power it from a very small solar panel in combination with a super cap. So far it works reliable down to ~2V. I expierenced that the ADC values from the advertisments and the ADC values from connection mode differ. For example:

Connection Mode (via TeLinkMiFlasher.html): 2296mV (this one seems close to the real value)
Advert. Mode: 2058mV

Is there any difference in the ADC measurement for this two modes?

I also noticed (running with CR2032 battery) that in advertising mode the battery level indicator byte is sometimes over 100.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.