feat: Add type ignore comments for imports in multiple scripts
This commit is contained in:
parent
b712c19740
commit
99d92a6e90
@ -1,4 +1,4 @@
|
|||||||
import gc
|
import gc # type: ignore
|
||||||
|
|
||||||
def check_memory_once():
|
def check_memory_once():
|
||||||
"""One-time memory check (for startup diagnostics)."""
|
"""One-time memory check (for startup diagnostics)."""
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import time
|
import time # type: ignore
|
||||||
from scripts.discord_webhook import send_discord_message
|
from scripts.discord_webhook import send_discord_message
|
||||||
from scripts.temperature_sensor import TemperatureSensor
|
from scripts.temperature_sensor import TemperatureSensor
|
||||||
|
|
||||||
@ -262,7 +262,7 @@ class WiFiMonitor(Monitor):
|
|||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
"""Check WiFi status, blink LED, attempt reconnect if needed."""
|
"""Check WiFi status, blink LED, attempt reconnect if needed."""
|
||||||
import network
|
import network # type: ignore
|
||||||
from scripts.networking import connect_wifi
|
from scripts.networking import connect_wifi
|
||||||
|
|
||||||
is_connected = self.wifi.isconnected() if self.wifi else False
|
is_connected = self.wifi.isconnected() if self.wifi else False
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import time
|
import time # type: ignore
|
||||||
|
|
||||||
class ScheduleMonitor:
|
class ScheduleMonitor:
|
||||||
"""Monitor that checks and applies temperature schedules."""
|
"""Monitor that checks and applies temperature schedules."""
|
||||||
|
|||||||
14
main.py
14
main.py
@ -1,8 +1,8 @@
|
|||||||
from machine import Pin, WDT # type: ignore
|
from machine import Pin, WDT # type: ignore
|
||||||
import time
|
import time # type: ignore
|
||||||
import network
|
import network # type: ignore
|
||||||
import json
|
import json
|
||||||
import gc # ADD THIS - for garbage collection
|
import gc # type: ignore # ADD THIS - for garbage collection
|
||||||
|
|
||||||
# Enable watchdog (8 seconds timeout - auto-reboot if frozen)
|
# Enable watchdog (8 seconds timeout - auto-reboot if frozen)
|
||||||
# wdt = WDT(timeout=8000) # Maximum is 8388ms, use 8000ms (8 seconds)
|
# wdt = WDT(timeout=8000) # Maximum is 8388ms, use 8000ms (8 seconds)
|
||||||
@ -77,7 +77,7 @@ def load_config():
|
|||||||
'heater_target': 72.0
|
'heater_target': 72.0
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
'schedule_enabled': False, # Schedules disabled by default (user can enable via web)
|
'schedule_enabled': True, # Schedules disabled by default (user can enable via web)
|
||||||
'permanent_hold': False # Permanent hold disabled by default
|
'permanent_hold': False # Permanent hold disabled by default
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -151,7 +151,7 @@ if wifi and wifi.isconnected():
|
|||||||
# Attempt time sync non-blocking (short timeout + retry flag)
|
# Attempt time sync non-blocking (short timeout + retry flag)
|
||||||
ntp_synced = False
|
ntp_synced = False
|
||||||
try:
|
try:
|
||||||
import ntptime
|
import ntptime # type: ignore
|
||||||
ntptime.settime()
|
ntptime.settime()
|
||||||
ntp_synced = True
|
ntp_synced = True
|
||||||
print("Time synced with NTP server")
|
print("Time synced with NTP server")
|
||||||
@ -316,13 +316,13 @@ while True:
|
|||||||
run_monitors(monitors)
|
run_monitors(monitors)
|
||||||
|
|
||||||
# Web requests
|
# Web requests
|
||||||
web_server.check_requests(sensors, ac_monitor, heater_monitor, schedule_monitor)
|
web_server.check_requests(sensors, ac_monitor, heater_monitor, schedule_monitor, config)
|
||||||
|
|
||||||
# Retry NTP sync every ~10s if not yet synced
|
# Retry NTP sync every ~10s if not yet synced
|
||||||
if not ntp_synced and retry_ntp_attempts < max_ntp_attempts:
|
if not ntp_synced and retry_ntp_attempts < max_ntp_attempts:
|
||||||
# Try once immediately, then whenever (time.time() % 10) < 1 (rough 10s window)
|
# Try once immediately, then whenever (time.time() % 10) < 1 (rough 10s window)
|
||||||
try:
|
try:
|
||||||
import ntptime
|
import ntptime # type: ignore
|
||||||
if retry_ntp_attempts == 0 or (time.time() % 10) < 1:
|
if retry_ntp_attempts == 0 or (time.time() % 10) < 1:
|
||||||
ntptime.settime()
|
ntptime.settime()
|
||||||
ntp_synced = True
|
ntp_synced = True
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user