Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Web-UI displays wrong BMx280 results during deepsleep #18710

Closed
6 of 8 tasks
FOTH156 opened this issue May 22, 2023 · 11 comments · Fixed by #18720
Closed
6 of 8 tasks

Web-UI displays wrong BMx280 results during deepsleep #18710

FOTH156 opened this issue May 22, 2023 · 11 comments · Fixed by #18720
Labels
awaiting feedback Action - Waiting for response or more information

Comments

@FOTH156
Copy link

FOTH156 commented May 22, 2023

PROBLEM DESCRIPTION

A clear and concise description of what the problem is.
Results from an BME280 are reported flawlessly via the Web UI in normal mode. When operated in deepsleep mode (DST 20, TP 10), this module gives correct results for part of the active cycle – the rest of the time (mainly during deep sleep) wrong results are displayed (see screenshots below). This is a problem because one gets incorrect information most of the time, especially for long deep sleep phases. Nevertheless, DeepSleep behaves as expected, i.e. current drops to 3mA (D1 mini) during sleep and then returns to 70 mA.

REQUESTED INFORMATION

Make sure your have performed every step and checked the applicable boxes before submitting your issue. Thank you!

  • [x ] Read the Contributing Guide and Policy and the Code of Conduct
  • [x ] Searched the problem in issues
  • [x ] Searched the problem in discussions
  • [x ] Searched the problem in the docs
  • [x ] Searched the problem in the chat
  • [x ] Device used (e.g., Sonoff Basic): D1 mini, Lolin, ESP12E on adapter board
  • Tasmota binary firmware version number used: 12.5.0 (sensors)
    • Pre-compiled
    • Self-compiled
  • Flashing tools used: Tasmotizer 1.2
  • Provide the output of command: Backlog Template; Module; GPIO 255:
  Configuration output here:

10:33:49.087 CMD: Backlog Template; Module; GPIO 255
10:33:49.089 SRC: WebConsole from 192.168.1.2
10:33:49.090 CMD: Grp 0, Cmd 'BACKLOG', Idx 1, Len 26, Pld -99, Data 'Template; Module; GPIO 255'
10:33:49.185 SRC: Backlog
10:33:49.187 CMD: Grp 0, Cmd 'TEMPLATE', Idx 1, Len 0, Pld -99, Data ''
10:33:49.192 MQT: stat/tasmota_0C6AAB/RESULT = {"NAME":"Generic","GPIO":[1,1,1,1,1,1,1,1,1,1,1,1,1,1],"FLAG":0,"BASE":18}
10:33:49.398 SRC: Backlog
10:33:49.400 CMD: Grp 0, Cmd 'MODULE', Idx 1, Len 0, Pld -99, Data ''
10:33:49.405 MQT: stat/tasmota_0C6AAB/RESULT = {"Module":{"18":"Generic"}}
10:33:49.650 SRC: Backlog
10:33:49.652 CMD: Grp 0, Cmd 'GPIO', Idx 1, Len 3, Pld 255, Data '255'
  • If using rules, provide the output of this command: Backlog Rule1; Rule2; Rule3:
  Rules output here: 
n.a.

  • Provide the output of this command: Status 0:
  STATUS 0 output here:
10:21:31.395 CMD: status 0
10:21:31.396 SRC: WebConsole from 192.168.1.2
10:21:31.398 CMD: Grp 0, Cmd 'STATUS', Idx 1, Len 1, Pld 0, Data '0'
10:21:31.405 MQT: stat/tasmota_0C6AAB/STATUS = {"Status":{"Module":18,"DeviceName":"T, rH, BP","FriendlyName":["Tasmota"],"Topic":"tasmota_0C6AAB","ButtonTopic":"0","Power":0,"PowerOnState":3,"LedState":1,"LedMask":"FFFF","SaveData":1,"SaveState":1,"SwitchTopic":"0","SwitchMode":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ButtonRetain":0,"SwitchRetain":0,"SensorRetain":0,"PowerRetain":0,"InfoRetain":0,"StateRetain":0,"StatusRetain":0}}
10:21:31.442 MQT: stat/tasmota_0C6AAB/STATUS1 = {"StatusPRM":{"Baudrate":115200,"SerialConfig":"8N1","GroupTopic":"tasmotas","OtaUrl":"http://ota.tasmota.com/tasmota/release/tasmota-sensors.bin.gz","RestartReason":"Deep-Sleep Wake","Uptime":"0T00:00:04","StartupUTC":"2023-05-21T08:21:27","Sleep":50,"CfgHolder":4617,"BootCount":7,"BCResetTime":"2023-05-20T10:55:53","SaveCount":24,"SaveAddress":"F4000"}}
10:21:31.476 MQT: stat/tasmota_0C6AAB/STATUS2 = {"StatusFWR":{"Version":"12.5.0(sensors)","BuildDateTime":"2023-04-17T08:03:55","Boot":31,"Core":"2_7_4_9","SDK":"2.2.2-dev(38a443e)","CpuFrequency":80,"Hardware":"ESP8266EX","CR":"405/699"}}
10:21:31.496 MQT: stat/tasmota_0C6AAB/STATUS3 = {"StatusLOG":{"SerialLog":2,"WebLog":4,"MqttLog":0,"SysLog":0,"LogHost":"","LogPort":514,"SSId":["HUAWEI4G","Galaxy-S7"],"TelePeriod":10,"Resolution":"558180C0","SetOption":["00008009","2805C80001000600003C5A0A192800000000","00000088","00006000","00004000","00000000"]}}
10:21:31.540 MQT: stat/tasmota_0C6AAB/STATUS4 = {"StatusMEM":{"ProgramSize":699,"Free":304,"Heap":20,"ProgramFlashSize":4096,"FlashSize":4096,"FlashChipId":"16405E","FlashFrequency":40,"FlashMode":"DOUT","Features":["00000809","8F9A8787","0415A005","B7F7BFCF","05DA9BC4","64367CC7","00084052","20000000","54000020","0008C081"],"Drivers":"1,2,3,4,5,6,7,8,9,10,12,14,16,17,20,21,24,29,34,62,65,66","Sensors":"1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,17,18,19,20,21,22,26,31,34,37,39,40,42,43,45,51,52,55,56,58,59,62,64,66,67,74,98,103,105","I2CDriver":"7,8,9,10,11,12,13,14,15,17,18,20,24,29,31,36,41,42,44,46,48,69,76"}}
10:21:31.591 MQT: stat/tasmota_0C6AAB/STATUS5 = {"StatusNET":{"Hostname":"BME280-4-DS","IPAddress":"192.168.1.46","Gateway":"192.168.1.1","Subnetmask":"255.255.255.0","DNSServer1":"192.168.1.1","DNSServer2":"0.0.0.0","Mac":"C8:C9:A3:0C:6A:AB","Webserver":2,"HTTP_API":1,"WifiConfig":4,"WifiPower":17.0}}
10:21:31.614 MQT: stat/tasmota_0C6AAB/STATUS6 = {"StatusMQT":{"MqttHost":"192.168.1.8","MqttPort":1883,"MqttClientMask":"DVES_%06X","MqttClient":"DVES_0C6AAB","MqttUser":"DVES_USER","MqttCount":1,"MAX_PACKET_SIZE":1200,"KEEPALIVE":30,"SOCKET_TIMEOUT":4}}
10:21:31.641 MQT: stat/tasmota_0C6AAB/STATUS7 = {"StatusTIM":{"UTC":"2023-05-21T08:21:31","Local":"2023-05-21T10:21:31","StartDST":"2023-03-26T02:00:00","EndDST":"2023-10-29T03:00:00","Timezone":99,"Sunrise":"06:01","Sunset":"21:31"}}
10:21:31.664 MQT: stat/tasmota_0C6AAB/STATUS10 = {"StatusSNS":{"Time":"2023-05-21T10:21:31","BME280":{"Temperature":20.6,"Humidity":40.1,"DewPoint":6.5,"Pressure":860.1,"SeaPressure":1022.3},"PressureUnit":"hPa","TempUnit":"C"}}
10:21:31.682 MQT: stat/tasmota_0C6AAB/STATUS11 = {"StatusSTS":{"Time":"2023-05-21T10:21:31","Uptime":"0T00:00:04","UptimeSec":4,"Heap":20,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":1,"Wifi":{"AP":1,"SSId":"HUAWEI4G","BSSId":"00:BE:3B:B5:50:9C","Channel":1,"Mode":"11n","RSSI":78,"Signal":-61,"LinkCount":1,"Downtime":"0T00:00:03"}}}
  • Set weblog to 4 and then, when you experience your issue, provide the output of the Console log:
  Console output here:
00:00:00.001 HDW: ESP8266EX
00:00:00.050 CFG: Loaded from flash at F4, Count 24
00:00:00.070 ROT: Mode 1
00:00:00.073 SRC: Restart
00:00:00.075 Project tasmota - T, rH, BP Version 12.5.0(sensors)-2_7_4_9(2023-04-17T08:03:55)
00:00:00.088 SHT: Sensor did not ACK command
00:00:00.111 I2C: BME280 found at 0x76
00:00:00.221 WIF: Checking connection...
00:00:00.222 WIF: Attempting connection...
00:00:00.559 WIF: Connecting to AP1 HUAWEI4G Channel 1 BSSId 00:BE:3B:B5:50:9C in mode 11n as BME280-4-DS...
00:00:01.758 WIF: Checking connection...
00:00:01.759 WIF: Connected
00:00:02.016 HTP: Web server active on BME280-4-DS with IP address 192.168.1.46
00:00:02.364 WIF: Sending Gratuitous ARP
00:00:02.366 NTP: Sync time...
00:00:02.375 WIF: DNS resolved '2.pool.ntp.org' (91.206.8.36) in 7 ms
00:00:02.418 RTC: UTC 2023-05-21T08:17:08, DST 2023-03-26T02:00:00, STD 2023-10-29T03:00:00
10:17:08.001 RTC: Synced by NTP
10:17:08.033 MQT: Attempting connection...
10:17:08.034 WIF: DNS resolved '192.168.1.8' (192.168.1.8) in 0 ms
10:17:08.047 MQT: Connected
10:17:08.050 MQT: tele/tasmota_0C6AAB/LWT = Online (retained)
10:17:08.052 MQT: cmnd/tasmota_0C6AAB/POWER = 
10:17:08.054 MQT: Subscribe to cmnd/tasmota_0C6AAB/#
10:17:08.056 MQT: Subscribe to cmnd/tasmotas/#
10:17:08.059 MQT: Subscribe to cmnd/DVES_0C6AAB_fb/#
10:17:12.388 MQT: tele/tasmota_0C6AAB/STATE = {"Time":"2023-05-21T10:17:12","Uptime":"0T00:00:08","UptimeSec":8,"Heap":21,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":1,"Wifi":{"AP":1,"SSId":"HUAWEI4G","BSSId":"00:BE:3B:B5:50:9C","Channel":1,"Mode":"11n","RSSI":86,"Signal":-57,"LinkCount":1,"Downtime":"0T00:00:03"}}
10:17:12.416 MQT: tele/tasmota_0C6AAB/SENSOR = {"Time":"2023-05-21T10:17:12","BME280":{"Temperature":20.6,"Humidity":40.5,"DewPoint":6.6,"Pressure":860.1,"SeaPressure":1022.2},"PressureUnit":"hPa","TempUnit":"C"}
10:17:12.438 MQT: stat/tasmota_0C6AAB/RESULT = {"DeepSleep":{"Time":"2023-05-21T10:17:22","Epoch":1684664242}}

TO REPRODUCE

Steps to reproduce the behavior:

EXPECTED BEHAVIOUR

A clear and concise description of what you expected to happen.

Prepare a breadboard with an ESP8266 (FW 12.5.0) wired for deepsleep according to the docs and a BME280 (GPIO4-SDA, GPIO5-SCL) and verify proper operation. Now set DSL 20, TP 10 and monitor the Web-UI to observe the back and forth switching between correct and wrong values. An instrument to monitor the supply current is helpful in determining begin and end of deepsleep.

SCREENSHOTS

If applicable, add screenshots to help explain your problem.

Correct results
CorrectResults

Wrong results
Wrong_results

ADDITIONAL CONTEXT

Add any other context about the problem here.

What I tried so far but to no effect:
Tried USB supply and LiIo
Tried Brave and Firefox
Several combinations of telemetry period and DeepSleepTime made no difference
Tried multiple ESPs (D1 mini, Lolin, adapter board) with a single BME280. In all cases I ended up with the identical set of wrong values in DeepSleep-mode.
Tried several BME280, BMP280 and BMP180. The problem is not observed with BMP180. But each BME/P 280 sensor has its own characteristic set of wrong values, very much like a fingerprint.
Eventually I stepped back to 8.5.0 Hannah only to learn, that the problem existed with this version already.
The display of wrong values is shifted to the right by one position
The change from correct to wrong results occurs approx. 2 seconds before the supply current drops to zero. Unfortunately my software knowledge is far from being sufficient to further track down this problem. This is why every support in this matter is highly appreciated. Please let me know if additional information is required!

(Please, remember to close the issue when the problem has been addressed)

@Jason2866
Copy link
Collaborator

During deep sleep there is no Web UI since the device is sleeping. So you can't get anything.

@FOTH156
Copy link
Author

FOTH156 commented May 22, 2023

Oops - forgot the expected behaviour:
I expected the last valid measurement to be displayed during deep sleep until after restart new data become available – exactly as it is with the BME180.

@barbudor
Copy link
Contributor

Whatever the sensor, when the ESP is in DeepSleep it is sleeping, so not responding to Web request
Trying to display the web page when the ESP is in DeepSleep, you should get an error in your browser and that's normal

@FOTH156
Copy link
Author

FOTH156 commented May 22, 2023

Thx for replying! The question remains, why the BMx280 switches to wrong values before entering deepsleep, while the BMP180 keeps the correct values.

@FOTH156
Copy link
Author

FOTH156 commented May 24, 2023

Please excuse me for being tedious, yet the problem is not resolved. I don't expect any values to be transmitted during DS. My question is, why the BMx280 switches to a wrong set of values approx. two seconds before entering DS. This is not observed with the BMP180. Sorry for any inconvenience this might have caused.

@Jason2866
Copy link
Collaborator

Yes, thats why the issue is still open.

@Jason2866 Jason2866 added the Requires more research (devs) Action - Issue requires more research label May 24, 2023
@barbudor
Copy link
Contributor

Ah that makes sense
If the web UI shows wrong values just before going to sleep it is maybe a problem of timing because the driver reacts to the event 'about to go to sleep' by putting the BMP in sleep mode
So the next refresh of the UI right before the esp goes in deep sleep would get wrong values

Should be easy to solve
I can try to have a look tonight

@barbudor
Copy link
Contributor

@FOTH156
Can you please the below test version and confirm ?
issue-18710_tasmota-sensors_test1.zip

As soon as the driver has received the information that the ESP is about to enter DeepSleep and as put the BMP in LowPower/Sleep mode, it disable reading/updating the values and keep the last ones until next restart.

@barbudor
Copy link
Contributor

I won't be availble in the next couple of days but I'm pretty confident on the results so I have already created the PR
Please do not merge until @FOTH156 has confirmed it's ok

@FOTH156
Copy link
Author

FOTH156 commented May 24, 2023

Will do some thorough testing tomorrow and report the results. Anyway a big THX to you for taking care of this issue!

@Jason2866 Jason2866 added awaiting feedback Action - Waiting for response or more information and removed Requires more research (devs) Action - Issue requires more research labels May 24, 2023
@FOTH156
Copy link
Author

FOTH156 commented May 25, 2023

After extensive testing I can confirm that with the test version the problem has vanished and the issue can be closed. BTW, do I have to close the thread, or are you going to do this ? Thank you very much for your patience and efforts ! - Gerd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting feedback Action - Waiting for response or more information
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants