v.0.10.1 restapi/mock
This commit is contained in:
@@ -12,7 +12,7 @@ mpremote connect port:rfc2217://localhost:4000 mkdir web
|
|||||||
|
|
||||||
|
|
||||||
echo "1. Copying pico-client directories to device..."
|
echo "1. Copying pico-client directories to device..."
|
||||||
mpremote connect port:rfc2217://localhost:4000 cp -r restapi/mock :
|
mpremote connect port:rfc2217://localhost:4000 cp -r restapi/mock :restapi
|
||||||
mpremote connect port:rfc2217://localhost:4000 cp -r classes :
|
mpremote connect port:rfc2217://localhost:4000 cp -r classes :
|
||||||
mpremote connect port:rfc2217://localhost:4000 cp -r display :
|
mpremote connect port:rfc2217://localhost:4000 cp -r display :
|
||||||
mpremote connect port:rfc2217://localhost:4000 cp -r tryout :
|
mpremote connect port:rfc2217://localhost:4000 cp -r tryout :
|
||||||
|
|||||||
@@ -7,8 +7,7 @@ from utils import (
|
|||||||
get_datetime_string,
|
get_datetime_string,
|
||||||
get_german_datetime,
|
get_german_datetime,
|
||||||
) # Time-related functions
|
) # Time-related functions
|
||||||
from utils import SimpleCounter, colors
|
from utils import SimpleCounter
|
||||||
import time
|
|
||||||
from utils.digital_clock import DigitalClock
|
from utils.digital_clock import DigitalClock
|
||||||
import uasyncio as asyncio # type: ignore
|
import uasyncio as asyncio # type: ignore
|
||||||
from web import Wlan
|
from web import Wlan
|
||||||
@@ -21,7 +20,7 @@ CITY_LIST: list[str] = sorted(
|
|||||||
async def weather_check_task(weather_checker: Weather_Checker):
|
async def weather_check_task(weather_checker: Weather_Checker):
|
||||||
while True:
|
while True:
|
||||||
for city in CITY_LIST:
|
for city in CITY_LIST:
|
||||||
weather_checker.check(city=city, lang="de", test_mode=False)
|
weather_checker.check(city=city, lang="de", test_mode=True)
|
||||||
print(f"Checked {city}")
|
print(f"Checked {city}")
|
||||||
await asyncio.sleep(3 * 60) # Non-blocking sleep
|
await asyncio.sleep(3 * 60) # Non-blocking sleep
|
||||||
|
|
||||||
@@ -68,10 +67,5 @@ if __name__ == "__main__":
|
|||||||
display.set_font(font_5x7)
|
display.set_font(font_5x7)
|
||||||
weather_checker: Weather_Checker = Weather_Checker(display=display)
|
weather_checker: Weather_Checker = Weather_Checker(display=display)
|
||||||
|
|
||||||
# while True:
|
|
||||||
# for city in sorted(CITY_LIST):
|
|
||||||
# weather_checker.check(city=city, lang="de", test_mode=False)
|
|
||||||
# time.sleep(5*60)
|
|
||||||
|
|
||||||
# show_system_load()
|
# show_system_load()
|
||||||
asyncio.run(main(weather_checker))
|
asyncio.run(main(weather_checker))
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ class Weather_Checker:
|
|||||||
self.display = display
|
self.display = display
|
||||||
|
|
||||||
def mock_weather_data(self):
|
def mock_weather_data(self):
|
||||||
filepath = "restapi/mock-weather.json"
|
filepath = "restapi/mock/weather.json"
|
||||||
try:
|
try:
|
||||||
with open(filepath, "r", encoding="utf-8") as file:
|
with open(filepath, "r", encoding="utf-8") as file:
|
||||||
return json.load(file)
|
return json.load(file)
|
||||||
|
|||||||
Reference in New Issue
Block a user