OpenEnergyMonitor Community

Access Point fallback for emonSD

Tags: #<Tag:0x00007fc0abeb62e8> #<Tag:0x00007fc0abeb5f28>

Would anyone know how a RaspberryPi could fallback on AP mode if the configured wifi was unavailable?

At the moment the behaviour of emonSD is (if configured to connect to a wifi network) to just keep trying to connect to that network it’s been configured for. I think if multiple SSIDs are added to the wpa_supplicant.conf that it’d try them too, not sure.

I’d like to config the rPi such that if the wifi isn’t available anymore, it’d go back into AP mode and broadcast it’s ‘emonPi’ SSID so it can be reconfigured. Thinking a cron job…

It’s so I can have a device I can move around more easily, show it off :slight_smile:

Any ideas?

Perhaps a couple of pointers:

On boot the pi calls the following script from rc.local to check whether to start an AP or continue with connection as a client:

/opt/openenergymonitor/emonpi/wifiAP/ >> /var/log/wifiAP.log

Here’s the script:

The script checks if ethernet is connected or if the pi is already connected as a client. If neither are true it checks if there is a wifi configuration in wpa_supplicant, if thats empty it then starts an access point.

You might be able to change that logic around a bit and run from a cronjob to get the result that you’re after …

Thanks Trys, that got me started.
Found this too: Force the Emonpi to AP-mode