hvxl / otgwmcu

Firmware for the NodeMCU of the Nodo Shop WiFi version of the OTGW.
MIT License
7 stars 2 forks source link

After configuring, WIFI AP still visible and accessible #2

Open Chiuaua79 opened 3 years ago

Chiuaua79 commented 3 years ago

I have flashed this firmware to a nodeMCU and did the initial configuration to connect it to my wifi network. OTGW data is now accessible over port 25238 (using openHab BTW). Only issue I have is that the NodeMCU is still showing as open access point, which could be a security breach for my wireless network (hacking into it by connecting via phone near my house one might find the network password).

Even better: a configuration page where one could set static IP and reconfigure wifi details afterwards.

Krgds Cor

hvxl commented 3 years ago

Once the device is connected to a WiFi network as a station, it switches off the OTGW-MCU network. I have no idea why you believe there is still an open access point. You must either be looking at a different network, or a list of saved networks.

Your suggestion to set a static IP and access the device that way to configure the WiFi details won't work. The device needs to be connected to a WiFi network to be able to access it. It doesn't matter whether the IP address is static, or obtained via DHCP.

MaartenSanders commented 2 years ago

Mmmm, well I have the same. Although my nodemcu is connected to my wifi there still is an insecure AP active with the name ESP-5E3xxxxx. When I connect to that I can access the webpage of otgwmcu at 192.168.4.1 and I can see a living message log, so no cache. I am on 0.7.

hvxl commented 2 years ago

Can you indicate step by step how you arrived at that situation? Because when I follow the instructions on the web site with a blank esp8266, I get a working device, connected to my WiFi network and no open AP. The part that is most baffling is the SSID of the AP. If the firmware ever creates an AP, it sets it up with an SSID of OTGW-MCU.

MaartenSanders commented 2 years ago

Update: unfortunately not solved. Despite erasing the flash the ESP-5E3xxxxx Wifi AP appears again after a while and is accessible

I tried: esptool.py --port /dev/ttyUSB0 erase_flash first and then esptool -cp /dev/ttyUSB0 -cd nodemcu -cb 921600 -cf otgwmcu-fw.bin -ca 0x300000 -cf otgwmcu-fs.bin Unfortunately the issue is not solved. The ESP-5E3xxxxx Wifi AP appears again after a while and is accessible.

hvxl commented 2 years ago

Sounds like https://github.com/tzapu/WiFiManager/issues/1220 could be related. Although I would have expected erase_flash to wipe the old mode/credentials.

hvxl commented 2 years ago

Based on the discussion in the WiFiManager issue mentioned above, I added the suggested code to force the WiFi into station mode. Can you test if that fixes your issue?

You can download debug version 0.7.1 at https://otgw.tclcode.com/download/otgwmcu-0.7.1.zip. Only the firmware changed, so you don't have to reload the file system. The easiest way is to navigate to /upgrade.html on your device. Under "Firmware" click "Browse" and find the otgwmcu-fw.bin file extracted from the zip file. Then click "Update Firmware".

After it shows "OK", allow a few seconds for the device to reboot and connect to WiFi. Then you can check on the "About" page that it is running 0.7.1. Beware that if you click on the "Start" button for a firmware upgrade, it will load 0.7 again.

MaartenSanders commented 2 years ago

Yes, upgrade performed. This did the trick for me. No more insecure AP visible or available. Thank you!