pihome
pihome copied to clipboard
Button for wifi reset
I was thinking about adding a button to the RPi GPIO wich would put it into access point mode for the configuration of the home newtwork(reset button). Steps:
- Python script to put Raspberry Pi into access point mode when button is pushed so PiHOME settings cand be changed.
- Web UI to update SSID and password in wpa_supplicant.conf (maybe rewrite it completely) and restart the RPi. This is useful when router network settings are changed.
I have an idea about the python script but the web UI is php and not my area of expertise. We would need hostapd and the ISC DHCPD server. What do you think?
brilliant idea, i was thinking something like if rpi not connected to wifi or network then make it access pint automatically but button would be better option so gives user control over this.
I was thinking of using hostapd and the ISC DHCPD server. Preconfigured etc/hostapd/hostapd.conf
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.50 192.168.1.60;
option broadcast-address 192.168.1.255;
option routers 192.168.1.100;
default-lease-time 600;
max-lease-time 7200;
option domain-name “pihome.local”;
option domain-name-servers 8.8.8.8, 8.8.4.4;
}
The script reads like this: Button attached to physical pin 5 on the RaspberryPi is pressed for 10 seconds. The network configuration is changed and the Pi gets into access point mode. Connecting to the access point and going to the preconfigured domain name (pihome.local) we can access the web interface and set the SSID and password. A reboot is needed and the Pi should connect to wifi. This method needs some testing.
@sandreialexandru once again great work, when i press the button for 10 seconds rpi becomes as access point, thinking out loud, anyway to we can setup simple web portal or simple webpage and ask user to enter wifi details and save and reboot rpi
I'm still working on finding a solution to this. Current kernel has issues with wifi driver for acces point and hostapd does not start. If we succeed to turn Pi into access point there would not be the need for a web portal because we could access apache web server wich runs PiHOME. A settings section could rewrite the /etc/wpa_supplicant.conf and reboot the Pi.
@sandreialexandru have look at raspap-webgui maybe you can find solution how they are doing this.
After many searches and almost giving up, I have found a solution to our problem here
Steps:
- I never got it working without doing
rpi-update
in the console, so do that -
curl "https://www.raspberryconnect.com/images/hsinstaller/AutoHotspot-Setup.tar.gz" -o AutoHotspot-Setup.tar.gz
-
tar -xzvf AutoHotspot-Setup.tar.gz
-
cd Autohotspot
-
sudo ./autohotspot-setup.sh
Stopping here works fine, but I have gone a little further. I thought it would be nice to have the name of the hotspot "PiHOME" with "pihome" as the password so I changed those. The script verifies an md5 for the files so I have eliminated that. The rest remains the same.
After the hotspot is up and we are connected we can navigate to 10.0.0.5 and login into PiHOME
The script runs at every boot and creates a hotspot when no credentials are found for a wifi network in range. If we delete the file /etc/systemd/system/autohotspot.service the script won't start at every boot and we can call it with a button and python.(script bellow)
To install the modified version, copy the archive bellow to the root directory follow steps 3, 4, 5. When asked I have chosen option 2 Install Autohotspot with No Internet for connected devices Autohotspot.tar.gz
Is this compatible with other sbc? i.e orange pi etc?
On 21 Oct 2020, at 12:25, sandreialexandru [email protected] wrote:
After many searches and almost giving up, I have found a solution to our problem here
Steps:
I never got it working without doing rpi-update in the console, so do that curl "https://www.raspberryconnect.com/images/hsinstaller/AutoHotspot-Setup.tar.gz" -o AutoHotspot-Setup.tar.gz tar -xzvf AutoHotspot-Setup.tar.gz cd Autohotspot sudo ./autohotspot-setup.sh Stopping here works fine, but I have gone a little further. I thought it would be nice to have the name of the hotspot "PiHOME" with "pihome" as the password so I changed those. The script verifies an md5 for the files so I have eliminated that. The rest remains the same.
After the hotspot is up and we are connected we can navigate to 10.0.0.5 and login into PiHOME
The script runs at every boot and creates a hotspot when no credentials are found for a wifi network in range. If we delete the file /etc/systemd/system/autohotspot.service the script won't start at every boot and we can call it with a button and python.(script bellow)
WiFi_button_script.zip
To install the modified version, copy the archive bellow to the root directory follow steps 3, 4, 5. When asked I have chosen option 2 Install Autohotspot with No Internet for connected devices Autohotspot.tar.gz
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.
I have tested it only on RPi 3B+ and RPi Zero W. I can't say for sure, because I have no any other sbc to test on, but I believe it should work as long as the wifi chip is capable of "listening" mode.
I m waiting for orange pi delivery any day, once i have it i”ll give it a try, thank you for working on this.
On 21 Oct 2020, at 15:52, sandreialexandru [email protected] wrote:
I have tested it only on RPi 3B+ and RPi Zero W. I can't say for sure, because I have no any other sbc to test on, but I believe it should work as long as the wifi chip is capable of "listening" mode.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.
Response from the creator of the script: This installer is set to only work on Raspberry PI OS (Raspbian) specifically. As Linux uses different network managers I can't guarantee it will work on other setup as it required dhcpcd.
I see Orange Pi has Debian as a listed OS. If that version is using dhcpcd as the network manger instead of dhcp or other network manager then the script will most likely work. The file /etc/network/interfaces must not be used with this as it will conflict. Lots of older guides online will use this file for network config.
you can check with sudo systemctl status dhcpcd
if it returns with Active: active (running) then it probably work if you follow the manual guides. I would be interested to know if you do try it.
I will look at other OS at a future point and see what needs be modified.
Speaking of wifi reset, has anyone managed lately to get a fallback access point for the gateway?
no i haven't, still waiting for orange pi delivery,
Sorry! I meant the WiFi gateway, not serial gateway.
Yes i have WiFi gateway at home and works great, why you asking?
I have recently tried the Double Reset Detector library and the WiFiManager library, but none of them seem to work. I want to get an access point fallback for the gateway and not have to re-flash the NodeMCU for every SSID
I have different sketch that i m using with with custom wifimanager library, if you want i can share with you, including library, it has its web interface with some stats and fall back to access point when wifi not available.
On 25 Oct 2020, at 19:58, sandreialexandru [email protected] wrote:
I have recently tried the Double Reset Detector library and the WiFiManager library, but none of them seem to work. I want to get an access point fallback for the gateway and not have to re-flash the NodeMCU for every SSID
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.
That would be great! Thank you in advance!
@sandreialexandru committed update to ESP8266 gateway sketch
Thank you! Will download and try.
I can't get this to work because wifi_ssid and wifi_password are not defined
did you move wifimanager library to your library folder (i placed it in same folder)
Yes, I've replaced it with the one that you gave me
Hi,
I've tried the autohotspot script on a Banana Pi M2 Zero and after a few tweeks got it to work, the main problem was that Armbian uses NetworkManager rather than wpasupplicant, but this was no problem to re-configure, also had to install dhcpcd, and modify the installer script.
I see this being useful when setting-up from an img file where a wired connection is not available, if building from scratch then you would have already sorted out the network connections.
In the img file case wifi will not be configured and the system will default to a hot-spot and the user can connect to the GUI to configure the wifi and reboot.
Can we make single install script for all boards ?
I guess so, will have a look.
By the way there is a bug in the code - in file /config/hostapd the line DAEMON_CONF="/etc/hostapd/hostapd.config" should read DAEMON_CONF="/etc/hostapd/hostapd.conf"
Hi,
Patched version which will install on Raspbian or Armbian, fixed /config/hostapd and recalculated md5 checksums
Will run as AP if no wifi credentials have been set
An update to fix a couple of Armbian issues, the SSID is PiHomeHotspot and the password is 1234567890
Hi,
I think this is now working, if not connected to your local wifi network it will startup as a hotspot called PiHome, the IP address will be either 192.168.50.5 or 10.0.0.5, depending if you chose option 1 or 2 in the setup, the password is 1234567890
You can connect with a browser and if in hotspot mode it will enable you to select a SSID and enter the password and then Set and Reboot into connected mode, with the usual login page
Attached the latest setup package and new index.php, please re-run autohotspot-setup.sh as it now adds sudo access for the wifi configuration
@twa127 amazing work! Thank you!
that is really amazing work, one question though, what if my raspberry pi connected to wired connection?