Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add wifi config instead of replacing it when using the UI #401

Closed
petschni opened this issue Dec 20, 2018 · 10 comments
Closed

Add wifi config instead of replacing it when using the UI #401

petschni opened this issue Dec 20, 2018 · 10 comments

Comments

@petschni
Copy link
Contributor

If I read the code correctly currently when you enter new wifi it will replace any existing, correct?

I think it would be a nice enhancement if the new wifi just gets added to the config and does not replace existing ones. I am happy to contribute the code if that is a feature more people would like to have and if it makes sense to you @MiczFlor ?

@ndd
Copy link

ndd commented Dec 20, 2018

To add multiple wifi networks you can simply add and ssid section into dhcpd.conf.

https://github.com/MiczFlor/RPi-Jukebox-RFID/wiki/MANUAL#faq

Do you mean like this?

@gizmo21
Copy link
Contributor

gizmo21 commented Dec 20, 2018

This is a section I added https://github.com/MiczFlor/RPi-Jukebox-RFID/wiki/MANUAL#i-want-to-add-another-wi-ssid-eg-at-a-friend

On top there is a "hidden" .sh in the frontend to easily add new wifis the the correct files, just open in browser:

< yourphonieboxip >/userScripts.php
or
phoniebox/userScripts.php

select the addhotspot.sh and add the
< newssid > < newpassword >
in the parameterfield. The new wifi is then added and perhaps you need a reboot to have it connect to it.

atm priority of wifis has to be added manually, but usually only one wifi is at one place so priority is not that important then. Only using your phone as hotspot could be a matter of setting a higher prio, so always your phone beats the other wifi available.

More info here:
https://github.com/MiczFlor/RPi-Jukebox-RFID/blob/master/htdocs/userScripts.php

https://github.com/MiczFlor/RPi-Jukebox-RFID/blob/master/scripts/userscripts/addhotspot.sh

all this is a fire-and-forget adding of SSIDs so no edit is possible in frontend.

@MiczFlor
Copy link
Owner

Hi @gizmo21
thanks for pointing to your section in the wiki. I am hesitant to spend too much time on making both options in one. Parsing config files is something I don't like doing, because usually it will go wrong for someone and or with the next OS update, and then it's a neverending bug catching,
@petschni if you want to give this a shot, I would love to see your approach - and you might know a better way to add this AND make it future proof. So please go ahead,
All the best, micz

@gizmo21
Copy link
Contributor

gizmo21 commented Dec 23, 2018

Hey @MiczFlor didn't want you to do anything with it, you have enough to fix in maincode to get a stable version out.
Was just to show @petschni that an alpha version is already there.

And coincidentally just successfully tested it at the grandparents wifi, by entering the wifi credentials at home with my .sh method and now booted the box at the grandparents and it connected correctly.

btw. In frontend now the new SSID shows with hashed psk password instead of plaintext one.

@petschni
Copy link
Contributor Author

@gizmo21 did not know about that option - thanks for pointing it out! It pretty much does what my use case would be. Would love to see that being integrated in the "main ui".

@MiczFlor My idea around the logic was:

if(!wpa_supplicant.conf) {
     // use your template and add the data from the wifi
} else if(wpa_supplicant.conf && wifiNameExistsAlready){
    // replace the password with the new value (could cause parsing issues...)
} else {
    // add the new config to the end of the file
}

@Yordan1976
Copy link
Contributor

addhotspot.sh couldn't be executed on a fresh installation.
-> chmod 775 /home/pi/RPi-Jukebox-RFID/scripts/userscripts/addhotspot.sh

@sikraemer
Copy link
Contributor

sikraemer commented Aug 13, 2019

Hi,

a friend of my and I recently build a phoniebox.
At first we were thinking of adding some AP mode to configure the Wifi settings at new locations (Hotels, Grandparents, etc.) but we decided it would be easier to just connect to a AP that we could open on our phones.

Our version now has not only one Wifi but multiples and even provide them with a priority.
Also the interface now shows the network the box is connected to at the moment (helpful when connected via ethernet).

Should I create a pull request for the change or should I rather provide the changes separately on GitHub.

@MiczFlor
wifi_config

@MiczFlor
Copy link
Owner

Hi @sikraemer
Please create a pull request. And write a few lines hiw it operates so i can invlude it in rhe documentation.
All the best, micz

@sikraemer
Copy link
Contributor

Hi @MiczFlor

Today I found time to create the pull request: #565

How detailed would you like the description?
Technical background or just how it behaves in the GUI?

Kind regards,
Simon

@MiczFlor
Copy link
Owner

Hi @sikraemer
coming back to your contribution from August: I meant a end user information, what it does and how to make use of it. Sorry for the late reply :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants