From 00b161945ff732f6e2538bb2a9bfb3d871dd0d07 Mon Sep 17 00:00:00 2001 From: Micha Horlboge Date: Mon, 11 Nov 2024 23:21:27 +0100 Subject: [PATCH] fritz_temp_sync/sync_ha_fb.py aktualisiert --- fritz_temp_sync/sync_ha_fb.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fritz_temp_sync/sync_ha_fb.py b/fritz_temp_sync/sync_ha_fb.py index d33e8cc..3b3f749 100755 --- a/fritz_temp_sync/sync_ha_fb.py +++ b/fritz_temp_sync/sync_ha_fb.py @@ -22,7 +22,7 @@ async def handle_event(idx: int): if entity_id in sensor_mappings.keys() or entity_id in thermostate_mappings.keys(): state = await ha.get_device_state(entity_id) new_state = event["data"]["new_state"] - logging.info(f"received changed state from {entity_id} {entity_id in thermostate_mappings.keys()} {state['state']}") + logging.info(f"received changed state from {entity_id} {entity_id in thermostate_mappings.keys()} {state['state']} {entity_id in sensor_mappings.keys()}") if entity_id in thermostate_mappings.keys() and state["state"] != "unavailable": therm_temp = new_state["attributes"]["current_temperature"] therm_name = new_state["attributes"]["friendly_name"] @@ -38,10 +38,12 @@ async def handle_event(idx: int): sensor_temp = round(float(new_state["attributes"]["temperature"]) * 2) / 2 for thermostate in sensor_mappings[entity_id]: therm_state = await ha.get_device_state(thermostate) + logger.info(f"{thermostate} {therm_state}") if therm_state["state"] == "unavailable": continue therm_temp = float(therm_state["attributes"]["current_temperature"]) therm_name = therm_state["attributes"]["friendly_name"] + logger.info(f"Temps: {therm_temp} {sensor_temp}") if therm_temp != sensor_temp: logging.info(f"{therm_name}: {therm_temp}\n{entity_id}: {new_state['attributes']['temperature']} ({sensor_temp})") fb.correct_offset(therm_name, sensor_temp)