openmrn / OpenMRNLite

Arduino library for the OpenMRN core using the simplified drivers and programming model of the Arduino environment.
BSD 2-Clause "Simplified" License
16 stars 8 forks source link

mDNS not resolving when running ESP32WifiCanBridge #5

Closed K-hastings closed 10 months ago

K-hastings commented 10 months ago

Hello,

I am unable to get mDNS to resolve the _openlcb-can._tcp.local hostname. Other hosts running avahi-browse as well as the mDNS-SD_Extended example from Arduino-esp32 however resolve it no problem.

I created a newer library based on the instructions here: https://github.com/bakerstu/openmrn/blob/master/arduino/RELEASE.md When trying with the 1.0.3 release package I am unable to compile due to Arduino-esp32 being 2.0.11.

Any suggestions to either get it to resolve or to be able to get in and manually connect it to the hub (either JMRI's or the one from OpenMRN are not being found automatically)

atanisoft commented 10 months ago

I am unable to get mDNS to resolve the _openlcb-can._tcp.local hostname.

It's a service name, not a hostname. Depending on the operating system you may have better luck with using the hostname "esp32mrn.local" instead.

When trying with the 1.0.3 release package I am unable to compile due to Arduino-esp32 being 2.0.11.

This is a known issue and we are working on preparing an updated version of OpenMRNLite that works with the 2.x arduino-esp32 versions. There were major version changes from 1.x to 2.x and as a result the current OpenMRNLite versions are stuck on the 1.x versions (1.0.6 should work). If you have a Linux / MacOS env you can clone https://github.com/bakerstu/openmrn and run arduino/libify.sh to export a version that should work with 2.x though.

K-hastings commented 10 months ago

I am unable to get mDNS to resolve the _openlcb-can._tcp.local hostname.

It's a service name, not a hostname. Depending on the operating system you may have better luck with using the hostname "esp32mrn.local" instead.

esp32mrn refuses to resolve anywhere (with or without .local). No issues resolving _openlcb-can._tcp.local on everything except the ESP32 when running the example gateway. Even the ESP32 mDNS example can resolve it but not the can gateway example. I haven't had any luck figuring out where it is trying to resolve to see if there is a code difference between the two examples.

When trying with the 1.0.3 release package I am unable to compile due to Arduino-esp32 being 2.0.11.

This is a known issue and we are working on preparing an updated version of OpenMRNLite that works with the 2.x arduino-esp32 versions. There were major version changes from 1.x to 2.x and as a result the current OpenMRNLite versions are stuck on the 1.x versions (1.0.6 should work). If you have a Linux / MacOS env you can clone https://github.com/bakerstu/openmrn and run arduino/libify.sh to export a version that should work with 2.x though.

Thats what I did when I said I created a newer library using the same link....

atanisoft commented 10 months ago

esp32mrn refuses to resolve anywhere (with or without .local).

Interesting, which OS and which tool are you using to resolve it?

No issues resolving _openlcb-can._tcp.local on everything except the ESP32 when running the example gateway.

That's interesting since it is not a hostname but is a service name (without the .local part).

I haven't had any luck figuring out where it is trying to resolve to see if there is a code difference between the two examples.

Can you capture the serial console output from the gateway version? It should be starting up and searching for an existing LCC hub via mDNS (looking for _openlcb-can._tcp service name) and connecting to it when found. If you have a CAN interface on your PC you might be able to pull up the CDI from JMRI and check the configuration was seeded correctly on the esp32.

If you are re-using the esp32 between different examples I would strongly recommend clearing the flash memory between the examples to ensure it doesn't result in unexpected behaviors related to invalid persistent data.

K-hastings commented 10 months ago

Interesting, which OS and which tool are you using to resolve it?

Pop-os and ubuntu using avahi-browse -d local _openlcb-can._tcp --resolve -t correctly gets the txt and ip records. Using the mDNS-SD_extended example from Arduino-esp32 also grabs the IP of the hub from _openlcb-can._tcp. As soon as I use the ESP32WifiCanGateway it and it alone seems to never be able to find and get any information from _openlcb-can._tcp. Just keeps looping that it failed.

Can you capture the serial console output from the gateway version? It should be starting up and searching for an existing LCC hub via mDNS (looking for _openlcb-can._tcp service name) and connecting to it when found.

The serial console is how I know it is failing.

If you have a CAN interface on your PC you might be able to pull up the CDI from JMRI and check the configuration was seeded correctly on the esp32.

I don't have a CAN interface for my computer. This is what I was hoping the ESP32 would be. image

K-hastings commented 10 months ago

Looks like something was stuck in the EEPROM despite clearing it previously. It is working now.

atanisoft commented 10 months ago

Glad you were able to sort out what was causing it. From the console output that log message for Uplink is indicating that it did not find any other node(s) advertising the service name (JMRI doesn't advertise it today that I know of).

K-hastings commented 10 months ago

It does when you launch the hub. Though for most of my testing I had been using the hub app included with openmrn.

Get Outlook for iOShttps://aka.ms/o0ukef


From: Mike Dunston @.> Sent: Tuesday, September 5, 2023 5:37:36 PM To: openmrn/OpenMRNLite @.> Cc: Kevin Hastings @.>; State change @.> Subject: [EXTERNAL] Re: [openmrn/OpenMRNLite] mDNS not resolving when running ESP32WifiCanBridge (Issue #5)

Glad you were able to sort out what was causing it. From the console output that log message for Uplink is indicating that it did not find any other node(s) advertising the service name (JMRI doesn't advertise it today that I know of).

— Reply to this email directly, view it on GitHubhttps://github.com/openmrn/OpenMRNLite/issues/5#issuecomment-1707342650, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BA6QOHWFX2U7GVKKCHXBZ6LXY6LSBANCNFSM6AAAAAA4MH4CD4. You are receiving this because you modified the open/close state.Message ID: @.***>


This e-mail and any attachments may contain information that is confidential to Ross Video.

If you are not the intended recipient, please notify me immediately by replying to this message. Please also delete all copies. Thank you.

atanisoft commented 10 months ago

If you are using the openmrn hub make sure to pass "-m" so it does advertise itself, the esp32 should be able to locate it and connect automatically.

K-hastings commented 10 months ago

I have that flag. It is advertising. Has been the whole time. Thats why I could see it with avahi-browse. There was an issue with the contents of the eeprom on the esp near I could tell. Hence why this issue has been closed and resolved.

Get Outlook for iOShttps://aka.ms/o0ukef


From: Mike Dunston @.> Sent: Tuesday, September 5, 2023 5:44:30 PM To: openmrn/OpenMRNLite @.> Cc: Kevin Hastings @.>; State change @.> Subject: [EXTERNAL] Re: [openmrn/OpenMRNLite] mDNS not resolving when running ESP32WifiCanBridge (Issue #5)

If you are using the openmrn hub make sure to pass "-m" so it does advertise itself, the esp32 should be able to locate it and connect automatically.

— Reply to this email directly, view it on GitHubhttps://github.com/openmrn/OpenMRNLite/issues/5#issuecomment-1707348908, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BA6QOHXHFPCWSX3NMKALTMLXY6ML5ANCNFSM6AAAAAA4MH4CD4. You are receiving this because you modified the open/close state.Message ID: @.***>


This e-mail and any attachments may contain information that is confidential to Ross Video.

If you are not the intended recipient, please notify me immediately by replying to this message. Please also delete all copies. Thank you.

balazsracz commented 10 months ago

Could you capture the same log as what the screenshot above has? I'd like to see the example when it is working.