This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## Background | |
| The Xiaomi Mi 2 temperature sensors are very cheap (less than £5 with battery included) temperature sensors that are designed to work with the Xiaomi Home IoT system. However, clever people have written custom firmware allowing them to be used outside of this, on Bluetooth BLE or Zigbee. | |
| However starting in mid 2025, a new firmware was flashed by default on the Mi 2 sensors that means that in order to flash the custom firmware, you first have to obtain the device ID, token and key. You can do this by connecting it to Xiaomi Home, using a tool to extract the keys, and then not using Xiaomi Home again. | |
| ## Checking if you have firmware 2.1.1_0159 | |
| 1. Go to https://pvvx.github.io/ATC_MiThermometer/TelinkMiFlasher.html in Chrome |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var websocket | |
| function doConnect() | |
| { | |
| websocket = new WebSocket('ws://localhost:8000/') | |
| websocket.onopen = function(evt) { onOpen(evt) } | |
| websocket.onclose = function(evt) { onClose(evt) } | |
| websocket.onmessage = function(evt) { onMessage(evt) } | |
| websocket.onerror = function(evt) { onError(evt) } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from bottle import * | |
| app = Bottle() | |
| @app.hook('after_request') | |
| def enable_cors(): | |
| print("after_request hook") | |
| response.headers['Access-Control-Allow-Origin'] = '*' | |
| response.headers['Access-Control-Allow-Methods'] = 'GET, POST, PUT, OPTIONS' | |
| response.headers['Access-Control-Allow-Headers'] = 'Origin, Accept, Content-Type, X-Requested-With, X-CSRF-Token' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <xml id="toolbox" style="display: none"> | |
| <category name="{catLogic}" colour="210"> | |
| <block type="controls_if"></block> | |
| <block type="logic_compare"></block> | |
| <block type="logic_operation"></block> | |
| <block type="logic_negate"></block> | |
| <block type="logic_boolean"></block> | |
| <block type="logic_null"></block> | |
| <block type="logic_ternary"></block> | |
| </category> |