1
0
mirror of https://github.com/no2chem/wideq.git synced 2025-05-16 07:10:09 -07:00

Get speaker volume setting

Still can't figure out how to *set* the light state.
This commit is contained in:
Adrian Sampson 2018-04-21 15:14:10 -04:00
parent 6d3e7b3fa6
commit 0a48345409
2 changed files with 14 additions and 3 deletions

View File

@ -119,6 +119,7 @@ def ac_config(client, device_id):
print(ac.get_filter_state())
print(ac.get_mfilter_state())
print(ac.get_energy_target())
print(ac.get_volume())
print(ac.get_light())

View File

@ -348,7 +348,7 @@ class Session(object):
`values` is a key/value map containing the settings to update.
"""
self.post('rti/rtiControl', {
return self.post('rti/rtiControl', {
'cmd': 'Control',
'cmdOpt': 'Set',
'value': values,
@ -722,12 +722,16 @@ class Device(object):
"""Look up a device's control value.
"""
return self.client.session.get_device_config(
data = self.client.session.get_device_config(
self.device.id,
key,
'Control',
)
# The response comes in a funky key/value format: "(key:value)".
_, value = data[1:-1].split(':')
return value
class ACMode(enum.Enum):
"""The operation mode for an AC/HVAC device."""
@ -837,7 +841,13 @@ class ACDevice(Device):
"""Get a Boolean indicating whether the display light is on."""
value = self._get_control('DisplayControl')
return value == '(DisplayControl:0)'
return value == '0' # Seems backwards, but isn't.
def get_volume(self):
"""Get the speaker volume level."""
value = self._get_control('SpkVolume')
return int(value)
def monitor_start(self):
"""Start monitoring the device's status."""