Python Plugin : Xiaomi Philips LED Ball Lamp Topic is solved

Python and python framework

Moderator: leecollings

Samael
Posts: 27
Joined: Saturday 12 January 2019 11:48
Target OS: Windows
Domoticz version: 4.9701
Contact:

Re: Python Plugin : Xiaomi Philips LED Ball Lamp

Post by Samael »

If you make a call from the console "bash -c ./MyBulb.py <IpOfBulb> <TokenOfBulb>", will it be successful? You must be in catalog of the plugin and use corresponding IP and token of your lamp.
If you make a call from the console "python ./MyBulb.py <IpOfBulb> <TokenOfBulb>", will it be successful too?

Successful call will print something like that:
<PhilipsBulbStatus power=off, brightness=50, color_temperature=1, scene=3, delay_off_countdown=0>
mgabor
Posts: 15
Joined: Friday 01 February 2019 7:33
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin : Xiaomi Philips LED Ball Lamp

Post by mgabor »

Hi,
I have tried. Same problem, "MyBulb.py: error: the following arguments are required: IPaddress, token"
Samael
Posts: 27
Joined: Saturday 12 January 2019 11:48
Target OS: Windows
Domoticz version: 4.9701
Contact:

Re: Python Plugin : Xiaomi Philips LED Ball Lamp

Post by Samael »

What does it say 'python --version' ?
mgabor
Posts: 15
Joined: Friday 01 February 2019 7:33
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin : Xiaomi Philips LED Ball Lamp

Post by mgabor »

Python version 3.5.3
Samael
Posts: 27
Joined: Saturday 12 January 2019 11:48
Target OS: Windows
Domoticz version: 4.9701
Contact:

Re: Python Plugin : Xiaomi Philips LED Ball Lamp

Post by Samael »

I have no linux at this moment but this should work (you must use your own IP and token and be in /home/pi/domoticz/plugins/domoticz-Xiaomi-Led-Lamp):
python MyBulb.py 192.168.10.102 89bedfa9123841a44030fd4ae2a0db09

When I call 'MyBulb.py 192.168.10.102 89bedfa9123841a44030fd4ae2a0db09' under Windows (without python) I get the same error 2. So I suppose that in your environment something is not configured right and command 'bash -c ./MyBulb.py 192.168.10.102 89bedfa9123841a44030fd4ae2a0db09' is failed because bash can not find the python. But I could be wrong. I do not have much experience with Linux.
mgabor
Posts: 15
Joined: Friday 01 February 2019 7:33
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin : Xiaomi Philips LED Ball Lamp

Post by mgabor »

I tried from Python, but I have received same error. 😒. Thank you, that you try to help me.
Samael
Posts: 27
Joined: Saturday 12 January 2019 11:48
Target OS: Windows
Domoticz version: 4.9701
Contact:

Re: Python Plugin : Xiaomi Philips LED Ball Lamp

Post by Samael »

Have you done this?
sudo chmod 777 /home/pi/domoticz/plugins/domoticz-Xiaomi-Led-Lamp/MyBulb.py
mgabor
Posts: 15
Joined: Friday 01 February 2019 7:33
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin : Xiaomi Philips LED Ball Lamp

Post by mgabor »

Nothing change, same error.
mgabor
Posts: 15
Joined: Friday 01 February 2019 7:33
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin : Xiaomi Philips LED Ball Lamp

Post by mgabor »

I have found this error now:

Traceback (most recent call last):
File "MyBulb.py", line 11, in <module>
import miio.philips_bulb
ImportError: No module named miio.philips_bulb

Where is the module named miio.philips_bulb? I have not found.
mgabor
Posts: 15
Joined: Friday 01 February 2019 7:33
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin : Xiaomi Philips LED Ball Lamp

Post by mgabor »

Samael wrote: Sunday 03 February 2019 17:32 Have you done this?
sudo chmod 777 /home/pi/domoticz/plugins/domoticz-Xiaomi-Led-Lamp/MyBulb.py
Dear Samael,
I have found this error now:

Traceback (most recent call last):
File "MyBulb.py", line 11, in <module>
import miio.philips_bulb
ImportError: No module named miio.philips_bulb

Where is the module named miio.philips_bulb? I have not found.
Samael
Posts: 27
Joined: Saturday 12 January 2019 11:48
Target OS: Windows
Domoticz version: 4.9701
Contact:

Re: Python Plugin : Xiaomi Philips LED Ball Lamp

Post by Samael »

You have to install a python-miio lib.
sudo pip3 install python-miio

It is installed as site package into the Python.
Last edited by Samael on Monday 04 February 2019 0:13, edited 1 time in total.
Samael
Posts: 27
Joined: Saturday 12 January 2019 11:48
Target OS: Windows
Domoticz version: 4.9701
Contact:

Re: Python Plugin : Xiaomi Philips LED Ball Lamp

Post by Samael »

People, I see that there are some problems with running under Linux. I will conduct some experiments and make the necessary edits. Please be patient. :(
Samael
Posts: 27
Joined: Saturday 12 January 2019 11:48
Target OS: Windows
Domoticz version: 4.9701
Contact:

Re: Python Plugin : Xiaomi Philips LED Ball Lamp

Post by Samael »

You can update plugin now.
And don't forget to change the file permissions.
sudo chmod +x MyBulb.py
sudo chmod +x plugin.py
Samael
Posts: 27
Joined: Saturday 12 January 2019 11:48
Target OS: Windows
Domoticz version: 4.9701
Contact:

Re: Python Plugin : Xiaomi Philips LED Ball Lamp

Post by Samael »

mgabor wrote: Sunday 03 February 2019 15:51 Hi,
I have tried. Same problem, "MyBulb.py: error: the following arguments are required: IPaddress, token"
Please update plugin from git. It should work now.
mgabor
Posts: 15
Joined: Friday 01 February 2019 7:33
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin : Xiaomi Philips LED Ball Lamp

Post by mgabor »

Dear Samael,
Thanks, thanks... it is working. Nice work! :)
Justintime
Posts: 228
Joined: Thursday 21 May 2015 9:08
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Contact:

Re: Python Plugin : Xiaomi Philips LED Ball Lamp

Post by Justintime »

So this plugin is also for these lights?

€ 10,12 62%OFF | [HOT]riginal xiaomi mijia smart downlight work with mi home app smart remote control white & warm light phone change light
https://s.click.aliexpress.com/e/BOhOXFL

Does someone knows if you can "group" them?
Samael
Posts: 27
Joined: Saturday 12 January 2019 11:48
Target OS: Windows
Domoticz version: 4.9701
Contact:

Re: Python Plugin : Xiaomi Philips LED Ball Lamp

Post by Samael »

Yes, I think it should work.
To organize the group of lights you better read the manual (http://www.domoticz.com/DomoticzManual.pdf) and https://www.domoticz.com/forum/viewtopic.php?t=14903.
salvacalatayud
Posts: 112
Joined: Monday 26 June 2017 21:16
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Spain
Contact:

Re: Python Plugin : Xiaomi Philips LED Ball Lamp

Post by salvacalatayud »

Hi, when I try to update I get this error:

Your local changes to the following files would be overwritten by merge:
MyBulb.py
Please commit your changes or stash them before you merge.
Aborting

Need help.

Thanks
Samael
Posts: 27
Joined: Saturday 12 January 2019 11:48
Target OS: Windows
Domoticz version: 4.9701
Contact:

Re: Python Plugin : Xiaomi Philips LED Ball Lamp

Post by Samael »

salvacalatayud wrote: Friday 01 March 2019 16:52 Please commit your changes or stash them before you merge.
This means that you have made some changes to the file. Do the next commands inside 'domoticz-Xiaomi-Led-Lamp':

Code: Select all

git reset

Code: Select all

git checkout .
ps: https://stackoverflow.com/questions/140 ... ed-changes
salvacalatayud
Posts: 112
Joined: Monday 26 June 2017 21:16
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Spain
Contact:

Re: Python Plugin : Xiaomi Philips LED Ball Lamp

Post by salvacalatayud »

Samael wrote:
salvacalatayud wrote: Friday 01 March 2019 16:52 Please commit your changes or stash them before you merge.
This means that you have made some changes to the file. Do the next commands inside 'domoticz-Xiaomi-Led-Lamp':

Code: Select all

git reset

Code: Select all

git checkout .
ps: https://stackoverflow.com/questions/140 ... ed-changes
Worked, thanks

Enviado desde mi Mi A2 mediante Tapatalk

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest