wifi connection working

This commit is contained in:
Neythen 2021-11-18 19:41:50 +00:00
parent b4c7c505f0
commit 9c6ad0cde2
17 changed files with 58 additions and 21 deletions

View File

@ -1 +1 @@
{"feature": "Stocks", "speed": "medium", "animation": "down", "percent": false, "point": false, "logos": true, "chart": false, "title": true, "symbols": {"NEO,USD": {"current": 40.04, "24hr_change": -7.092150997474435}, "BTC,USD": {"current": 58197, "24hr_change": -3.8902517485472328}, "ETH,BTC": {"current": 0.07043227, "24hr_change": -3.9373132260122343}, "ADA,GBP": {"current": 1.32, "24hr_change": -5.336498540074388}}}
{"feature": "Stocks", "speed": "medium", "animation": "down", "percent": false, "point": false, "logos": true, "chart": false, "title": true, "symbols": {"NEO,USD": {"current": 39.96, "24hr_change": -7.219334624451841}, "BTC,USD": {"current": 58157, "24hr_change": -4.272633605785742}, "ETH,BTC": {"current": 0.07040904, "24hr_change": -4.2611160146511455}, "ADA,GBP": {"current": 1.34, "24hr_change": -3.8299564614508417}}}

View File

@ -1 +1 @@
{"feature": "Current Weather", "speed": "medium", "animation": "down", "temp": "celsius", "wind_speed": "miles/sec", "colour": "white", "city_colour": "yellow", "title": true, "locations": {"London": {"main_weather": "Clouds", "description": "overcast clouds", "temp": 12.65, "min_temp": 7.04, "max_temp": 12.86, "feels_like": 12.22, "humidity": 86, "clouds": 90, "wind_speed": 4.12, "wind_direction": 240, "visibility": 10000, "uv": 0, "rain_chance": 0}, "Tokyo": {"main_weather": "Clouds", "description": "scattered clouds", "temp": 10.82, "min_temp": 10.82, "max_temp": 16.96, "feels_like": 9.92, "humidity": 75, "clouds": 40, "wind_speed": 0.89, "wind_direction": 301, "visibility": 10000, "uv": 0, "rain_chance": 0}, "Beijing": {"main_weather": "Clouds", "description": "overcast clouds", "temp": 7.94, "min_temp": 5.1, "max_temp": 9.51, "feels_like": 5.35, "humidity": 29, "clouds": 86, "wind_speed": 4.25, "wind_direction": 43, "visibility": 10000, "uv": 0, "rain_chance": 0}, "Moscow": {"main_weather": "Snow", "description": "light snow", "temp": -1.01, "min_temp": -2.28, "max_temp": 0.08, "feels_like": -6.37, "humidity": 73, "clouds": 48, "wind_speed": 5.33, "wind_direction": 223, "visibility": 10000, "uv": 0, "rain_chance": 0}}, "current_weather": true}
{"feature": "Current Weather", "speed": "medium", "animation": "down", "temp": "celsius", "wind_speed": "miles/sec", "colour": "white", "city_colour": "yellow", "title": true, "locations": {"Tokyo": {"main_weather": "Clouds", "description": "scattered clouds", "temp": 10.82, "min_temp": 10.82, "max_temp": 17.16, "feels_like": 9.92, "humidity": 75, "clouds": 40, "wind_speed": 0.89, "wind_direction": 301, "visibility": 10000, "uv": 0, "rain_chance": 0}, "London": {"main_weather": "Clouds", "description": "overcast clouds", "temp": 12.65, "min_temp": 7.01, "max_temp": 12.79, "feels_like": 12.22, "humidity": 86, "clouds": 90, "wind_speed": 4.12, "wind_direction": 240, "visibility": 10000, "uv": 0, "rain_chance": 0}, "Beijing": {"main_weather": "Clouds", "description": "overcast clouds", "temp": 7.94, "min_temp": 5.77, "max_temp": 9.89, "feels_like": 5.51, "humidity": 34, "clouds": 88, "wind_speed": 3.93, "wind_direction": 39, "visibility": 10000, "uv": 0, "rain_chance": 0}, "Moscow": {"main_weather": "Snow", "description": "snow", "temp": -1.06, "min_temp": -2.33, "max_temp": 0.03, "feels_like": -6.41, "humidity": 62, "clouds": 52, "wind_speed": 5.28, "wind_direction": 222, "visibility": 10000, "uv": 0, "rain_chance": 0}}, "current_weather": true}

View File

@ -1 +1 @@
{"feature": "Current Weather", "speed": "medium", "animation": "continuous", "temp": "celsius", "wind_speed": "miles/sec", "colour": "white", "city_colour": "yellow", "title": true, "locations": {"London": [{"main_weather": "Clouds", "description": "scattered clouds", "min_temp": 7.04, "max_temp": 12.86}, {"main_weather": "Clouds", "description": "few clouds", "min_temp": 8.55, "max_temp": 13.28}, {"main_weather": "Clouds", "description": "scattered clouds", "min_temp": 7.99, "max_temp": 11.54}, {"main_weather": "Rain", "description": "light rain", "min_temp": 4.32, "max_temp": 9.28}, {"main_weather": "Rain", "description": "light rain", "min_temp": 4.39, "max_temp": 8.95}, {"main_weather": "Rain", "description": "light rain", "min_temp": 5.13, "max_temp": 8.18}, {"main_weather": "Rain", "description": "light rain", "min_temp": 5.37, "max_temp": 7.39}, {"main_weather": "Rain", "description": "light rain", "min_temp": 3.32, "max_temp": 5.61}], "Tokyo": [{"main_weather": "Clouds", "description": "overcast clouds", "min_temp": 10.82, "max_temp": 16.96}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 13.33, "max_temp": 17.6}, {"main_weather": "Clouds", "description": "overcast clouds", "min_temp": 13.65, "max_temp": 15.41}, {"main_weather": "Rain", "description": "moderate rain", "min_temp": 13.74, "max_temp": 17.5}, {"main_weather": "Rain", "description": "light rain", "min_temp": 13.11, "max_temp": 16.33}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 10.02, "max_temp": 14.72}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 9.14, "max_temp": 13.28}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 10.21, "max_temp": 14.42}], "Beijing": [{"main_weather": "Rain", "description": "light rain", "min_temp": 5.1, "max_temp": 9.51}, {"main_weather": "Clouds", "description": "overcast clouds", "min_temp": 5.47, "max_temp": 9.38}, {"main_weather": "Clouds", "description": "broken clouds", "min_temp": 2.66, "max_temp": 8.26}, {"main_weather": "Clear", "description": "clear sky", "min_temp": -0.1, "max_temp": 2.91}, {"main_weather": "Clear", "description": "clear sky", "min_temp": -0.03, "max_temp": 6.36}, {"main_weather": "Clouds", "description": "overcast clouds", "min_temp": 0.45, "max_temp": 6.06}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 2.37, "max_temp": 7.28}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 1.03, "max_temp": 6.71}], "Moscow": [{"main_weather": "Snow", "description": "light snow", "min_temp": -2.28, "max_temp": 0.08}, {"main_weather": "Clouds", "description": "overcast clouds", "min_temp": -0.72, "max_temp": 1.66}, {"main_weather": "Snow", "description": "rain and snow", "min_temp": 0.3, "max_temp": 1.58}, {"main_weather": "Clouds", "description": "overcast clouds", "min_temp": -0.36, "max_temp": 2.01}, {"main_weather": "Snow", "description": "light snow", "min_temp": -3.24, "max_temp": 0.91}, {"main_weather": "Snow", "description": "light snow", "min_temp": -5.23, "max_temp": -2.9}, {"main_weather": "Snow", "description": "light snow", "min_temp": -1.2, "max_temp": 1.62}, {"main_weather": "Clear", "description": "clear sky", "min_temp": -1.72, "max_temp": 1.17}]}, "current_weather": true}
{"feature": "Current Weather", "speed": "medium", "animation": "continuous", "temp": "celsius", "wind_speed": "miles/sec", "colour": "white", "city_colour": "yellow", "title": true, "locations": {"Tokyo": [{"main_weather": "Clouds", "description": "overcast clouds", "min_temp": 10.82, "max_temp": 17.16}, {"main_weather": "Clouds", "description": "scattered clouds", "min_temp": 13.2, "max_temp": 17.34}, {"main_weather": "Rain", "description": "light rain", "min_temp": 13.51, "max_temp": 14.5}, {"main_weather": "Rain", "description": "moderate rain", "min_temp": 13.27, "max_temp": 15.48}, {"main_weather": "Rain", "description": "moderate rain", "min_temp": 12.82, "max_temp": 14.63}, {"main_weather": "Rain", "description": "light rain", "min_temp": 10.84, "max_temp": 14.38}, {"main_weather": "Clouds", "description": "scattered clouds", "min_temp": 9.31, "max_temp": 13.26}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 10.12, "max_temp": 15.26}], "London": [{"main_weather": "Clouds", "description": "scattered clouds", "min_temp": 7.01, "max_temp": 12.79}, {"main_weather": "Clouds", "description": "few clouds", "min_temp": 8.76, "max_temp": 13.35}, {"main_weather": "Clouds", "description": "overcast clouds", "min_temp": 9.84, "max_temp": 12.84}, {"main_weather": "Rain", "description": "light rain", "min_temp": 5.02, "max_temp": 9.79}, {"main_weather": "Clouds", "description": "few clouds", "min_temp": 5.27, "max_temp": 9.15}, {"main_weather": "Clouds", "description": "broken clouds", "min_temp": 5.05, "max_temp": 7.8}, {"main_weather": "Rain", "description": "light rain", "min_temp": 2.91, "max_temp": 7.67}, {"main_weather": "Clouds", "description": "few clouds", "min_temp": 1.13, "max_temp": 3.87}], "Beijing": [{"main_weather": "Clouds", "description": "broken clouds", "min_temp": 5.77, "max_temp": 9.89}, {"main_weather": "Clouds", "description": "overcast clouds", "min_temp": 5.48, "max_temp": 9.81}, {"main_weather": "Rain", "description": "light rain", "min_temp": 2.63, "max_temp": 7.98}, {"main_weather": "Clear", "description": "clear sky", "min_temp": -0.22, "max_temp": 3.1}, {"main_weather": "Clear", "description": "clear sky", "min_temp": -0.35, "max_temp": 6.4}, {"main_weather": "Clouds", "description": "broken clouds", "min_temp": 1.17, "max_temp": 7.28}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 2.15, "max_temp": 10.85}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 2, "max_temp": 7.86}], "Moscow": [{"main_weather": "Snow", "description": "snow", "min_temp": -2.33, "max_temp": 0.03}, {"main_weather": "Snow", "description": "light snow", "min_temp": -1.01, "max_temp": 1.22}, {"main_weather": "Snow", "description": "rain and snow", "min_temp": 0.35, "max_temp": 2.94}, {"main_weather": "Clouds", "description": "overcast clouds", "min_temp": 0.27, "max_temp": 1.82}, {"main_weather": "Snow", "description": "rain and snow", "min_temp": -4.16, "max_temp": 3.91}, {"main_weather": "Clouds", "description": "overcast clouds", "min_temp": -4.86, "max_temp": -2.2}, {"main_weather": "Clouds", "description": "overcast clouds", "min_temp": -2.64, "max_temp": -0.11}, {"main_weather": "Rain", "description": "light rain", "min_temp": -1.99, "max_temp": 2.21}]}, "current_weather": true}

View File

@ -1 +1 @@
{"feature": "Stocks", "speed": "medium", "animation": "down", "percent": false, "point": false, "logos": false, "chart": false, "title": true, "symbols": {"NZD,GBP": {"current": 1.922, "24hr_change": 0.007199999999999873}, "CAD,USD": {"current": 1.2554, "24hr_change": 0.0020999999999999908}}}
{"feature": "Stocks", "speed": "medium", "animation": "down", "percent": false, "point": false, "logos": false, "chart": false, "title": true, "symbols": {"NZD,GBP": {"current": 1.9134, "24hr_change": -0.008599999999999941}, "CAD,USD": {"current": 1.26, "24hr_change": 0.0045999999999999375}}}

View File

@ -1 +1 @@
{"stocks": "17/11/2021 14:30:18", "crypto": "17/11/2021 14:28:16", "news": "17/11/2021 14:28:19", "weather": "17/11/2021 14:28:17", "forex": "17/11/2021 20:28:22", "sports": "17/11/2021 14:28:19"}
{"stocks": "18/11/2021 14:41:10", "crypto": "18/11/2021 14:39:10", "news": "18/11/2021 12:52:43", "weather": "18/11/2021 12:52:41", "forex": "18/11/2021 18:52:46", "sports": "18/11/2021 12:52:43"}

View File

@ -1,2 +1,2 @@
speed,brightness
f,7
f,4
1 speed brightness
2 f 7 4

View File

@ -1 +1 @@
{"feature": "Stocks", "speed": "medium", "animation": "down", "percent": true, "point": true, "logos": false, "chart": false, "title": true, "symbols": {"MSFT": {"current": 341.4, "opening": 338.12}, "GOOG": {"current": 3019.28, "opening": 2983.88}}}
{"feature": "Stocks", "speed": "medium", "animation": "down", "percent": true, "point": true, "logos": false, "chart": false, "title": true, "symbols": {"MSFT": {"current": 340.86, "opening": 338.12}, "GOOG": {"current": 3015.62, "opening": 2983.88}}}

Binary file not shown.

0
display_images/Current Weather Prof.ppm Normal file → Executable file
View File

0
display_images/News Prof.ppm Normal file → Executable file
View File

0
display_images/News.ppm Normal file → Executable file
View File

Binary file not shown.

0
display_images/working_gif.gif Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

13
log.txt
View File

@ -1,13 +0,0 @@
[Errno 13] Permission denied: './display_images/Stocks.ppm'. file: stockTicker.py. line: 2476. type: <class 'PermissionError'>
Traceback (most recent call last):
File "stockTicker.py", line 2476, in <module>
stock_ticker.process_msg(msg)
File "stockTicker.py", line 2437, in process_msg
self.scrollFunctionsAnimated(userSettings, animation = 'down')
File "stockTicker.py", line 329, in scrollFunctionsAnimated
self.updateMultiple([options[0]])
File "stockTicker.py", line 289, in updateMultiple
img.save('./display_images/'+ option+ '.ppm')
File "/usr/lib/python3/dist-packages/PIL/Image.py", line 1991, in save
fp = builtins.open(filename, "w+b")
PermissionError: [Errno 13] Permission denied: './display_images/Stocks.ppm'

View File

@ -254,6 +254,48 @@ def brightness():
LastCommand = 'Change Brightness'
return index()
def edit_wpa_sup(country, ssid, pwd):
current_wpa = open('/etc/wpa_supplicant/wpa_supplicant.conf')
wpa_lines = current_wpa.readlines()
wpa_lines[2] = 'country={}\n'.format(country)
current_wpa.close()
wpa_lines.append('\n')
wpa_lines.append('network={\n')
wpa_lines.append('\tssid="{}"\n'.format(ssid))
wpa_lines.append('\tpsk="{}"\n'.format(pwd))
wpa_lines.append('}\n')
wpa_string = ''.join(wpa_lines)
print(wpa_string)
current_wpa = open('/etc/wpa_supplicant/wpa_supplicant.conf', 'w+')
current_wpa.write(wpa_string)
@app.route("/wifi", methods = ['PUT', 'POST', 'GET'])
def wifi():
data= request.data.decode('utf-8')
print(str(data))
settings = json.loads(data)
country = settings['country'].upper()
ssid = settings['ssid']
pwd = settings['pwd']
edit_wpa_sup(country, ssid, pwd)
# resstart netoworking
os.system('wpa_cli -i wlan0 reconfigure')
return index()
@app.route("/screensaver", methods = ['PUT', 'POST'])
def screensaver():
global displaying_screensaver

View File

@ -1221,6 +1221,13 @@ joinNetworkBtn.addEventListener("click", () => {
setTimeout(() => {
connectedText.style.display = "none";
}, 2000);
data = {country:countryCodeInput.value, ssid:wifiSsidInput.value, pwd:wifiPassInput.value}
fetch("/wifi", {
method: "POST",
body: JSON.stringify(data),
});
});
// change display format

View File

@ -1,4 +1,5 @@
git fetch --all
git reset --hard origin/master
git pull origin master
./setup.sh