nksan / Rpi-SetWiFi-viaBluetooth

Python BLE Server for RPi Accepts setting wifi (SSID) via bluetooth
MIT License
22 stars 5 forks source link

Does the reboot delay always happen or only if the wifi setup changes? #4

Open thk686 opened 4 months ago

thk686 commented 4 months ago

Sorry for the simple question. I am hoping this will just boot normally if the currently configured wifi network is not found. Also, is there a way to trigger this on loss of wifi connectivity, for example, the passkey is changed?

nksan commented 4 months ago

Not sure I understand the first part of the question. Configured networks are either stored in the wpa_supplicant.conf file (RaspOS pre-bookwork) - or as networks by Network Manager (bookworm, ubuntu etc.). All this app those is allow you to create/edit these files via bluetooth. When you reboot the RPi, it will select whatever preconfigured network is stored in these files and connect (if in range). My experience with wpa_supplicant is that it can get a bit wonky if you have two different Access Points with similar strength within range (it may switch on its own). Basically connectivity to pre-configured networks is managed by the RPi OS.
When the RPi boots, if there are no pre configured networks then the RPi boots normally but is not connected to wifi.

In all cases, if you do not change the default, every time the RPi reboots, the python code here will run for 15 minutes and shut down. the idea is that if you do not have wifi connected after reboot - use the BTWifiBerry app on your iPhone to set the parameters of the correct network.

Regarding your second question: you would have to write some code (possibly a python script that runs as a deamon (systemD probably) that monitors the wifi connection and starts this service (btwifiset).
Frankly, if you loose wifi connection due to a change passkey, just reboot the RPi. then you have 15 minutes to set the new passKey.

thk686 commented 4 months ago

Sorry my question was so vague. My use case is a pi in a water-tight box in the western Amazon. Field station personnel are not especially tech savvy and like to change the wifi network ssid/password every year or so. If they don't give me warning, I will lose the connection and someone on-site will have to change the configuration. Opening up the box, pulling the ssd and burning a new image is not a great option. So I am trying to decide what to do. I think I will explore a captive portal (sdm has a plugin) that launches when network connectivity is lost for more than a specified period of time.

On Sat, Jul 27, 2024 at 9:32 AM nksan @.***> wrote:

Not sure I understand the first part of the question. Configured networks are either stored in the wpa_supplicant.conf file (RaspOS pre-bookwork) - or as networks by Network Manager (bookworm, ubuntu etc.). All this app those is allow you to create/edit these files via bluetooth. When you reboot the RPi, it will select whatever preconfigured network is stored in these files and connect (if in range). My experience with wpa_supplicant is that it can get a bit wonky if you have two different Access Points with similar strength within range (it may switch on its own). Basically connectivity to pre-configured networks is managed by the RPi OS. When the RPi boots, if there are no pre configured networks then the RPi boots normally but is not connected to wifi.

In all cases, if you do not change the default, every time the RPi reboots, the python code here will run for 15 minutes and shut down. the idea is that if you do not have wifi connected after reboot - use the BTWifiBerry app on your iPhone to set the parameters of the correct network.

Regarding your second question: you would have to write some code (possibly a python script that runs as a deamon (systemD probably) that monitors the wifi connection and starts this service (btwifiset). Frankly, if you loose wifi connection due to a change passkey, just reboot the RPi. then you have 15 minutes to set the new passKey.

— Reply to this email directly, view it on GitHub https://github.com/nksan/Rpi-SetWiFi-viaBluetooth/issues/4#issuecomment-2254165155, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEQXSPJYQDZZJCZNM2GZJDZOOVQXAVCNFSM6AAAAABK5SW4WOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENJUGE3DKMJVGU . You are receiving this because you authored the thread.Message ID: @.***>

-- Timothy H. Keitt www keittlab org

grinkemd commented 4 months ago

You are kidding..? My use case is the same. I am guessing our boxes have a different purpose, odd coincidence.Sent from my iPhoneOn Jul 30, 2024, at 3:07 PM, Timothy Keitt @.***> wrote: Sorry my question was so vague. My use case is a pi in a water-tight box in

the western Amazon. Field station personnel are not especially tech savvy

and like to change the wifi network ssid/password every year or so. If they

don't give me warning, I will lose the connection and someone on-site will

have to change the configuration. Opening up the box, pulling the ssd and

burning a new image is not a great option. So I am trying to decide what to

do. I think I will explore a captive portal (sdm has a plugin) that

launches when network connectivity is lost for more than a specified period

of time.

On Sat, Jul 27, 2024 at 9:32 AM nksan @.***> wrote:

Not sure I understand the first part of the question. Configured networks

are either stored in the wpa_supplicant.conf file (RaspOS pre-bookwork) -

or as networks by Network Manager (bookworm, ubuntu etc.). All this app

those is allow you to create/edit these files via bluetooth. When you

reboot the RPi, it will select whatever preconfigured network is stored in

these files and connect (if in range). My experience with wpa_supplicant is

that it can get a bit wonky if you have two different Access Points with

similar strength within range (it may switch on its own).

Basically connectivity to pre-configured networks is managed by the RPi OS.

When the RPi boots, if there are no pre configured networks then the RPi

boots normally but is not connected to wifi.

In all cases, if you do not change the default, every time the RPi

reboots, the python code here will run for 15 minutes and shut down. the

idea is that if you do not have wifi connected after reboot - use the

BTWifiBerry app on your iPhone to set the parameters of the correct network.

Regarding your second question: you would have to write some code

(possibly a python script that runs as a deamon (systemD probably) that

monitors the wifi connection and starts this service (btwifiset).

Frankly, if you loose wifi connection due to a change passkey, just reboot

the RPi. then you have 15 minutes to set the new passKey.

Reply to this email directly, view it on GitHub

https://github.com/nksan/Rpi-SetWiFi-viaBluetooth/issues/4#issuecomment-2254165155,

or unsubscribe

https://github.com/notifications/unsubscribe-auth/AAEQXSPJYQDZZJCZNM2GZJDZOOVQXAVCNFSM6AAAAABK5SW4WOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENJUGE3DKMJVGU

.

You are receiving this because you authored the thread.Message ID:

@.***>

--

Timothy H. Keitt

www keittlab org

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: @.***>

NormFrenette commented 4 months ago

Guys Somebody in Florida contacted me - he was going to make some sort of Fish Finder based on a raspeberyy pi that streamed to a wifi on the boat. You are not alone.

To answer your question: this app is made for your problem. run the install "curl" command (in the Readme on this site) on your pi - BEFORE you seal it in the Raspbery Pi enclosure. Then have somebody who is a bit tech savy (not much needed) - download the app on an iphone or iPad.
Whenever you need to change the wifi on the Pi - reboot the pi - which starts the btwifiset service, and set the new wifi ssid/password. The only problem with under water is that your Raspberry Pi bluetooth will not get through: You need the antenna to be able to receive/broadcast wifi signals. A few options: make the enclosure out of plastic (not metal) and have a way to bring the RPi to the surface when you need to change the wifi. or: get a bluetooth antenna and weld it to the pads on the raspberry pi - then sting out a wire out of the enclosure - that comes out of the water.

finally - if your product has an app - we can integrate my app inside yours (I've done that before). But if it;s not a bog commercial product and you don't mind just using the iphone app - you're all set.

Norm

thk686 commented 4 months ago

Haha, cool. Would be great to hear more about your work. Drop me a note @.***

On Tue, Jul 30, 2024 at 6:31 PM grinkemd @.***> wrote:

You are kidding..? My use case is the same. I am guessing our boxes have a different purpose, odd coincidence.Sent from my iPhoneOn Jul 30, 2024, at 3:07 PM, Timothy Keitt @.***> wrote: Sorry my question was so vague. My use case is a pi in a water-tight box in

the western Amazon. Field station personnel are not especially tech savvy

and like to change the wifi network ssid/password every year or so. If they

don't give me warning, I will lose the connection and someone on-site will

have to change the configuration. Opening up the box, pulling the ssd and

burning a new image is not a great option. So I am trying to decide what to

do. I think I will explore a captive portal (sdm has a plugin) that

launches when network connectivity is lost for more than a specified period

of time.

On Sat, Jul 27, 2024 at 9:32 AM nksan @.***> wrote:

Not sure I understand the first part of the question. Configured networks

are either stored in the wpa_supplicant.conf file (RaspOS pre-bookwork)

or as networks by Network Manager (bookworm, ubuntu etc.). All this app

those is allow you to create/edit these files via bluetooth. When you

reboot the RPi, it will select whatever preconfigured network is stored in

these files and connect (if in range). My experience with wpa_supplicant is

that it can get a bit wonky if you have two different Access Points with

similar strength within range (it may switch on its own).

Basically connectivity to pre-configured networks is managed by the RPi OS.

When the RPi boots, if there are no pre configured networks then the RPi

boots normally but is not connected to wifi.

In all cases, if you do not change the default, every time the RPi

reboots, the python code here will run for 15 minutes and shut down. the

idea is that if you do not have wifi connected after reboot - use the

BTWifiBerry app on your iPhone to set the parameters of the correct network.

Regarding your second question: you would have to write some code

(possibly a python script that runs as a deamon (systemD probably) that

monitors the wifi connection and starts this service (btwifiset).

Frankly, if you loose wifi connection due to a change passkey, just reboot

the RPi. then you have 15 minutes to set the new passKey.

Reply to this email directly, view it on GitHub

< https://github.com/nksan/Rpi-SetWiFi-viaBluetooth/issues/4#issuecomment-2254165155>,

or unsubscribe

< https://github.com/notifications/unsubscribe-auth/AAEQXSPJYQDZZJCZNM2GZJDZOOVQXAVCNFSM6AAAAABK5SW4WOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENJUGE3DKMJVGU>

.

You are receiving this because you authored the thread.Message ID:

@.***>

--

Timothy H. Keitt

www keittlab org

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/nksan/Rpi-SetWiFi-viaBluetooth/issues/4#issuecomment-2259366557, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEQXSL6RR46AQET6RW2VKLZPAO4VAVCNFSM6AAAAABK5SW4WOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENJZGM3DMNJVG4 . You are receiving this because you authored the thread.Message ID: @.***>

-- Timothy H. Keitt www keittlab org

thk686 commented 4 months ago

My devices are not underwater although it seems like it sometimes.

On Tue, Jul 30, 2024 at 7:25 PM NormFrenette @.***> wrote:

Guys Somebody in Florida contacted me - he was going to make some sort of Fish Finder based on a raspeberyy pi that streamed to a wifi on the boat. You are not alone.

To answer your question: this app is made for your problem. run the install "curl" command (in the Readme on this site) on your pi - BEFORE you seal it in the Raspbery Pi enclosure. Then have somebody who is a bit tech savy (not much needed) - download the app on an iphone or iPad. Whenever you need to change the wifi on the Pi - reboot the pi - which starts the btwifiset service, and set the new wifi ssid/password. The only problem with under water is that your Raspberry Pi bluetooth will not get through: You need the antenna to be able to receive/broadcast wifi signals. A few options: make the enclosure out of plastic (not metal) and have a way to bring the RPi to the surface when you need to change the wifi. or: get a bluetooth antenna and weld it to the pads on the raspberry pi - then sting out a wire out of the enclosure - that comes out of the water.

finally - if your product has an app - we can integrate my app inside yours (I've done that before). But if it;s not a bog commercial product and you don't mind just using the iphone app - you're all set.

Norm

— Reply to this email directly, view it on GitHub https://github.com/nksan/Rpi-SetWiFi-viaBluetooth/issues/4#issuecomment-2259411214, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEQXSOKWJI4QKZUDXMJWBLZPAVIVAVCNFSM6AAAAABK5SW4WOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENJZGQYTCMRRGQ . You are receiving this because you authored the thread.Message ID: @.***>

-- Timothy H. Keitt www keittlab org

NormFrenette commented 4 months ago

Above water : In this case what I explained will work. re-reading your post - you seem to want the service to start when connectivity is lost?
I'm trying to understandthe use case: Are you remoting (from a different location) into the RPi via wifi to perform some work, and you loose the connection when they change the wifi password without warning? Do you have somebody on site with an iphone/ipad who can reboot the RPi and reset the password on the it using the iphone app? Since this is a bluetooth app, you would need to have the apple device near enough the RPi.

PS: I must be missing something - as I do not see how a captive portal helps if the RPi is not connected to wifi.

thk686 commented 4 months ago

I can't rely on the availability of an iphone. I am thinking a wifi solution will be more robust. All they need to do is update the ssid/password.

On Wed, Jul 31, 2024 at 12:48 PM NormFrenette @.***> wrote:

Above water : In this case what I explained will work. re-reading your post - you seem to want the service to start when connectivity is lost? I'm trying to understandthe use case: Are you remoting (from a different location) into the RPi via wifi to perform some work, and you loose the connection when they change the wifi password without warning? Do you have somebody on site with an iphone/ipad who can reboot the RPi and reset the password on the it using the iphone app? Since this is a bluetooth app, you would need to have the apple device near enough the RPi.

PS: I must be missing something - as I do not see how a captive portal helps if the RPi is not connected to wifi.

— Reply to this email directly, view it on GitHub https://github.com/nksan/Rpi-SetWiFi-viaBluetooth/issues/4#issuecomment-2261046064, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEQXSJWM2GCH5EAOQAPPGDZPEPQNAVCNFSM6AAAAABK5SW4WOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENRRGA2DMMBWGQ . You are receiving this because you authored the thread.Message ID: @.***>

-- Timothy H. Keitt www keittlab org

NormFrenette commented 4 months ago

right makes sense. if you turn on wifi access point when you loose connectivity, anybody with a computer can connect to it and update the ssid/password using nmcli (Network Manager)