Python Plugin : Xiaomi Philips LED Ball Lamp Topic is solved

Python and python framework

Moderator: leecollings

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,
I have found that the token has changed, so the bulb did not work. I change the token in domoticz, but when I have added the new bulb with new token, the device does not appear in the list. In the log file I have found this.
2019-03-02 07:54:30.700 Error: Lámpa1 hardware (9) thread seems to have ended unexpectedly
2019-03-02 07:55:00.781 Error: Lámpa1 hardware (9) thread seems to have ended unexpectedly
2019-03-02 07:55:30.790 Error: Lámpa1 hardware (9) thread seems to have ended unexpectedly
2019-03-02 07:56:00.795 Error: Lámpa1 hardware (9) thread seems to have ended unexpectedly

I have done this:
update, upgrade, restart, nothing changes
What is the problem?
Gabor
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: Saturday 02 March 2019 8:03 Dear,
I have found that the token has changed, so the bulb did not work.
First of all, you have to test a new token with MyBulb.py. Run command with lamp IP and it's token

Code: Select all

MyBulb.py 192.168.10.102 89bedfa9123841a44030fd4ae2a0db09 status
What does it say?
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 »

the answer:
Traceback (most recent call last):
File "MyBulb.py", line 11, in <module>
import miio.philips_bulb
ImportError: No module named miio.philips_bulb
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: Saturday 02 March 2019 16:25 the answer:
Traceback (most recent call last):
File "MyBulb.py", line 11, in <module>
import miio.philips_bulb
ImportError: No module named miio.philips_bulb
Did you install python-miio library? Please read this guide https://python-miio.readthedocs.io/en/l ... overy.html
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 »

Yes, I have installed. I have used the Bulb, but the token has changed, since I have to add again the hardver
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 someone switched to the development branch of Domoticz, then I recommend to pick up the plugin from the dev branch:
https://github.com/deennoo/domoticz-Xia ... p/tree/dev

This version is faster.
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 March 2019 14:44 Yes, I have installed. I have used the Bulb, but the token has changed, since I have to add again the hardver
Hmm. You can change the token on Hardware tab and simply press update. No need to remove and add.
koles142
Posts: 2
Joined: Sunday 17 February 2019 12:52
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin : Xiaomi Philips LED Ball Lamp

Post by koles142 »

Hi,

I'm using your plugin. I can control my bulb, can change color, level light but i can't turn off the bulb from Domoticz. In my log I have:
Error: [bulb name] Call command failed: Command '['./MyBulb.py', '192.168.31.103', 'bulb token', '--scene', '0']' returned non-zero exit status 2.
When I turn off my bulb from xiaomi app i can turn on it again from Domoticz. I can do anything with bulb except the turning off. Have you any idea?

thnaks
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 »

At the moment I am using a development version of the plugin with a beta version of domoticz, since it does not use the launch of an additional script to execute commands. I hope the release of stable version of domoticz will be soon..
fecus
Posts: 16
Joined: Monday 20 February 2017 15:24
Target OS: Linux
Domoticz version: 4.11597
Location: Hungary
Contact:

Re: Python Plugin : Xiaomi Philips LED Ball Lamp

Post by fecus »

First of all, thank you for your efforts.
I installed your plugin from git.

It made two devices.
The scenes device is working well.
The CCCW device requires a password. What kind of password are asking?
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 »

There is no any passwords and can not be. Source code is open. I assume this is related to the work environment. Currently I use Python 3.6.8.
C:\Python>pip3 list miio
Package Version
--------------------- ----------
android-backup 0.2.0
appdirs 1.4.3
asn1crypto 0.24.0
attrs 18.2.0
certifi 2018.11.29
cffi 1.11.5
Click 7.0
construct 2.9.45
cryptography 2.4.2
idna 2.8
ifaddr 0.1.6
netifaces 0.10.9
pip 19.3.1
pipenv 2018.11.26
pretty-cron 1.2.0
pycparser 2.19
python-miio 0.4.4
pytz 2018.9
setuptools 40.8.0
six 1.12.0
tqdm 4.29.1
virtualenv 16.2.0
virtualenv-clone 0.4.0
virtualenvwrapper-win 1.2.5
zeroconf 0.21.3
jstruik
Posts: 6
Joined: Thursday 30 April 2020 15:13
Target OS: NAS (Synology & others)
Domoticz version: 2020.1
Contact:

Re: Python Plugin : Xiaomi Philips LED Ball Lamp

Post by jstruik »

@Samuel
thank you so much for your effort. I accidentally bought this Xiaomi Philips LED bulb. I wanted to buy the Xiaomi ZNLDP12LM which has Zigbee support to match my xiaomi mijia temperature sensors...
Nevertheless, your plugin saved me from reverse-engineering the protocol and building a domoticz plugin myself!

In the complete process of setting up domoticz on a synology NAS, configuring Zigbee2mqtt, configuring NefitEasyServer and now configuring this LEDbulb I already spend so much hours searching this forum and this is my first message to thank you (all).
running on DSM 6.2.2-24922 Update 4 @ Synology DS216j
Zigbee2mqtt @ CC2531 USb stick
2 * xiaomi mijia temperature sensor
Xiaomi Philips E27 LEDbulb
NefitEasyServer
Dashticz v3
jstruik
Posts: 6
Joined: Thursday 30 April 2020 15:13
Target OS: NAS (Synology & others)
Domoticz version: 2020.1
Contact:

Re: Python Plugin : Xiaomi Philips LED Ball Lamp

Post by jstruik »

for future reference: after the synology DSM upgrade the plugin didn't work anymore. I had to rethink the steps taken previous month

bash expects a file python3 in the /usr/bin directory. In my case (Synology DS216j), it wasn't present. With a symbolic link it worked again:

Code: Select all

cd /usr/bin
sudo ln -s /opt/bin/pyhton3.7 python3
running on DSM 6.2.2-24922 Update 4 @ Synology DS216j
Zigbee2mqtt @ CC2531 USb stick
2 * xiaomi mijia temperature sensor
Xiaomi Philips E27 LEDbulb
NefitEasyServer
Dashticz v3
manjh
Posts: 748
Joined: Saturday 27 February 2016 12:49
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: NL
Contact:

Re: Python Plugin : Xiaomi Philips LED Ball Lamp

Post by manjh »

I'm trying to get started with this bulb. First step was to learn how to reset it (5 consecutive on/off switches), and add it to Mi Home.
The reset worked, but Mi Home does not want to see the lamp.
I tried scanning without result. Then tried manually, connected to the lamp's WiFi. That worked, but still Mi Home will not connect the lamp.

Seems to me I should get this working before attempting to control the lamp from Domoticz...

Can someone give me a hint?
Hans
polargeex
Posts: 1
Joined: Friday 31 December 2021 10:19
Target OS: -
Domoticz version:
Contact:

Re: Python Plugin : Xiaomi Philips LED Ball Lamp

Post by polargeex »

Hello, I try to use this plugin and I have an error

On master Domoticz say :

Code: Select all

Get status failed: Command '['./MyBulb.py', '192.168.0.90', 'fc6e962c38a7ae378fe164acc278f556']' returned non-zero exit status 1.
On console when I type "python ./MyBulb.py 192.168.0.90 fc6e962c38a7ae378fe164acc278f556" I have this response:

Code: Select all

<PhilipsBulbStatus brightness=100 color_temperature=1 delay_off_countdown=0 is_on=True power=on scene=0>
So it's work on console but not in domoticz

If I switch on dev branch I dont no work in console with this error:

Code: Select all

 python ./MyBulb.py 192.168.0.90 fc6e962c38a7ae378fe164acc278f556
Traceback (most recent call last):
  File "/home/pi/.local/lib/python3.7/site-packages/miio/miioprotocol.py", line 193, in send
    data, addr = s.recvfrom(4096)
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./MyBulb.py", line 55, in <module>
    print(MyBulb.status())
  File "/home/pi/.local/lib/python3.7/site-packages/miio/click_common.py", line 186, in _wrap
    self._fetch_info()
  File "/home/pi/.local/lib/python3.7/site-packages/miio/device.py", line 149, in _fetch_info
    devinfo = DeviceInfo(self.send("miIO.info"))
  File "/home/pi/.local/lib/python3.7/site-packages/miio/device.py", line 104, in send
    command, parameters, retry_count, extra_parameters=extra_parameters
  File "/home/pi/.local/lib/python3.7/site-packages/miio/miioprotocol.py", line 237, in send
    extra_parameters=extra_parameters,
  File "/home/pi/.local/lib/python3.7/site-packages/miio/miioprotocol.py", line 161, in send
    self.send_handshake()
  File "/home/pi/.local/lib/python3.7/site-packages/miio/miioprotocol.py", line 74, in send_handshake
    raise DeviceException("Unable to discover the device %s" % self.ip)
miio.exceptions.DeviceException: Unable to discover the device 192.168.0.90
version of python-miio 0.5.9.2
Domoticz Version: 2021.1
Build Hash: 8547c5b7e
Compile Date: 2021-04-17 17:29:11
dzVents Version: 3.1.7
Python Version: 3.7.3

Someone can help me?
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest