Fix reset dish state and debug values

This commit is contained in:
2026-08-06 15:19:54 +02:00
parent 11357b9a0e
commit 2df05fd684
+5 -2
View File
@@ -230,6 +230,9 @@ async def request_cloud_cooking_plan(microwave_id, sensors_data):
print(f"[{microwave_id}] Cloud Plan Received! Starting microwave: {c_time}s @ {c_power}W") print(f"[{microwave_id}] Cloud Plan Received! Starting microwave: {c_time}s @ {c_power}W")
cloud_alert = False # Reset alert flag on success cloud_alert = False # Reset alert flag on success
microwave_states[microwave_id] = MicrowaveState.COOKING microwave_states[microwave_id] = MicrowaveState.COOKING
if config.DEBUG:
c_time = min(c_time, 10) # Limit to 10s for debug
c_temp = min(c_temp, 50) # Limit to 50°C for debug
mqtt_client.publish( mqtt_client.publish(
config.MQTT_TOPIC_COOKING, config.MQTT_TOPIC_COOKING,
payloads.mqtt_cooking_config(microwave_id, c_time, c_power, c_temp), payloads.mqtt_cooking_config(microwave_id, c_time, c_power, c_temp),
@@ -306,8 +309,8 @@ async def get_filtered_dish_height(samples=3, delay=0.04):
valid_samples = [] valid_samples = []
for _ in range(samples): for _ in range(samples):
h = await asyncio.to_thread(ultrasonicRanger.get_dish_height) h = await asyncio.to_thread(ultrasonicRanger.get_dish_height)
# Discard 0.0 or near-zero timeout glitches # Discard negative glitches
if h is not None and h > 0.5: if h is not None and h >= 0.0:
valid_samples.append(h) valid_samples.append(h)
await asyncio.sleep(delay) await asyncio.sleep(delay)