yi-hack-MStar icon indicating copy to clipboard operation
yi-hack-MStar copied to clipboard

Changing WiFi SSID

Open Dmario-dev opened this issue 1 year ago • 9 comments

Hi, I'm trying to connect the camera to the new router. When I go to wifi confirmation page on the top there is "loading..." and the list of SSID is empty.

Is there a way to provide new SSID and password for the wifi using SSH?

BR

Dmario-dev avatar Jan 07 '24 14:01 Dmario-dev

Yes, you can use the configure_wifi.sh script.

Create a file /tmp/configure_wifi.cfg with this content:

# Don't use backslash char \
# Don't use double quote " around ssid and psk
# Space chars are allowed
wifi_ssid=My AP 2.4GHz
wifi_psk=password$

Change "My AP 2.4GHz" with your SSID and "password$" with your password. Run /home/yi-hack/script/configure_wifi.sh and reboot the cam.

roleoroleo avatar Jan 07 '24 17:01 roleoroleo

I'm having the same problem. The ajax call returns but then the browser complains that the return value is not valid json. "SyntaxError: JSON.parse: bad control character in string literal at line 3 column 8 of the JSON data". It think line 3 column 8 is the 0x0A (line feed character). Perhaps something goes wrong in the script that returns that value?

problem

victorclaessen avatar Mar 19 '24 13:03 victorclaessen

if you change this line in /home/yi-hack/www/cgi-bin/wifi.sh:

LIST=`$YI_HACK_PREFIX/bin/iwlist wlan0 scan | grep "ESSID:" | cut -d : -f 2,3,4,5,6,7,8 | grep -v -e '^$'`

to

LIST=`$YI_HACK_PREFIX/bin/iwlist wlan0 scan | grep "ESSID:" | cut -d : -f 2 | grep -v -e '^$'`

then the dropdown list gets populated.

victorclaessen avatar Mar 19 '24 14:03 victorclaessen

Please, try this command:

LIST=`$YI_HACK_PREFIX/bin/iwlist wlan0 scan | grep "ESSID:" | sed 's/^[ \t]*ESSID://g' | grep -v -e '^$'`

roleoroleo avatar Mar 21 '24 09:03 roleoroleo

Please, try this command:

LIST=`$YI_HACK_PREFIX/bin/iwlist wlan0 scan | grep "ESSID:" | sed 's/^[ \t]*ESSID://g' | grep -v -e '^$'`

Yes, in my setup that gives a LIST value identical to my suggestion. (Checked visually and also compared output with md5sum.)

victorclaessen avatar Mar 22 '24 10:03 victorclaessen

Ok, I prefer this solution to avoid problems parsing the essid when it contains special chars.

roleoroleo avatar Mar 22 '24 12:03 roleoroleo

Ok, I updated the pull request for your convenience. Thanks for all the excellent work in active development on this firmware!

victorclaessen avatar Mar 22 '24 12:03 victorclaessen

Thank you for your pr.

roleoroleo avatar Mar 22 '24 13:03 roleoroleo

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Jun 21 '24 02:06 github-actions[bot]