Skip to content

Commit

Permalink
Update smarterzones.py
Browse files Browse the repository at this point in the history
Added delay to ensure switches are toggled
  • Loading branch information
dgaust authored Aug 19, 2022
1 parent 5a515f5 commit d01b83f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions apps/smarterzones/smarterzones.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ def target_temp_change(self, entity, attribute, old, new, kwargs):
self.automatically_manage_zone(zone)

def inroomtempchange(self, entity, attribute, old, new, kwargs):
self.queuedlogger("Got an inzone temp change from: " + entity)
for zone in self.zones:
if zone["local_tempsensor"] == str(entity):
self.queuedlogger(zone["name"] + ": Current temperature in zone changed from " + str(old) + " to " + str(new))
Expand Down Expand Up @@ -210,6 +211,7 @@ def switchon(self, zone):
state = self.get_state(zone_switch)
if state != "on":
self.queuedlogger(zone["name"] + ": zone is opening")
time.sleep(0.2)
self.call_service("switch/turn_on", entity_id = zone_switch)
if self.Common_Zone_Flag:
self.common_zone_manager(entity = self.common_zone, attribute = self.common_zone, old = self.common_zone, new = self.common_zone, kwargs = self.Common_Zone_Flag)
Expand All @@ -219,6 +221,7 @@ def switchoff(self, zone):
state = self.get_state(zone_switch)
if state != "off":
self.queuedlogger(zone["name"] + ": zone is closing")
time.sleep(0.2)
self.call_service("switch/turn_off", entity_id = zone_switch)
if self.Common_Zone_Flag:
self.common_zone_manager(entity = self.common_zone, attribute = self.common_zone, old = self.common_zone, new = self.common_zone, kwargs = self.Common_Zone_Flag)
Expand All @@ -227,12 +230,14 @@ def common_zone_open(self, entity):
state = self.get_state(entity)
if state != "on":
self.queuedlogger("Ensuring common zone is open")
time.sleep(0.2)
self.call_service("switch/turn_on", entity_id = entity)

def common_zone_closed(self, entity):
state = self.get_state(entity)
if state != "off":
self.queuedlogger("Climate is off, so turning common zone off")
time.sleep(0.2)
self.call_service("switch/turn_off", entity_id = entity)

# Zone Checks
Expand Down

0 comments on commit d01b83f

Please sign in to comment.