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.84k stars 4.75k forks source link

ESP32: Eth IP address is not shown correctly in GUI and in HASS discovery #14929

Closed altserg closed 2 years ago

altserg commented 2 years ago

PROBLEM DESCRIPTION

ESP32 does not show correct Ethernet IP address in GUI and in HASS autodiscovery MQTT messages. The problem exists on Tasmota at least since version 9, and was seen on multiple different HW boards

REQUESTED INFORMATION

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

- [ ] If using rules, provide the output of this command: `Backlog Rule1; Rule2; Rule3`:
```lua
  Rules output here:
- [x] Set `weblog` to 4 and then, when you experience your issue, provide the output of the Console log:
```lua
  Console output here:
09:40:07.736 CMD: weblog
09:40:07.746 MQT: stat/GFHVAC/RESULT = {"WebLog":2}
09:40:10.897 CMD: weblog 4
09:40:10.907 MQT: stat/GFHVAC/RESULT = {"WebLog":4}
09:40:11.677 CFG: Saved, Count 36, Bytes 4096
09:40:41.150 SRC: MQTT
09:40:41.154 CMD: Grp 0, Cmd 'POWER', Idx 1, Len 3, Pld 0, Data 'OFF'
09:40:41.164 MQT: stat/GFHVAC/RESULT = {"POWER1":"OFF"}
09:40:41.171 MQT: stat/GFHVAC/POWER1 = OFF
09:40:52.551 M32: Kick off readOneSensor
09:40:52.555 M32: Kick off tele sending
09:41:24.799 CMD: setoption53 0
09:41:24.802 SRC: WebConsole from 192.168.2.112
09:41:24.805 CMD: Grp 0, Cmd 'SETOPTION', Idx 53, Len 1, Pld 0, Data '0'
09:41:24.813 MQT: stat/GFHVAC/RESULT = {"SetOption53":"OFF"}
09:41:25.600 CFG: Saved, Count 37, Bytes 4096
09:41:32.916 CMD: setoption53 1
09:41:32.919 SRC: WebConsole from 192.168.2.112
09:41:32.924 CMD: Grp 0, Cmd 'SETOPTION', Idx 53, Len 1, Pld 1, Data '1'
09:41:32.932 MQT: stat/GFHVAC/RESULT = {"SetOption53":"ON"}
09:41:33.721 CFG: Saved, Count 38, Bytes 4096

TO REPRODUCE

  1. Set up the ESP32 device. Attach ethernet cable
  2. SetOption53 1
  3. WiFi 0 (see first 2 screenshots)
  4. Wifi 1 (see last screenshot)

EXPECTED BEHAVIOUR

A clear and concise description of what you expected to happen. Correct Eth IP address is displayed in the GUI and in HASS MQTT discovery messages

SCREENSHOTS

If applicable, add screenshots to help explain your problem. image image image

ADDITIONAL CONTEXT

Add any other context about the problem here.

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

arendst commented 2 years ago

You're seeing different issues.

1) IP address 0.0.0.0 means DHCP is providing the correct IP address. 2) IP address 192.168.4.1 is the AP's IP address and not the ethernet IP address. The ethernet IP address won't be shown in the GUI when wifi is ON.

altserg commented 2 years ago

Hi Theo,

I disagree.

  1. When Wifi is on, then, the IP address in MQTT message and GUI is correct. When Wifi is Off, Eth IP address is incorrect. See the image below showing 2 similar devices with the same FW and one Wifi enabled, another Wifi disabled image However, the 1st board has fixed IP (not DHCP) via EthIP command. But I would expect the IP address to show correctly everywhere, regardless whether it's obtained from DHCP or fixed. In HASS, in Tasmota integration wrong IP is shown as well, the link to device does not work because of that. Addition: I have checked on one of my boards with older 9.X Tasmota, the issue is the same also for IP address that is obtained via DHCP, see the last picture image

  2. My AP has different address, I use 192.168.2.XXX network

Jason2866 commented 2 years ago

Getting both (DHCP) IP addresses shown with status 5 MQT: stat/sonoff-D09CA8/STATUS5 = {"StatusNET":{"Hostname":"sonoff-D09CA8-7336","IPAddress":"192.168.2.179","Gateway":"192.168.2.1","Subnetmask":"255.255.255.0","DNSServer1":"192.168.2.1","DNSServer2":"0.0.0.0","Mac":"94:B9:7E:D0:9C:A8","Ethernet":{"Hostname":"sonoff-D09CA8-7336-eth","IPAddress":"192.168.2.176","Gateway":"192.168.2.1","Subnetmask":"255.255.255.0","DNSServer1":"192.168.2.1","DNSServer2":"0.0.0.0","Mac":"94:B9:7E:D0:9C:AB"},"Webserver":2,"HTTP_API":1,"WifiConfig":4,"WifiPower":17.0}} eth is xxx.176. So this is not correct Screenshot_20220222-141907

arendst commented 2 years ago

How about this:

image

15:46:17.360 MQT: tasmota/discovery/4C11AED6D31C/config = {"ip":"192.168.2.117","dn":"Olimex ESP32-PoE-Iso","fn":["Tasmota",null,null,null,null,null,null,null],"hn":"esp32f-eth","mac":"4C11AED6D31C","md":"Olimex ESP32-PoE","ty":0,"if":0,"ofln":"Offline","onln":"Online","state":["OFF","ON","TOGGLE","HOLD"],"sw":"11.0.0.2","t":"esp32f","ft":"%prefix%/%topic%/","tp":["cmnd","stat","tele"],"rl":[1,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],"swc":[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],"swn":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],"btn":[0,0,0,0,0,0,0,0],"so":{"4":0,"11":0,"13":0,"17":0,"20":0,"30":0,"68":0,"73":0,"82":0,"114":0,"117":0},"lk":0,"lt_st":0,"sho":[0,0,0,0],"ver":1} (retained)
15:46:17.444 MQT: tasmota/discovery/4C11AED6D31C/sensors = {"sn":{"Time":"2022-02-22T15:46:17","ESP32":{"Temperature":53.3},"TempUnit":"C"},"ver":1} (retained)
altserg commented 2 years ago

With latest git pull I cannot compile the FW anymore. I have cleaned the cache, etc. Is there anything special that I need to do ?

c:/users/stkachen/.platformio/packages/toolchain-xtensa-esp32@8.4.0+2021r2-patch2/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\stkachen\AppData\Local\Temp\ccolNs1L.ltrans13.ltrans.o:(.literal+0x49c): undefined reference to be_load_ccronexpr_class' c:/users/stkachen/.platformio/packages/toolchain-xtensa-esp32@8.4.0+2021r2-patch2/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\stkachen\AppData\Local\Temp\ccolNs1L.ltrans13.ltrans.o: in functionsetup()':

:(.text+0x3caa): undefined reference to `be_load_ccronexpr_class' collect2.exe: error: ld returned 1 exit status *** [.pio\build\tasmota32\firmware.elf] Error 1
Jason2866 commented 2 years ago

Nothing special to do. There is no issue, since the automated builds compile all successfully. Try a complete fresh git clone and delete hidden folder .platformio

altserg commented 2 years ago

still the same error, deleted everything...

altserg commented 2 years ago

I have found the problem: I use #undef USE_LIGHT, and missing class is guarded by #ifdef USE_LIGHT. The fix is to move one line of code: diff --git a/lib/libesp32/berry/default/be_modtab.c b/lib/libesp32/berry/default/be_modtab.c index 684174821..4628e2afb 100644 --- a/lib/libesp32/berry/default/be_modtab.c +++ b/lib/libesp32/berry/default/be_modtab.c @@ -208,8 +208,8 @@ BERRY_API void be_load_custom_libs(bvm *vm) be_load_md5_lib(vm); be_load_serial_lib(vm); be_load_ctypes_lib(vm);

altserg commented 2 years ago

With latest fix I confirm that correct IP address is displayed when DHCP is not used image

Correct IP is also shown in MQTT: image

{"ip":"192.168.2.96","dn":"GF HVAC","fn":["GF_CV_Switch","GF_Reserve_1","GF_Reserve_2","GF_Reserve_3","GF_Reserve_4","GF_HVAC_MAX","GF_HVAC_MEDIUM","GF_HVAC_STANDBY"],"hn":"ESP32-GF-HVAC-eth","mac":"C8C9A3DC2E10","md":"KC868-A8","ty":0,"if":0,"ofln":"Offline","onln":"Online","state":["OFF","ON","TOGGLE","HOLD"],"sw":"11.0.0.2","t":"GFHVAC","ft":"%prefix%/%topic%/","tp":["cmnd","stat","tele"],"rl":[1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"swc":[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],"swn":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],"btn":[0,0,0,0,0,0,0,0],"so":{"4":0,"11":0,"13":0,"17":0,"20":0,"30":0,"68":0,"73":0,"82":0,"114":0,"117":0},"lk":0,"lt_st":0,"sho":[0,0,0,0],"ver":1}

Status 5 output shows first IP as 0.0.0.0 but this is probably correct, maybe refers to WiFi

status 5 16:54:56.262 MQT: stat/GFHVAC/STATUS5 = {"StatusNET":{"Hostname":"ESP32-GF-HVAC","IPAddress":"0.0.0.0","Gateway":"192.168.2.1","Subnetmask":"255.255.255.0","DNSServer1":"192.168.2.1","DNSServer2":"0.0.0.0","Mac":"C8:C9:A3:DC:2E:10","Ethernet":{"Hostname":"ESP32-GF-HVAC-eth","IPAddress":"192.168.2.96","Gateway":"192.168.2.1","Subnetmask":"255.255.255.0","DNSServer1":"192.168.2.1","DNSServer2":"8.8.8.8","Mac":"C8:C9:A3:DC:2E:13"},"Webserver":2,"HTTP_API":0,"WifiConfig":0,"WifiPower":17.0}}

altserg commented 2 years ago

I will close the issue, but maybe someone can still have a look at the compilation issue

Jason2866 commented 2 years ago

Berry error should be solved with https://github.com/arendst/Tasmota/pull/14993