Skip to content

Commit

Permalink
Update smarterzones.py
Browse files Browse the repository at this point in the history
  • Loading branch information
dgaust authored Jul 26, 2021
1 parent ff858ad commit 7459516
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions apps/smarterzones/smarterzones.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 7459516

Please sign in to comment.