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

Home Page:https://tasmota.github.io/docs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

remote Matter devices causes frequent DNS lookups

marcusb opened this issue · comments

PROBLEM DESCRIPTION

I have a Shelly 1 Plus configured as a Matter bridge for 5 other Tasmota and OpenBK devices. This works but I notice that Tasmota issues a DNS lookup every time it polls the remote devices (each device every 3 seconds). This isn't a big issue but might create quite a bit of DNS traffic if you have a many devices.

Could the DNS lookups be cached within their TTL?

REQUESTED INFORMATION

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

  • Read the Contributing Guide and Policy and the Code of Conduct
  • Searched the problem in issues
  • Searched the problem in discussions
  • Searched the problem in the docs
  • Searched the problem in the chat
  • Device used (e.g., Sonoff Basic): Shelly Plus 1
  • Tasmota binary firmware version number used: 13.4.0.3 (9c34707-tasmota32)
    • Pre-compiled
    • Self-compiled
  • Flashing tools used: _____
  • Provide the output of command: Backlog Template; Module; GPIO 255:
04:12:02.621 MQT: stat/garage-shelly1/RESULT = {"NAME":"Shelly Plus 1","GPIO":[0,0,0,0,192,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,224,0,0,0,0,0,0,0,0,0,0,0,0,0],"FLAG":0,"BASE":1}
04:12:02.833 MQT: stat/garage-shelly1/RESULT = {"Module":{"0":"Shelly Plus 1"}}
04:12:03.048 MQT: stat/garage-shelly1/RESULT = {"GPIO0":{"0":"None"},"GPIO1":{"0":"None"},"GPIO2":{"0":"None"},"GPIO3":{"0":"None"},"GPIO4":{"192":"Switch_n1"},"GPIO5":{"0":"None"},"GPIO6":{"0":"None"},"GPIO7":{"0":"None"},"GPIO8":{"0":"None"},"GPIO9":{"0":"None"},"GPIO10":{"0":"None"},"GPIO11":{"0":"None"},"GPIO12":{"0":"None"},"GPIO13":{"0":"None"},"GPIO14":{"0":"None"},"GPIO15":{"0":"None"},"GPIO16":{"0":"None"},"GPIO17":{"0":"None"},"GPIO18":{"0":"None"},"GPIO19":{"0":"None"},"GPIO20":{"0":"None"},"GPIO21":{"0":"None"},"GPIO22":{"0":"None"},"GPIO23":{"0":"None"},"GPIO24":{"0":"None"},"GPIO25":{"0":"None"},"GPIO26":{"224":"Relay1"},"GPIO27":{"0":"None"},"GPIO32":{"0":"None"},"GPIO33":{"0":"None"},"GPIO34":{"0":"None"},"GPIO35":{"0":"None"},"GPIO36":{"0":"None"},"GPIO37":{"0":"None"},"GPIO38":{"0":"None"},"GPIO39":{"0":"None"}}
  • If using rules, provide the output of this command: Backlog Rule1; Rule2; Rule3:
  Rules output here:

  • Provide the output of this command: Status 0:
04:03:56.547 CMD: Status 0
04:03:56.556 MQT: stat/garage-shelly1/STATUS = {"Status":{"Module":0,"DeviceName":"garage-shelly1","FriendlyName":["garage-shelly1"],"Topic":"garage-shelly1","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}}
04:03:56.611 MQT: stat/garage-shelly1/STATUS1 = {"StatusPRM":{"Baudrate":115200,"SerialConfig":"8N1","GroupTopic":"tasmotas","OtaUrl":"http://ota.tasmota.com/tasmota32/tasmota32.bin","RestartReason":"Software reset CPU","Uptime":"0T02:47:37","StartupUTC":"2024-03-20T00:16:19","Sleep":50,"CfgHolder":4617,"BootCount":36,"BCResetTime":"2023-10-15T22:09:02","SaveCount":226}}
04:03:56.655 MQT: stat/garage-shelly1/STATUS2 = {"StatusFWR":{"Version":"13.4.0.3(9c34707-tasmota32)","BuildDateTime":"2024-03-19T21:25:41","Core":"2_0_14","SDK":"4.4.6.240105","CpuFrequency":160,"Hardware":"ESP32-U4WDH-D v3.0","CR":"436/699"}}
04:03:56.677 MQT: stat/garage-shelly1/STATUS3 = {"StatusLOG":{"SerialLog":2,"WebLog":2,"MqttLog":0,"SysLog":2,"LogHost":"[redacted]","LogPort":514,"SSId":["[redacted]",""],"TelePeriod":300,"Resolution":"558180C0","SetOption":["00008009","2805C80001000600003C5A0A192800000000","00000080","00006000","00004000","00000020"]}}
04:03:56.721 MQT: stat/garage-shelly1/STATUS4 = {"StatusMEM":{"ProgramSize":1912,"Free":967,"Heap":78,"StackLowMark":2,"PsrMax":0,"PsrFree":0,"ProgramFlashSize":4096,"FlashSize":4096,"FlashChipId":"164020","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"}}
04:03:56.804 MQT: stat/garage-shelly1/STATUS5 = {"StatusNET":{"Hostname":"garage-shelly1-6752","IPAddress":"[redacted]","Gateway":"[redacted]","Subnetmask":"255.255.255.0","DNSServer1":"[redacted]","DNSServer2":"0.0.0.0","Mac":"B8:D6:1A:8A:9A:60","IP6Global":"[redacted]","IP6Local":"fe80::bad6:1aff:fe8a:9a60%st1","Ethernet":{"Hostname":"","IPAddress":"0.0.0.0","Gateway":"0.0.0.0","Subnetmask":"0.0.0.0","DNSServer1":"[redacted]","DNSServer2":"0.0.0.0","Mac":"00:00:00:00:00:00","IP6Global":"","IP6Local":""},"Webserver":2,"HTTP_API":1,"WifiConfig":4,"WifiPower":16.0}}
04:03:56.872 MQT: stat/garage-shelly1/STATUS6 = {"StatusMQT":{"MqttHost":"[redacted]","MqttPort":1883,"MqttClientMask":"garage-shelly1","MqttClient":"garage-shelly1","MqttUser":"[redacted]","MqttCount":1,"MAX_PACKET_SIZE":1200,"KEEPALIVE":30,"SOCKET_TIMEOUT":4}}
04:03:56.910 MQT: stat/garage-shelly1/STATUS7 = {"StatusTIM":{"UTC":"2024-03-20T03:03:56Z","Local":"2024-03-20T04:03:56","StartDST":"2024-03-31T02:00:00","EndDST":"2024-10-27T03:00:00","Timezone":"+01:00","Sunrise":"06:51","Sunset":"19:02"}}
04:03:56.939 MQT: stat/garage-shelly1/STATUS10 = {"StatusSNS":{"Time":"2024-03-20T04:03:56","Switch1":"OFF"}}
04:03:56.959 MQT: stat/garage-shelly1/STATUS11 = {"StatusSTS":{"Time":"2024-03-20T04:03:56","Uptime":"0T02:47:37","UptimeSec":10057,"Heap":75,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":40,"MqttCount":1,"Berry":{"HeapUsed":47,"Objects":643},"POWER":"OFF","Wifi":{"AP":1,"SSId":"[redacted]","BSSId":"[redacted]","Channel":11,"Mode":"11n","RSSI":100,"Signal":-48,"LinkCount":1,"Downtime":"0T00:00:04"}}}
04:03:57.007 MQT: stat/garage-shelly1/STATUS12 = {"StatusSTK":{"Exception":28,"Reason":"LoadProhibited","EPC":"4018b9b5","EXCVADDR":"b83fc03a","CallChain":["4018b9b2","4018ec0a","40193ac2","401849dd"]}}
  • Set weblog to 4 and then, when you experience your issue, provide the output of the Console log:
04:07:04.824 WIF: DNS resolved '[redacted]' (x.y.z.174) in 38 ms
04:07:04.939 MTR: HTTP async-resp in 426 ms from [redacted]: [365] '{"StatusSTS":{"Time":"1970-01-...'
04:07:05.032 BRY: GC from 58074 to 48468 bytes, objects freed 62/641 (in 4 ms) - slots from 648/760 to 504/729
04:07:05.049 MTR: HTTP async-resp in 477 ms from [redacted]: [362] '{"StatusSTS":{"Time":"1970-01-...'
04:07:05.150 BRY: GC from 58759 to 48694 bytes, objects freed 110/642 (in 4 ms) - slots from 700/759 to 501/744
04:07:05.153 MTR: HTTP async-resp in 360 ms from [redacted]: [397] '{"Status":{"Module":0,"DeviceN...'
04:07:05.766 MTR: HTTP async request 'http://[redacted]:80/cm?cmnd=Status+11'
04:07:05.772 WIF: DNS resolved '[redacted]' (x.y.z.57) in 0 ms
04:07:05.788 MTR: HTTP async request 'http://[redacted]:80/cm?cmnd=Status+11'
04:07:05.796 WIF: DNS resolved '[redacted]' (172.16.23.174) in 0 ms
04:07:05.944 BRY: GC from 58950 to 48116 bytes, objects freed 131/643 (in 4 ms) - slots from 756/804 to 507/774
04:07:06.135 MTR: HTTP async-resp in 338 ms from [redacted]: [366] '{"StatusSTS":{"Time":"1970-01-...'
04:07:06.185 MTR: HTTP async-resp in 412 ms from [redacted]: [366] '{"StatusSTS":{"Time":"1970-01-...'
04:07:06.756 BRY: GC from 58363 to 48374 bytes, objects freed 94/635 (in 4 ms) - slots from 713/774 to 496/729
04:07:07.538 MTR: HTTP async request 'http://[redacted]:80/cm?cmnd=Status+11'
04:07:07.545 WIF: DNS resolved '[redacted]' (x.y.z.71) in 1 ms
04:07:07.650 MTR: HTTP async-resp in 105 ms from [redacted]: [365] '{"StatusSTS":{"Time":"1970-01-...'
04:07:07.660 BRY: GC from 58624 to 49588 bytes, objects freed 88/677 (in 3 ms) - slots from 732/759 to 544/759
04:07:07.751 MTR: HTTP async request 'http://[redacted]:80/cm?cmnd=Status+11'
04:07:07.757 WIF: DNS resolved '[redacted]' (x.y.z.192) in 1 ms
04:07:07.773 MTR: HTTP async request 'http://[redacted]:80/cm?cmnd=Status+11'
04:07:07.802 WIF: DNS resolved '[redacted]' (x.y.z.236) in 22 ms

TO REPRODUCE

Configuration -> Configure Matter -> "Add Remote Tasmota or OpenBK"

EXPECTED BEHAVIOUR

DNS lookups are cached within TTL, not looked up before every HTTP request to the remotes.

SCREENSHOTS

ADDITIONAL CONTEXT

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

You need to check the network to know if an actual DNS query was made. The message is misleading, DNS resolved just means that the DNS lib did return a response, but it doesn't indicate if it was from the cache or from the network. I'm not even sure there is a way to get this information from LwIP.

II would argue that resolution in 0 ms or 1 ms are from cache, and 22/38 ms are from the server, but I may be wrong.

So unless you see actual request on the wire, DNS entries are supposed to be cached. Keep in mind that the cache is small though.