Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 3de15b6

Browse files
committedSep 14, 2018
add stage control to thermostat
1 parent 3efb5ee commit 3de15b6

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed
 

‎python/xbos/devices/thermostat.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ def _handle(msg):
4242
print "Got Thermostat at {0} last alive {1}".format(uri, alive['val'])
4343

4444
self.client.subscribe("{0}/signal/info".format(uri), _handle)
45+
self.client.subscribe("{0}/stages/info".format(uri), _handle)
4546

4647
@property
4748
def cooling_setpoint(self, timeout=30):
@@ -88,9 +89,9 @@ def temperature(self, timeout=30):
8889
return read_self_timeout(self, 'temperature', timeout)
8990

9091

91-
def write(self, state):
92+
def write(self, state, uri='state'):
9293
po = PayloadObject((2,1,1,0), None, msgpack.packb(state))
93-
self.client.publish('{0}/slot/state'.format(self._uri),payload_objects=(po,))
94+
self.client.publish('{0}/slot/{1}'.format(self._uri, uri),payload_objects=(po,))
9495

9596
def set_heating_setpoint(self, value):
9697
self.write({'heating_setpoint': value})
@@ -108,8 +109,8 @@ def set_fan_mode(self, value):
108109
self.write({'fan_mode': value})
109110

110111
def set_enabled_heat_stages(self, value):
111-
self.write({'enabled_heat_stages': value})
112+
self.write({'enabled_heat_stages': value}, 'stages')
112113

113114
def set_enabled_cool_stages(self, value):
114-
self.write({'enabled_cool_stages': value})
115+
self.write({'enabled_cool_stages': value}, 'stages')
115116

0 commit comments

Comments
 (0)
Please sign in to comment.