Add function to set LED visibility #17

Manually merged
sqozz merged 2 commits from feature/ring_led into master 2020-05-08 20:34:16 +02:00
Showing only changes of commit f488869f3d - Show all commits

View file

@ -105,6 +105,14 @@ class SEMSocket():
self.authenticated = self.authenticated and success
return success
def setIcon(self, iconIdx):
cmd = bytearray([0x0f])
payload = bytearray([0x00, 0x03, iconIdx, 0x00, 0x00, 0x00, 0x00])
msg = self.BTLEMessage(self, cmd, payload)
success = msg.send()
return success
@property
def name(self):
self._name = self._name_char.read().decode("UTF-8")
@ -293,7 +301,13 @@ class SEMSocket():
else:
print("5th byte of login-response is > 1:", data)
elif message_type == 0x0f: #set icon response
if not data[3:] == b'\x00\x03\x00\x13\xff\xff':
if data[3:6] == b'\x00\x03\x00':
# LED set successfully
pass
elif data[3:6] == b'\x00\x05\x00':
# Icon set successfully
pass
else:
print("Unknown response for setting icon: ", end="")
print(data[3:])
else: