-
Notifications
You must be signed in to change notification settings - Fork 271
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
Not connecting to SSID2 - [solved] #1246
Comments
It's not yet implemented, as you found out correctly. |
I agree. Maybe some change like this: http_fns.zip |
Anyway, I need SSID2 and will make some simple changes in the code to make it working somehow. If it's at least somewhat usable, I'll post it here. |
I have SSID2 simple mod done. It is tested on BK7231N, but with these simple changes it should work on any platform. How does it work: Here are the differences: |
If You will find it OK, I can submit these changes here. |
Thanks for your code! My personal approach would be a bit different, I would make the first SSID "preferred" so in pseudo code (I will "rename" SSID to SSID1 to get it clearer ;-)): If WiFi is connected, reset counter. But I hope it's o.k. if I give some feedback on your code?
with this "change" (0=SSID1 and 1=SSID2) the check can be very short:
Not tested, just coded ;-) Of course, "CFG_GetWiFiSSIDX()" and "CFG_GetWiFiPassX()" need modification, to to reflect 0 and 1 (instead of 1 and 2) for SSID and SSID2 Once again, I really appreciate your code, it's meant as a positive feedback. |
I understand, but the reason for int g_SSIDactual = 0=first time was that: |
For example, if it is a device that changes location, then if there is a prefered SSID parameter, the preferred SSID could be changed by script when device changes location. Switching to another SSID usually takes about 1 minute after restart. |
... but even with more SSIDs I don't see why we can't simply set the SSID to the (wished) preferred SSID and then start the process. In "my" proposal: If you prefer SSID2, set g_SSIDactual=1 once, before starting the process. So a "set_preferred_ssid" would mean: "g_SSIDactual= (preferred SSID) ;g_SSIDSwitchCnt = 0;" |
OK. I agree. The power is in simplicity. I will change it. |
BTW: Even if you want to go for more than 2 SSIDs in the future, I would propose to "start" with 0 for SSID1. |
very good job guys, thank you, but here is one issue to fix: Apart from that, seems good so far, open PR when you're ready |
Thanks, I'm 95% Pascal+SQL and 5% the others ;-) |
very nice. good 1st steps! just a suggestion: on tasmota there is also a fallback to AP mode if none of the SSIDs arent available (on case of wrong pw or low signal). for 120s the default AP pops up and waits for connection. when time´s up it switches to SSID scan mode again. so you are able to recover you device in almost any case. |
Just as a quick feedback: It's not working on LN882H :-( but probably thats not related to your code but something more general - WiFi is done by libs which are not always handling things the same way.... I'm trying to dig into this issue |
o.k., it took some time, but I figured out some issues with the actual code (at least on LN882H): The "culprit" is the function
I changed this to:
the changes are: The result was, that after the first call to I hope, I understood the mechanism right, then the original code did not worked, as expected?
Since this is a crucial code I would ask for "someone" who knows the code (openshwprojects ?!?) to take a look. |
Agreed, the hardest thing is always to understand how the original programmer meant it and how it is supposed to work. Careful with this Connect and Disconnect. |
I've posted updates to main...xjikka:OpenBK7231T_App:ssid2mod @g6094199 - Automatic switching to AP is not a good idea, in case of random WiFi unavailability (and subsequent switching to AP mode), the module would only be available via AP - it would no longer connect to normal WiFi without a restart. |
as is said, the AP should be with a timer of e.g. 120 sec an should teh switch back to client mode again.n this will prevent your mentioned problem. |
@g6094199 I also think this would be a good feature, but at the moment I can't think about a working solution for this: Enabling AP mode is only a possibility during startup (if on day 32 WiFi fails at 10:43, who knows that up to 10:45 you can use the AP). |
thx for the feedback |
When we want to test second SSID on alpha app version? 🙃 |
I'll prepare binaries asap. Be patient. |
Asap is over ;-) here the binaries. Hope everything is ok, compiled using docker image. Alpha version for testing purposes only, do not use it in "live" devices. I only tested the OpenBK7231N version OpenBK7231N_dev_20240527_195910.rbl and on an simple Tuya Smart Switch device only. |
PR #1254 |
Why do you want to open AP if there is no WiFi? It sounds like a terrible security threat. Many people are living in flats with neighbours, so you're telling me that when something happens to my WiFi (or even if there is a range issue), the device will revert back to AP so neighbours can connect it and mess with it? |
in which cases will be switched to AP mode an when will this happen? in cases when there is something terribly wrong. if there will be this feature in the future, this can made to be en/disabled..... but to tell a userstory: you have a 3 phase powermeter with openbeken corrected to mains. in case there is something wrong with the wifi pw or config you have to shut down the hole house. remove the unit. power the house again. open the unit flash openbeken again. and do vis versa. if you are NOT allowed to do electrical work (which most of you are denied), you need an electritian...this can take days and will cost a fortune ;-) |
Not me, it was "feature request" from @g6094199 #1246 (comment) and I disagree with that #1246 (comment). |
Maybe the right way can be some "user script", when no WiFi, start AP over Command. I don't know, if it is possible for now, but if I need something special like that, I'd do it this way. Using autoexec.bat. |
I think this is a special case, for even your proposal (open AP for a short period of time) would mean you need to be aware of the problem right from the beginning to connect during the 2 minutes or so. Maybe "your" request should be something like a "configured AP" so if there is no WiFi, the device opens an AP, but not the standard open AP, but an AP with a configured passphrase. |
I am trying to use SSID2 with no success. It always connects to SSID1 only (CFG_GetWiFiSSID() and CFG_GetWiFiPass()).
I couldn't find code in the source code that uses CFG_GetWiFiSSID2() and CFG_GetWiFiPass2().
Is SSID2 solved somehow differently, or is it not yet implemented?
The text was updated successfully, but these errors were encountered: