Fix bug
This commit is contained in:
@@ -300,7 +300,7 @@ def on_new_alert(alert: Alert):
|
|||||||
# Sends to cloud server
|
# Sends to cloud server
|
||||||
alert_dict = alert.to_dict()
|
alert_dict = alert.to_dict()
|
||||||
|
|
||||||
logs_list = get_systemd_logs(lines=200, service_name="smartwave")
|
logs_list = asyncio.run(get_systemd_logs(lines=200, service_name="smartwave"))
|
||||||
|
|
||||||
payload = {
|
payload = {
|
||||||
"orchestrator_id": DEVICE_ID,
|
"orchestrator_id": DEVICE_ID,
|
||||||
@@ -349,9 +349,11 @@ def read_local_sensors(microwave_id, initial_dish_height):
|
|||||||
print(f"[{microwave_id}] ALERT: Unsafe temperature in technical compartment detected! Temp: {temp}°C, Humidity: {hum}%")
|
print(f"[{microwave_id}] ALERT: Unsafe temperature in technical compartment detected! Temp: {temp}°C, Humidity: {hum}%")
|
||||||
alert = Alert(
|
alert = Alert(
|
||||||
AlertType.TEMPERATURE_ALERT,
|
AlertType.TEMPERATURE_ALERT,
|
||||||
f"Unsafe temperature in technical compartment detected! Temp: {temp}/{config.MAX_ALLOWED_TEMPERATURE_COOKING_COMPARTMENT}°C, Humidity: {hum}%"
|
f"Unsafe temperature in technical compartment detected! Temp: {temp}/{config.MAX_ALLOWED_TEMPERATURE_COOKING_COMPARTMENT}°C, Humidity: {hum}%",
|
||||||
|
redistributed=False
|
||||||
)
|
)
|
||||||
lora.send_reliable(payloads.lora_new_alert(alert), max_retries=5)
|
# lora.send_reliable(payloads.lora_new_alert(alert), max_retries=5)
|
||||||
|
alert_manager.add_alert(alert)
|
||||||
return None # Abort further processing if unsafe temperature detected
|
return None # Abort further processing if unsafe temperature detected
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log(f"[{microwave_id}] DHT read warning: {e}")
|
log(f"[{microwave_id}] DHT read warning: {e}")
|
||||||
|
|||||||
Reference in New Issue
Block a user