mirror of
https://github.com/no2chem/wideq.git
synced 2025-05-16 15:20:09 -07:00
Get speaker volume setting
Still can't figure out how to *set* the light state.
This commit is contained in:
parent
6d3e7b3fa6
commit
0a48345409
@ -119,6 +119,7 @@ def ac_config(client, device_id):
|
|||||||
print(ac.get_filter_state())
|
print(ac.get_filter_state())
|
||||||
print(ac.get_mfilter_state())
|
print(ac.get_mfilter_state())
|
||||||
print(ac.get_energy_target())
|
print(ac.get_energy_target())
|
||||||
|
print(ac.get_volume())
|
||||||
print(ac.get_light())
|
print(ac.get_light())
|
||||||
|
|
||||||
|
|
||||||
|
16
wideq.py
16
wideq.py
@ -348,7 +348,7 @@ class Session(object):
|
|||||||
`values` is a key/value map containing the settings to update.
|
`values` is a key/value map containing the settings to update.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
self.post('rti/rtiControl', {
|
return self.post('rti/rtiControl', {
|
||||||
'cmd': 'Control',
|
'cmd': 'Control',
|
||||||
'cmdOpt': 'Set',
|
'cmdOpt': 'Set',
|
||||||
'value': values,
|
'value': values,
|
||||||
@ -722,12 +722,16 @@ class Device(object):
|
|||||||
"""Look up a device's control value.
|
"""Look up a device's control value.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
return self.client.session.get_device_config(
|
data = self.client.session.get_device_config(
|
||||||
self.device.id,
|
self.device.id,
|
||||||
key,
|
key,
|
||||||
'Control',
|
'Control',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# The response comes in a funky key/value format: "(key:value)".
|
||||||
|
_, value = data[1:-1].split(':')
|
||||||
|
return value
|
||||||
|
|
||||||
|
|
||||||
class ACMode(enum.Enum):
|
class ACMode(enum.Enum):
|
||||||
"""The operation mode for an AC/HVAC device."""
|
"""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."""
|
"""Get a Boolean indicating whether the display light is on."""
|
||||||
|
|
||||||
value = self._get_control('DisplayControl')
|
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):
|
def monitor_start(self):
|
||||||
"""Start monitoring the device's status."""
|
"""Start monitoring the device's status."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user