Python Plugin: MiPow PlayBulb
Moderator: leecollings
-
- Posts: 228
- Joined: Sunday 28 August 2016 7:48
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: France
- Contact:
Python Plugin: MiPow PlayBulb
With much delay due to many other things on my plate, I finally publish a replacement to the plugin initially written by @Deennoo (see https://www.domoticz.com/wiki/Plugins/PlayBulb that did not (at least to my knowledge) get updated for the breaking changes introduced in early 2018 to Domoticz to improve handling of color lamp devices.
It provides RGB and White color management as well as manufacturer specific "effects" and "speed" parameters for these inexpensive bluetooth LED lamps (see https://www.mipow.com/collections/playbulb).
I could only test it with the "Candle" PlayBulb model that I own, but it should in principle work with the following other PlayBulb lamps: RainbowSmart, Spot Mesh, Sphere, Garden, Comet, String and Solar.
Bear in mind though that MiPow does not publish its API and although thankfully several developers have reverse-engineered it, each type of lamp has its specifics... do not shoot at me if things do not work out of the box, but please report back with debug logs and we will try to see how to make this plugin compatible with as many models as possible. Also make sure you first have a good bluetooth connectivity with the device before calling for help with the plugin ! In this respect a bit of Linux knowledge helps... "hcitools" and a good search engine should be your first ports of calls.
Description and installation instructions are available on the Domoticz wiki at https://www.domoticz.com/wiki/Plugins/MiPowPlayBulb.
Please note it only works on Linux systems, such as Raspberry Pi, with a bluetooth LE (i.e. >= 4.0) adapter and requires the "bluepy" python library to be installed
For those interested, the code can be found at https://github.com/999LV/MiPowPlayBulb
It provides RGB and White color management as well as manufacturer specific "effects" and "speed" parameters for these inexpensive bluetooth LED lamps (see https://www.mipow.com/collections/playbulb).
I could only test it with the "Candle" PlayBulb model that I own, but it should in principle work with the following other PlayBulb lamps: RainbowSmart, Spot Mesh, Sphere, Garden, Comet, String and Solar.
Bear in mind though that MiPow does not publish its API and although thankfully several developers have reverse-engineered it, each type of lamp has its specifics... do not shoot at me if things do not work out of the box, but please report back with debug logs and we will try to see how to make this plugin compatible with as many models as possible. Also make sure you first have a good bluetooth connectivity with the device before calling for help with the plugin ! In this respect a bit of Linux knowledge helps... "hcitools" and a good search engine should be your first ports of calls.
Description and installation instructions are available on the Domoticz wiki at https://www.domoticz.com/wiki/Plugins/MiPowPlayBulb.
Please note it only works on Linux systems, such as Raspberry Pi, with a bluetooth LE (i.e. >= 4.0) adapter and requires the "bluepy" python library to be installed
For those interested, the code can be found at https://github.com/999LV/MiPowPlayBulb
-
- Posts: 1
- Joined: Thursday 20 December 2018 22:55
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Python Plugin: MiPow PlayBulb
Hi.
THX for your software.
For me it works with Candles but with Sphere it doesn't works at all
I get this:
2018-12-20 23:12:13.912 Error: (MiPowSphere1) MiPowPlayBulbAPI connection error: Failed to connect to peripheral 49:5C:4B:0F:AC:E6, addr type: public
2018-12-20 23:12:18.263 Status: (MiPowSphere1) Connected to device: Name = 'PLAYBULB SPHERE', Manufacturer = 'Mipow Limited', Serial = 'BTL301W'
2018-12-20 23:12:18.263 Status: (MiPowSphere1) Bluetooth Color Handle = 0x1b
2018-12-20 23:12:18.263 Status: (MiPowSphere1) Bluetooth Effects Handle = 0x19
2018-12-20 23:12:18.652 Error: (MiPowSphere1) MiPowPlayBulbAPI status read error: Bluetooth command failed (code: 2, error: Attribute can't be read)
2018-12-20 23:12:19.383 Error: (MiPowSphere1) MiPowPlayBulbAPI status read error: Bluetooth command failed (code: 2, error: Attribute can't be read)
And hcitool says:
~/domoticz/plugins $ sudo hcitool lescan
LE Scan ...
49:5C:4B:0F:AC:E6 (unknown)
49:5C:4B:0F:AC:E6 PLAYBULB SPHERE
6D:03:F8:D3:0A:47 (unknown)
THX for your software.
For me it works with Candles but with Sphere it doesn't works at all

I get this:
2018-12-20 23:12:13.912 Error: (MiPowSphere1) MiPowPlayBulbAPI connection error: Failed to connect to peripheral 49:5C:4B:0F:AC:E6, addr type: public
2018-12-20 23:12:18.263 Status: (MiPowSphere1) Connected to device: Name = 'PLAYBULB SPHERE', Manufacturer = 'Mipow Limited', Serial = 'BTL301W'
2018-12-20 23:12:18.263 Status: (MiPowSphere1) Bluetooth Color Handle = 0x1b
2018-12-20 23:12:18.263 Status: (MiPowSphere1) Bluetooth Effects Handle = 0x19
2018-12-20 23:12:18.652 Error: (MiPowSphere1) MiPowPlayBulbAPI status read error: Bluetooth command failed (code: 2, error: Attribute can't be read)
2018-12-20 23:12:19.383 Error: (MiPowSphere1) MiPowPlayBulbAPI status read error: Bluetooth command failed (code: 2, error: Attribute can't be read)
And hcitool says:
~/domoticz/plugins $ sudo hcitool lescan
LE Scan ...
49:5C:4B:0F:AC:E6 (unknown)
49:5C:4B:0F:AC:E6 PLAYBULB SPHERE
6D:03:F8:D3:0A:47 (unknown)
-
- Posts: 228
- Joined: Sunday 28 August 2016 7:48
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: France
- Contact:
Re: Python Plugin: MiPow PlayBulb
Thanks for the feedback... glad it works for the Candle indeed. Can you help me investigating the Sphere a bit since I do not own one and cannot test it ? If so, using gattool, can you please try to read handles 0x1b and 0x19 and report result/errors ? Also may be provide a list of bluetooth characteristics.papazol wrote: ↑Thursday 20 December 2018 23:32 Hi.
THX for your software.
For me it works with Candles but with Sphere it doesn't works at all
I get this:
2018-12-20 23:12:18.263 Status: (MiPowSphere1) Connected to device: Name = 'PLAYBULB SPHERE', Manufacturer = 'Mipow Limited', Serial = 'BTL301W'
2018-12-20 23:12:18.263 Status: (MiPowSphere1) Bluetooth Color Handle = 0x1b
2018-12-20 23:12:18.263 Status: (MiPowSphere1) Bluetooth Effects Handle = 0x19
2018-12-20 23:12:18.652 Error: (MiPowSphere1) MiPowPlayBulbAPI status read error: Bluetooth command failed (code: 2, error: Attribute can't be read)
2018-12-20 23:12:19.383 Error: (MiPowSphere1) MiPowPlayBulbAPI status read error: Bluetooth command failed (code: 2, error: Attribute can't be read)
Apologies for not giving you the commands to issue to do this as I am on the move at the moment... hope you can master this on your own...
-
- Posts: 3
- Joined: Wednesday 02 January 2019 14:58
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Python Plugin: MiPow PlayBulb
I tried to install this plugin to my RP3 & Domoticz with this instructions: https://www.domoticz.com/wiki/Plugins/MiPowPlayBulb.
I can create a new hardware, but I cannot see it under devices. Here is log from Domoticz:
2019-01-02 20:59:34.473 Error: (MiPowPlayBulb) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/MiPowPlayBulb/:/usr/lib/python35.zip:/usr/lib/python3.5:/usr/lib/python3.5/plat-arm-linux-gnueabihf:/usr/lib/python3.5/lib-dynload'.
2019-01-02 20:59:34.473 Error: (Bulb) Module Import failed, exception: 'ImportError'
2019-01-02 20:59:34.473 Error: (Bulb) Module Import failed: ' Name: bluepy'
2019-01-02 20:59:34.473 Error: (Bulb) Error Line details not available.
What should I do?
I can create a new hardware, but I cannot see it under devices. Here is log from Domoticz:
2019-01-02 20:59:34.473 Error: (MiPowPlayBulb) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/MiPowPlayBulb/:/usr/lib/python35.zip:/usr/lib/python3.5:/usr/lib/python3.5/plat-arm-linux-gnueabihf:/usr/lib/python3.5/lib-dynload'.
2019-01-02 20:59:34.473 Error: (Bulb) Module Import failed, exception: 'ImportError'
2019-01-02 20:59:34.473 Error: (Bulb) Module Import failed: ' Name: bluepy'
2019-01-02 20:59:34.473 Error: (Bulb) Error Line details not available.
What should I do?

-
- Posts: 228
- Joined: Sunday 28 August 2016 7:48
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: France
- Contact:
Re: Python Plugin: MiPow PlayBulb
Suggest you do some digging about bluepy module installation... clearly the plugin cannot find it upon startup.elke wrote: ↑Wednesday 02 January 2019 20:07 I tried to install this plugin to my RP3 & Domoticz with this instructions: https://www.domoticz.com/wiki/Plugins/MiPowPlayBulb.
I can create a new hardware, but I cannot see it under devices. Here is log from Domoticz:
2019-01-02 20:59:34.473 Error: (MiPowPlayBulb) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/MiPowPlayBulb/:/usr/lib/python35.zip:/usr/lib/python3.5:/usr/lib/python3.5/plat-arm-linux-gnueabihf:/usr/lib/python3.5/lib-dynload'.
2019-01-02 20:59:34.473 Error: (Bulb) Module Import failed, exception: 'ImportError'
2019-01-02 20:59:34.473 Error: (Bulb) Module Import failed: ' Name: bluepy'
2019-01-02 20:59:34.473 Error: (Bulb) Error Line details not available.
What should I do?![]()
-
- Posts: 16
- Joined: Saturday 06 May 2017 22:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 3.8153
- Contact:
Re: Python Plugin: MiPow PlayBulb
Hello,
I have same error with last version of the raspbian.
2019-01-04 16:17:13.202 Error: (MiPowPlayBulb) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/MiPowPlayBulb/:/usr/lib/python35.zip:/usr/lib/python3.5:/usr/lib/python3.5/plat-arm-linux-gnueabihf:/usr/lib/python3.5/lib-dynload'.
2019-01-04 16:17:13.202 Error: (Svicka Mipow) Module Import failed, exception: 'ImportError'
2019-01-04 16:17:13.202 Error: (Svicka Mipow) Module Import failed: ' Name: bluepy'
2019-01-04 16:17:13.202 Error: (Svicka Mipow) Error Line details not available.
Solution: sudo ln -s /home/pi/.local/lib/python3.5/site-packages/bluepy /usr/lib/python3.5/
I have same error with last version of the raspbian.
2019-01-04 16:17:13.202 Error: (MiPowPlayBulb) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/MiPowPlayBulb/:/usr/lib/python35.zip:/usr/lib/python3.5:/usr/lib/python3.5/plat-arm-linux-gnueabihf:/usr/lib/python3.5/lib-dynload'.
2019-01-04 16:17:13.202 Error: (Svicka Mipow) Module Import failed, exception: 'ImportError'
2019-01-04 16:17:13.202 Error: (Svicka Mipow) Module Import failed: ' Name: bluepy'
2019-01-04 16:17:13.202 Error: (Svicka Mipow) Error Line details not available.
Solution: sudo ln -s /home/pi/.local/lib/python3.5/site-packages/bluepy /usr/lib/python3.5/
-
- Posts: 228
- Joined: Sunday 28 August 2016 7:48
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: France
- Contact:
Re: Python Plugin: MiPow PlayBulb
Definitely an issue with the system setup, not with the plugin. Did you create the symlink as instructed in installation section of the wiki page for the plugin ?lukbe wrote: ↑Friday 04 January 2019 16:19 Hello,
I have same error with last version of the raspbian.
2019-01-04 16:17:13.202 Error: (MiPowPlayBulb) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/MiPowPlayBulb/:/usr/lib/python35.zip:/usr/lib/python3.5:/usr/lib/python3.5/plat-arm-linux-gnueabihf:/usr/lib/python3.5/lib-dynload'.
2019-01-04 16:17:13.202 Error: (Svicka Mipow) Module Import failed, exception: 'ImportError'
2019-01-04 16:17:13.202 Error: (Svicka Mipow) Module Import failed: ' Name: bluepy'
2019-01-04 16:17:13.202 Error: (Svicka Mipow) Error Line details not available.
Can you please check where bluepy resides in your system (which bluepy) ? May be the above symlink needs to be adjusted... your favorite search engine will be your friend, as this issue is again unrelated to the plugin.
-
- Posts: 16
- Joined: Saturday 06 May 2017 22:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 3.8153
- Contact:
Re: Python Plugin: MiPow PlayBulb
Solution: sudo ln -s /home/pi/.local/lib/python3.5/site-packages/bluepy /usr/lib/python3.5/
pi@raspberrypi:~/domoticz/plugins/MiPowPlayBulb $ pip3 show bluepy Name: bluepy
Version: 1.3.0
Summary: Python module for interfacing with BLE devices through Bluez
Home-page: https://github.com/IanHarvey/bluepy
Author: Ian Harvey
Author-email: [email protected]
License: UNKNOWN
Location: /home/pi/.local/lib/python3.5/site-packages
Requires:
pi@raspberrypi:~/domoticz/plugins/MiPowPlayBulb $ pip3 show bluepy Name: bluepy
Version: 1.3.0
Summary: Python module for interfacing with BLE devices through Bluez
Home-page: https://github.com/IanHarvey/bluepy
Author: Ian Harvey
Author-email: [email protected]
License: UNKNOWN
Location: /home/pi/.local/lib/python3.5/site-packages
Requires:
-
- Posts: 228
- Joined: Sunday 28 August 2016 7:48
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: France
- Contact:
Re: Python Plugin: MiPow PlayBulb
Thanks for posting this workout, though my own raspberries pi3 (three systems with Debian Stretch) do work with the link as I described in the wiki (the difference is indeed ".local" vs. "local"... something must have recently changed in the bluepy install process I guess.
-
- Posts: 3
- Joined: Wednesday 02 January 2019 14:58
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Python Plugin: MiPow PlayBulb
Thanks - got plugin working by reinstalling bluepy. Actually I do not have any Mipow bulbs, but I have "Giron-C" bt Awox ceiling lights from Eglo: https://www.eglo.com/international/Prod ... nnect)/ECOLogread wrote: ↑Wednesday 02 January 2019 22:30Suggest you do some digging about bluepy module installation... clearly the plugin cannot find it upon startup.elke wrote: ↑Wednesday 02 January 2019 20:07 I tried to install this plugin to my RP3 & Domoticz with this instructions: https://www.domoticz.com/wiki/Plugins/MiPowPlayBulb.
I can create a new hardware, but I cannot see it under devices. Here is log from Domoticz:
2019-01-02 20:59:34.473 Error: (MiPowPlayBulb) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/MiPowPlayBulb/:/usr/lib/python35.zip:/usr/lib/python3.5:/usr/lib/python3.5/plat-arm-linux-gnueabihf:/usr/lib/python3.5/lib-dynload'.
2019-01-02 20:59:34.473 Error: (Bulb) Module Import failed, exception: 'ImportError'
2019-01-02 20:59:34.473 Error: (Bulb) Module Import failed: ' Name: bluepy'
2019-01-02 20:59:34.473 Error: (Bulb) Error Line details not available.
What should I do?![]()
Is it possible to also control those lights with this script?

-
- Posts: 228
- Joined: Sunday 28 August 2016 7:48
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: France
- Contact:
Re: Python Plugin: MiPow PlayBulb
No idea... but most likely not as it seems the control protocol of each manufacturer is proprietary (and typically not made public...)elke wrote: ↑Friday 04 January 2019 21:17 Thanks - got plugin working by reinstalling bluepy. Actually I do not have any Mipow bulbs, but I have "Giron-C" bt Awox ceiling lights from Eglo: https://www.eglo.com/international/Prod ... nnect)/ECO
Is it possible to also control those lights with this script?![]()
-
- Posts: 228
- Joined: Sunday 28 August 2016 7:48
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: France
- Contact:
Re: Python Plugin: MiPow PlayBulb
Pulled new version 2019.01.05 to GitHub:
- change timing of battery poll when lamp is on (faster discharge = more frequent polls)
- reload battery level when the device is reconnected after a disconnect
- change order of switching parameters in _ResetLamp function to correct lamps always switching on when plugin (re)starts
- change timing of battery poll when lamp is on (faster discharge = more frequent polls)
- reload battery level when the device is reconnected after a disconnect
- change order of switching parameters in _ResetLamp function to correct lamps always switching on when plugin (re)starts
-
- Posts: 228
- Joined: Sunday 28 August 2016 7:48
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: France
- Contact:
Re: Python Plugin: MiPow PlayBulb
Pulled new version 2019.02.09 to GitHub:
- improve battery level handling.
- improve battery level handling.
-
- Posts: 228
- Joined: Sunday 28 August 2016 7:48
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: France
- Contact:
Re: Python Plugin: MiPow PlayBulb
Pulled new version 2019-03-21 on Github.
This is a major improvement that leverages @Dnpwwo's recent implementation of multi-threading in the python plugin framework... Now all calls to the hardware are handled by separate threads. This allows to avoid blocking (and messing with) the plugin framework in situation of connectivity issues with the bluetooth lamp device.
This is a major improvement that leverages @Dnpwwo's recent implementation of multi-threading in the python plugin framework... Now all calls to the hardware are handled by separate threads. This allows to avoid blocking (and messing with) the plugin framework in situation of connectivity issues with the bluetooth lamp device.
Who is online
Users browsing this forum: Bing [Bot] and 1 guest