TomFaulkner / SenseMe

Python Library for Haiku SenseMe app controlled fans/lights
GNU General Public License v3.0
21 stars 10 forks source link

Fan returns ON/OFF rather than an integer on Brightness #37

Closed TomFaulkner closed 6 years ago

TomFaulkner commented 6 years ago

If quickly polling the brightness immediately after setting it the H Series fan with light seems to frequently return ON/OFF rather than an integer for the brightness level.

This can be demonstrated from a repl by running:

f = discover()[0]
# with light currently on.
# setting brightness = 0 will turn the light off
f.brightness = 0; f.brightness

# or 
# with light currently off.
# setting brightness = 1 will turn the light on
f.brightness = 1; f.brightness
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/tom/dev/SenseMe/senseme/senseme.py", line 140, in brightness
    return int(self._query("<%s;LIGHT;LEVEL;GET;ACTUAL>" % self.name))
ValueError: invalid literal for int() with base 10: 'ON'