From 74595164b573757e7480677e4bcadbd8990d66b8 Mon Sep 17 00:00:00 2001 From: dgaust Date: Mon, 26 Jul 2021 18:21:52 +1000 Subject: [PATCH] Update smarterzones.py --- apps/smarterzones/smarterzones.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/apps/smarterzones/smarterzones.py b/apps/smarterzones/smarterzones.py index 5976606..6a57dbc 100644 --- a/apps/smarterzones/smarterzones.py +++ b/apps/smarterzones/smarterzones.py @@ -60,16 +60,19 @@ def climatedevicechange(self, entity, attribute, old, new, kwargs): # Zone Listeners def target_temp_change(self, entity, attribute, old, new, kwargs): for zone in self.zones: + self.queuedlogger(zone["friendly_name"] + ": Wanted temperature in zone changed from " + str(old) + " to " + str(new)) self.automatically_manage_zone(zone) def inroomtempchange(self, entity, attribute, old, new, kwargs): for zone in self.zones: if zone["local_tempsensor"] == str(entity): - self.automatically_manage_zone(zone) + self.queuedlogger(zone["friendly_name"] + ": Current temperature in zone changed from " + str(old) + " to " + str(new)) + self.automatically_manage_zone(zone) def manual_override_change(self, entity, attribute, old, new, kwargs): for zone in self.zones: if zone["manual_override"] == str(entity): + self.queuedlogger(zone["friendly_name"] + ": manual override switch changed from " + str(old) + " to " + str(new)) self.automatically_manage_zone(zone) # Exterior temperature sensor monitor - for future use @@ -117,10 +120,18 @@ def automatically_manage_zone(self, zone): self.queuedlogger("Other") def switchon(self, zone): - self.call_service("switch/turn_on", entity_id = zone["zone_switch"]) + zone_switch = zone["zone_switch"] + state = self.get_state(zone_switch) + if state != "on": + self.queuedlogger(zone["friendly_name"] + ": zone is opening") + self.call_service("switch/turn_on", zone_switch) def switchoff(self, zone): - self.call_service("switch/turn_off", entity_id = zone["zone_switch"]) + zone_switch = zone["zone_switch"] + state = self.get_state(zone_switch) + if state != "of": + self.queuedlogger(zone["friendly_name"] + ": zone is closing") + self.call_service("switch/turn_off", zone_switch) # Zone Checks def override_enabled(self, zone):