I installed the software on a PI Zero W, but the signal strength of wlan0 is too weak to connect to my router. To overcome this, I connected a USB wireless antenna which registers as wlan1.
In order to make sure that wlan0 is not used, on the "advanced setting" page, I set the "Access Point time (sec):" to 0 and "WiFi Enabled/Disabled" to false. I then set an entry for wlan1 in /etc/dhcpcd.conf with an IP of 192.168.1.4.
The software however sets the local static IP to 192.168.1.172, which results in a permanent loss of connectivity to the Pi Zero. Any help would be appreciated.
cat /etc/dhcpcd.conf
[snip]
# Custom static IP address for wlan1.
interface wlan1
arping 192.168.1.254
profile 192.168.1.254
static ip_address=192.168.1.4/24
static routers=192.168.1.254
static domain_name_servers=192.168.1.254
The last logged messages are:
tail -f /var/log/syslog
[snip]
19:59:01 hydrosys4.selectedplanmod - INFO Start heartbeat routine 2021-08-07 19:59:01
19:59:01 hydrosys4.selectedplanmod - INFO Read sensor data: TimeTrigger - 2021-08-07 19:59:01
19:59:01 hydrosys4.hardwaremod - INFO Sensor TimeTrigger reading: 0.00
19:59:01 hydrosys4.automationmod - INFO Starting Automation Evaluation, Sensor: TimeTrigger
19:59:01 hydrosys4.autowateringmod - INFO Starting Autowatering Evaluation
19:59:01 hydrosys4.selectedplanmod - INFO Heartbeat check , wifi disabled
19:59:01 hydrosys4.selectedplanmod - WARNING not able to establish an internet connection
19:59:01 hydrosys4.selectedplanmod - INFO Check system clock vs NTP (Network Time Protocol)
19:59:01 hydrosys4.selectedplanmod - INFO Network time NTP: 07/08/2021 19:59
19:59:01 hydrosys4.selectedplanmod - INFO System time NTP: 07/08/2021 19:59
19:59:01 hydrosys4.selectedplanmod - INFO Difference between system time and network time, diffsec = 0
19:59:01 hydrosys4.selectedplanmod - INFO Clock OK
19:59:01 hydrosys4.selectedplanmod - INFO Target IP address= 192.168.1.172. Current access point IP addresses= 192.168.1.4 2a02:8070:a28f:1300:eaa0:e255:484a:1d3c
19:59:01 hydrosys4.selectedplanmod - WARNING Local Static IP address not in the list, Set Target IP address
19:59:01 hydrosys4.networkmod - INFO Check if the Gateway IP address has same subnet of statip ip
19:59:06 hydrosys4.networkmod - INFO IP route Output Line = default via 192.168.1.254 dev wlan1 src 192.168.1.4 metric 303
19:59:06 hydrosys4.networkmod - INFO IP route Output Line = 192.168.1.0/24 dev wlan1 proto dhcp scope link src 192.168.1.4 metric 303
19:59:06 hydrosys4.networkmod - INFO IP route Output Line =
19:59:06 hydrosys4.networkmod - INFO No default Gateway for wlan0
19:59:06 hydrosys4.networkmod - INFO Set Local Static IP: 192.168.1.172
Hello, many thanks for the analysis of the issue and the detailed explanation. I see you are very experienced with network setting.
Have to say that when I wrote the part of the code relevant to the network I was just thinking to very narrow use cases (e.g. Wlan0 only). But your observations are on point. Maybe in the future I'd rewrite some core parts of the Code.
Probably a quick fix for the problem is to allow the choice of wlan0 or wlan1 for the network connection. (but not for the AP mode)
One Question, what is the type of wireless device that you are using? Wireless connections can be useful for remote locations so your case is quite interesting.
I hope I'm not being too quick here, but I think I have solved the problem.
Looking at the code, it seems that it is very opinionated in its network handling or rather its handling of wlan0.
The code does its best to (re-)start wlan0, so trying to suppress this with "denyinterfaces wlan0" in /etc/dhcpcd.conf or an "@reboot ifdown wlan0" entry in the crontab does not work.
The solution to this was setting "WiFi Enabled/Disabled" to "true" on the "advanced setting" page. This does not stop wlan0 being started, but somewhere along the way it is in fact disabled.
Setting "Access Point time (sec):" to "0"on the same page does not in fact stop the AP from being started, but will limit its life span so less than 60 seconds after a reboot.
Setting the "WiFi IP Address" to "192.168.1.4" on the same page stopped the code from trying to set the IP address to "192.168.1.172" and thus making the Pi Zero unreachable.
Finally, disabling IP6 in /etc/sysctl.conf stopped the following and I presume the code trying to reset the IP address to something again making the Pi Zero unreachable
hydrosys4.selectedplanmod - INFO Target IP address= 192.168.1.4. Current access point IP addresses= 192.168.1.4 2a02:8070:a28f:1300:2b83:69d2:e126:b47e
So now all the inbound and outbound network traffic is limited to wlan1 which has decent connectivity to the router.