Mote and Apple Homekit


Mote arrived yesterday and is working well.
I tried out the Apple Homekit integration (via and Homebridge … and there are a few problems that I think could handle better.

Error as follows:

Traceback (most recent call last): File "/usr/share/pyshared/flask/", line 1836, in __call__ return self.wsgi_app(environ, start_response) File "/usr/share/pyshared/flask/", line 1820, in wsgi_app response = self.make_response(self.handle_exception(e)) File "/usr/share/pyshared/flask/", line 1403, in handle_exception reraise(exc_type, exc_value, tb) File "/usr/share/pyshared/flask/", line 1817, in wsgi_app response = self.full_dispatch_request() File "/usr/share/pyshared/flask/", line 1477, in full_dispatch_request rv = self.handle_user_exception(e) File "/usr/share/pyshared/flask/", line 1381, in handle_user_exception reraise(exc_type, exc_value, tb) File "/usr/share/pyshared/flask/", line 1475, in full_dispatch_request rv = self.dispatch_request() File "/usr/share/pyshared/flask/", line 1461, in dispatch_request return self.view_functions[rule.endpoint](**req.view_args) File "/home/pi/Pimoroni/", line 65, in set_colour mote_on(colour) File "/home/pi/Pimoroni/", line 22, in mote_on r, g, b = hex_to_rgb(c) File "/home/pi/Pimoroni/", line 19, in hex_to_rgb return tuple(int(value[i:i + length / 3], 16) for i in range(0, length, length / 3)) File "/home/pi/Pimoroni/", line 19, in <genexpr> return tuple(int(value[i:i + length / 3], 16) for i in range(0, length, length / 3)) ValueError: invalid literal for int() with base 16: 'NaN'

I suspect that Siri or Apple Home application is not setting some of the values - e.g. Color - when doing a simple On command - which results in error and then issues with Apple thinking device is on when it is not.


You might want to give this a try, I’m not sure if it’ll fix your problem, but if you’re using the HomeKit API then your eyes would be greatly appreciated on this code:


I’ll give it a try.
Am also starting to look at getting an old 1st Gen colour bulb remote control working with it.
Family not convinced that they have to get out phone to turn lights on (and particularly off).


Aha - version control issues I think …

I used the code from this post
but that is not the same as in github (master)
e.g. /on replaced by one that requires channel number or “all”.
So this breaks the homebridge integration.
The original API calls should be retained - and then (for example) a /on should then call the new function with “all”.
Alternative is to update the homebridge config file - but then that makes it harder for anyone who has followed the example and then updates the mote scripts.
So much for the script having a version 1.0 endpoint ;)

Also - the needs to be added to the pull request.

Edit: Also - the returns from API when used by HomeKit/Homebridge will, presumably have to provide the best guess reply on the assumption that all pixels are in the same state.
Perhaps provide each channel as a different device to allow a set of pixels to be individually controlled - but probably not required.


I’ve added a version of this comment to the GitHub page.