Closed johannbarbie closed 1 year ago
If I understood correctly, you're using mDNS to discover the SK server, and SensESP "gets stuck" on the old IP, even after a restart? That definitely sounds like a serious bug. Off the bat, I can't even think of a reason why SensESP should save the IP address in the first place. I'll look into it soon.
yes, I followed the getting started tutorial with the mDNS flag in SignalK enabled. I've used the 2.6.0 release of SensESP, and initiated it like this:
SensESPAppBuilder builder;
sensesp_app = builder.get_app();
sensesp_app->start();
I see that the SignalK server is identified by sk_server_address
and sk_server_port
in SensESPApp class, which again is an instance of Configurable, and serializes these values to a file?
I guess instead of address another identifier should be used, like hostname, which is then saved to the config when the access request to SignalK has been approved here: https://github.com/SignalK/SensESP/blob/cbd1ecdf0ec381e00908000e47d1e85a3ed6117b/src/sensesp/net/ws_client.cpp#L443-L446
This identifier/hostname would then be resolved to an ip address on startup and then be used for WSClient::connect()
.
@johannbarbie could you test PR #636? The logic should be improved now.
yeah, that worked for me.
I have few more observations: funny enough, signalK and SensESP didn't start talking on 192.168.178.201 after the DHCP renewal, but using a link.local address 169.254.0.0/16. During that time I could see the IP of signalK on the status page, but the field on on configuration page was empty. Then I used the configuration page to set the correct IP and port, then restarted the sensor. It worked and the sensor connected immediately. now I see the IP on the configuration page, but on the status page it is empty, and the port wrong:
OK, two things:
Note that if you set the IP address via the config page, that setting will preside even if the server gets a new address from the DHCP server. If the SK server address isn't fixed, it's better to leave the address in config empty, so that mDNS will be always used.
Who is Siggi and what did he do? (THIS IS IMPORTANT! I MUST KNOW!)
🤣 a former landlord of a community flat in Berlin, not very friendly and defeated in court multiple times 😁
LOL, glad I asked, and even more glad he's a former landlord!
Back to the topic, I just tested the status page issue and was able to replicate your results.
Should be fixed now.
cool, thx for the effort. I'll be able to test it tomorrow.
I went through the full Sensor lifecycle with the latest commit and the Signal K server address
and Signal K server port
showed up correctly right from the beginning.
I restarted my PI after connecting the SensESP to my SignalK server and it got a new IP from DHCP.
now the SensESP is not able to connect, and I see the old IP in the SensESP interface:
First I was blaming it on SignalK to broadcast an outdated IP over mDNS, but using
avahi-resolve
in the network it correctly returns the new one192.168.8.110
.So I assume the SensESP saves the value and doesn't update it.
Obviously I can configure a fixed IP to the SignalK server, but wanted to leave the issue here as an improvement proposal.
My expectation would be that the SensESP rediscovers the correct IP when being restarted.