arendst / Tasmota

Alternative firmware for ESP8266 and ESP32 based devices with easy configuration using webUI, OTA updates, automation using timers or rules, expandability and entirely local control over MQTT, HTTP, Serial or KNX. Full documentation at
https://tasmota.github.io/docs
GNU General Public License v3.0
21.73k stars 4.72k forks source link

KNX Support : Latest commit in development branch introduced a regression when using DHT11 sensor #21379

Closed pbrinette closed 2 months ago

pbrinette commented 2 months ago

PROBLEM DESCRIPTION

The last commit to solve the issue https://github.com/arendst/Tasmota/issues/20834 introduce a regression :

Since this commit, the whole KNX configuration is lost after reboot when configuring a DHT11 sensor as KNX Source.

REQUESTED INFORMATION

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

- [ ✅ ] Provide the output of this command: `Status 0`:
```lua
  STATUS 0 output here:

21:54:32.323 RSL: STATUS = {"Status":{"Module":1,"DeviceName":"Tasmota","FriendlyName":["Tasmota"],"Topic":"tasmota_26128C","ButtonTopic":"0","Power":"1","PowerLock":"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}}
21:54:32.329 RSL: STATUS1 = {"StatusPRM":{"Baudrate":115200,"SerialConfig":"8N1","GroupTopic":"tasmotas","OtaUrl":"http://ota.tasmota.com/tasmota32/release/tasmota32.bin","RestartReason":"Vbat power on reset","Uptime":"0T00:17:14","StartupUTC":"2024-05-06T20:37:18","Sleep":50,"CfgHolder":4617,"BootCount":12,"BCResetTime":"2024-04-09T22:43:26","SaveCount":43}}
21:54:32.332 RSL: STATUS2 = {"StatusFWR":{"Version":"13.4.1.2(tasmota32)","BuildDateTime":"2024-05-06T22:34:55","Core":"3_0_0","SDK":"5.1.3.240430","CpuFrequency":160,"Hardware":"ESP32-D0WD-V3 v3.1","CR":"428/699"}}
21:54:32.335 RSL: STATUS3 = {"StatusLOG":{"SerialLog":2,"WebLog":4,"MqttLog":0,"SysLog":0,"LogHost":"","LogPort":514,"SSId":["OUIFI",""],"TelePeriod":300,"Resolution":"558180C0","SetOption":["02008009","2805C80001000600001234567800000000","00000080","00006000","00004000","00000000"]}}
21:54:32.354 RSL: STATUS4 = {"StatusMEM":{"ProgramSize":2015,"Free":864,"Heap":144,"StackLowMark":3,"PsrMax":0,"PsrFree":0,"ProgramFlashSize":4096,"FlashSize":4096,"FlashChipId":"16405E","FlashFrequency":40,"FlashMode":"DIO","Features":["0809","9F9AD7DF","0015A001","B7F7BFCF","05DA9BC4","E0360DC7","480840D2","20200000","D4BC482D","810A80B1","00000004"],"Drivers":"1,2,!3,!4,!5,7,!8,9,10,11,12,!14,!16,!17,!20,!21,!24,26,!27,29,!34,!35,38,50,52,!59,!60,62,!63,!66,!67,!68,82,!86,!87,!88,!121","Sensors":"1,2,3,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,64,66,67,74,85,92,95,98,103,105,109,127","I2CDriver":"7,8,9,10,11,12,13,14,15,17,18,20,24,29,31,36,41,42,44,46,48,58,62,65,69,76,77,82"}}
21:54:32.363 RSL: STATUS5 = {"StatusNET":{"Hostname":"tasmota-26128C-4748","IPAddress":"192.168.0.40","Gateway":"192.168.0.254","Subnetmask":"255.255.255.0","DNSServer1":"192.168.0.254","DNSServer2":"0.0.0.0","Mac":"08:D1:F9:26:12:8C","IP6Global":"2a01:e0a:1234:5678:1234:5678:1234:5678","IP6Local":"fe80::ad1:f9ff:fe26:128c%st1","Ethernet":{"Hostname":"","IPAddress":"0.0.0.0","Gateway":"0.0.0.0","Subnetmask":"0.0.0.0","DNSServer1":"192.168.0.254","DNSServer2":"0.0.0.0","Mac":"00:00:00:00:00:00","IP6Global":"","IP6Local":""},"Webserver":2,"HTTP_API":1,"WifiConfig":4,"WifiPower":16.0}}
21:54:32.370 RSL: STATUS6 = {"StatusMQT":{"MqttHost":"","MqttPort":1883,"MqttClientMask":"DVES_%06X","MqttClient":"DVES_26128C","MqttUser":"DVES_USER","MqttCount":0,"MAX_PACKET_SIZE":1200,"KEEPALIVE":30,"SOCKET_TIMEOUT":4}}
21:54:32.375 RSL: STATUS7 = {"StatusTIM":{"UTC":"2024-05-06T20:54:32Z","Local":"2024-05-06T21:54:32","StartDST":"2024-03-31T02:00:00","EndDST":"2024-10-27T03:00:00","Timezone":"+01:00","Sunrise":"05:20","Sunset":"20:12"}}
21:54:32.382 RSL: STATUS10 = {"StatusSNS":{"Time":"2024-05-06T21:54:32","DHT11":{"Temperature":0.2,"Humidity":2.0,"DewPoint":-41.2},"TempUnit":"C"}}
21:54:32.386 BRY: GC from 8025 to 4212 bytes, objects freed 11/45 (in 1 ms) - slots from 51/91 to 50/91
21:54:32.391 RSL: STATUS11 = {"StatusSTS":{"Time":"2024-05-06T21:54:32","Uptime":"0T00:17:14","UptimeSec":1034,"Heap":142,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":0,"Berry":{"HeapUsed":4,"Objects":45},"Wifi":{"AP":1,"SSId":"OUIFI","BSSId":"DC:00:B0:FE:D2:C0","Channel":1,"Mode":"HT20","RSSI":52,"Signal":-74,"LinkCount":1,"Downtime":"0T00:00:06"}}}

TO REPRODUCE

If I don't configure the sensor as a KNX object, the configuration is persistant after the reboot.

I.E : Configure 2 GA

13:06:06.021 HTP: Configure KNX
13:06:06.023 KNX: Enabled: 1, Communication Enhancement: 0
13:06:06.024 KNX: Physical Address: 0.2.178
13:06:06.026 KNX: GA: 2
13:06:06.027 KNX: GA #1: KNX TX 1 to 0/6/110
13:06:06.029 KNX: GA #2: KNX TX 2 to 0/6/111
13:06:06.030 KNX: CB: 0
13:06:06.031 HTP: Configuration

Configuration is still present after reboot

When I configure the DHT11 sensor to send data on a KNX GA, the configuration is lost after the reboot.

Adding 2 GA for Temperature and Humidity sensors

13:10:29.454 HTP: Configure KNX
13:10:29.456 KNX: Enabled: 1, Communication Enhancement: 0
13:10:29.458 KNX: Physical Address: 0.2.178
13:10:29.460 KNX: GA: 4
13:10:29.461 KNX: GA #1: KNX TX 1 to 0/6/110
13:10:29.462 KNX: GA #2: KNX TX 2 to 0/6/111
13:10:29.464 KNX: GA #3: Temperature to 0/6/106
13:10:29.466 KNX: GA #4: Humidity to 0/6/107
13:10:29.467 KNX: CB: 0
13:10:29.468 HTP: Configuration

This configuration works as expected until reboot .

After reboot, All KNX configuration is lost except the physical address

13:15:21.965 HTP: Configure KNX
13:15:21.968 KNX: Enabled: 1, Communication Enhancement: 0
13:15:21.970 KNX: Physical Address: 0.2.178
13:15:21.972 KNX: GA: 0
13:15:21.973 KNX: CB: 0
13:15:21.975 HTP: Configuration

EXPECTED BEHAVIOUR

The KNX configuration should persist after the reboot even using a DHT11 sensor.

SCREENSHOTS

Configuration BEFORE reboot when using a DHT11 sensor

Capture d’écran 2024-05-06 à 23 07 38

Configuration AFTER reboot when using a DHT11 sensor

Capture d’écran 2024-05-06 à 23 09 31

ADDITIONAL CONTEXT

Add any other context about the problem here.

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

barbudor commented 2 months ago

Thanks @pbrinette

In the meantime I have identified the reason In the previous PR, I removed some code which was making the KNX driver limited to a short list of T&H sensor based on direct GPIO. My change would have allowed to support any T&H sensor including I2C sensors. Some configuration was done later, on the 1st Teleperiod. But this was not counting on a configuration test performed at the start that was erasing the configuration if some GA was found for sensors that were not yet declared.

I already submit a PR #21378 where I remove totally the test. I think this is safe to assume that if the user has configured a GA for a temperature sensor (or humidity), then he has connected such sensor.

barbudor commented 2 months ago

@pbrinette original behavior has now been reverted That should solve your configuration erasure problem