python-lightify
python-lightify copied to clipboard
uint8 overflow when trying to send more than 255 messages in one Lightify instance
I've noted an issue that affects scripts that continually update lights (i.e. animated effect). Only 255 updates are allowed in one Lightify instance due to an unforeseen encoding issue with trying to pack a integer > 255 into an 8 bit field into the command. I suggest the following code fix to the Lightify.next_seq() function, which alleviates this issue for me. I am not trying to push because I do not understand if reuse of sequence numbers is allowed.
def next_seq(self):
self.__seq = (self.__seq + 1) % 255
return self.__seq