Fix Sonoff WTS01 temperature sensor shows incorrect negative temperature (#19373)

This commit is contained in:
Theo Arends 2024-10-14 15:28:33 +02:00
parent 3969c80242
commit fa82a48789
3 changed files with 20 additions and 1 deletions

View File

@ -30,6 +30,7 @@ All notable changes to this project will be documented in this file.
- DALI received data decoding
- ESP32 Ethernet using EthClockMode 3 (#22248)
- ESP32 disable SPI DMA for uDisplay (broken since esp-idf 5.3 (core 3.1.0)) (#22264)
- Sonoff WTS01 temperature sensor shows incorrect negative temperature (#19373)
### Removed
- Berry Zigbee removed test code (#22263)

View File

@ -179,6 +179,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm
- PZEM continue energy monitoring when one phase fails [#21968](https://github.com/arendst/Tasmota/issues/21968)
- BearSSL panic on ESP8266 in rare conditions [#22017](https://github.com/arendst/Tasmota/issues/22017)
- ModbusBridge request and response logic [#22075](https://github.com/arendst/Tasmota/issues/22075)
- Sonoff WTS01 temperature sensor shows incorrect negative temperature [#19373](https://github.com/arendst/Tasmota/issues/19373)
- Autoconf prevent 'init.bat' from stopping on empty lines [#22158](https://github.com/arendst/Tasmota/issues/22158)
- Zigbee extend timeout for MCU reboot from 5s to 10s [#22009](https://github.com/arendst/Tasmota/issues/22009)
- Zigbee avoid disabling console serial on ESP32 and improved log messages [#22082](https://github.com/arendst/Tasmota/issues/22082)

View File

@ -226,7 +226,24 @@ void SerialBridgeInput(void) {
if (9 == SBridge.in_byte_counter) {
uint32_t *header = (uint32_t*)serial_bridge_buffer;
if (0x04010155 == *header) {
SBridge.temperature = (float)serial_bridge_buffer[6] + ((float)serial_bridge_buffer[7] / 100.0f);
/*
14:43:26.718 WTS: buf6 0x01, buf7 0x5d, temp 1, dec 93 1.93
14:43:33.175 WTS: buf6 0x01, buf7 0x12, temp 1, dec 18 1.18
14:43:34.252 WTS: buf6 0x01, buf7 0x06, temp 1, dec 6 1.06
14:43:35.328 WTS: buf6 0x00, buf7 0x5d, temp 0, dec 93 0.93
14:43:42.862 WTS: buf6 0x00, buf7 0x0c, temp 0, dec 12 0.12
14:43:43.938 WTS: buf6 0x00, buf7 0x00, temp 0, dec 0 0.00
14:43:45.015 WTS: buf6 0x80, buf7 0x0c, temp 128, dec 12 -0.12
14:43:53.624 WTS: buf6 0x80, buf7 0x5d, temp 128, dec 93 -0.93
14:43:54.700 WTS: buf6 0x81, buf7 0x06, temp 129, dec 6 -1.06
*/
uint8_t temp = serial_bridge_buffer[6];
int sign = 1;
if (temp > 127) {
temp -= 128;
sign = -1;
}
SBridge.temperature = sign * ((float)temp + ((float)serial_bridge_buffer[7] / 100.0f));
}
}
}