Dietpi wifi setup remotely

Have some feedback, questions, suggestions, or just fancy a chat? Pop it in here.
Post Reply
richacker
Posts: 1
Joined: Sun Aug 30, 2020 5:28 pm

Dietpi wifi setup remotely

Post by richacker »

Hi,

I am trying to create a hub using dietpi on my pi zero. I want dietpi configured pi to act as hotspot and broadcasting its SSID. This SSID will be connected using my app on mobile device and I will have the option to enter SSID and password of my wifi router which dietpi will receive and write into its wifi credentials file.

App side I have the code ready. On the pi side as well, I have the code to receive the credentials from app once connected using hotspot. I need 2 things:
1. Make pi act as hotspot to connect using my mobile device.
2. Configure wifi credentials for my dietpi from inside pi using a script.

This I was able to achieve on my raspbian using the following code, but on dietpi, I have to go through dietpi-config to do the same.

Create hotspot:

Code: Select all

sudo sed -i -e "s/#nohook wpa_supplicant/nohook wpa_supplicant/g" -e  "s/#interface wlan0/interface wlan0/g" -e "s/#static ip/static ip/g" 
/etc/dhcpcd.conf
sleep 1s
sudo systemctl enable hostapd
sleep 1s
sudo systemctl enable dnsmasq
sleep 1s
sudo systemctl start hostapd
sleep 1s
sudo reboot
Wifi Credentials I could write to: /etc/wpa_supplicant/wpa_supplicant.conf

Any help would be appreciated!
User avatar
Joulinar
Posts: 2277
Joined: Sat Nov 16, 2019 12:49 am

Re: Dietpi wifi setup remotely

Post by Joulinar »

Hi,

any thanks for your message. What exactly you need to do on dietpi-config?

On DietPi, first thing to ensure is to enable WiFi by removing dtoverlay=disable-wifi from /boot/config.txt.

Code: Select all

G_CONFIG_INJECT 'dtoverlay=disable-wifi' '#dtoverlay=disable-wifi' /boot/config.txt
reboot
Packages like hostapd and dnsmasq are not preinstalled. They would need to be installed by running:

Code: Select all

dietpi-software install 60
reboot
Side note: DietPi is using isc-dhcp-server instead of dnsmasq.

Hotspot configuration is done based on input from /boot/dietpi.txt

Code: Select all

root@DietPi4:~# cat /boot/dietpi.txt|grep SOFTWARE_WIFI_HOTSPOT
SOFTWARE_WIFI_HOTSPOT_SSID=DietPi-HotSpot
SOFTWARE_WIFI_HOTSPOT_KEY=dietpihotspot
SOFTWARE_WIFI_HOTSPOT_CHANNEL=3
root@DietPi4:~#
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
Post Reply