Closed hawaii6 closed 5 years ago
Yes. All subprocess.check_output must be in try except block.
I need a bit more time to learn how to properly update device status for Domoticz and not flood the log.
Work around: When you phisically power on the philips bulb you need to turn it off and on in Domoticz. After that no errors will appeared in the log.
@hawaii6 please check the latest version of the plugin. I think it is fixed now. If so, you can close this issue.
Cheers mate. Gonna give you feedback asap.
now it looks like that. After git pull ofcourse.
2019-01-28 21:55:43.495 (salon 5) Get status failed: Command '['bash', '-c', './MyBulb.py', '192.168.1.14', '0cbc2e4ced']' returned non-zero exit status 126 2019-01-28 21:55:43.495 (salon 5) Update status failed: 'BulbStatus' object has no attribute 'color_temperature' 2019-01-28 21:55:43.503 (salon 5) Problem with xiaomi downlight - salon 5 - CCCW 2019-01-28 21:55:43.510 (salon 5) Problem with xiaomi downlight - salon 5 - Scenes 2019-01-28 21:55:43.510 (salon 5) Starting device update
Yes. It is normal. It means that device has a problem (not reachable by network, for example). Corresponding devices must be with red captions now on the dashboard, so you can see that something is wrong with the device. As soon as the device appears on the network and the plugin is able to successfully retrieve its status, errors will disappear from the log.
Device status is checked around every minute.
Hi,
I have a issues in this script and Domoticz.
Logs: 2019-02-02 21:18:16.712 Error: (Philips Prawa) Call command failed: Command '['bash', '-c', './MyBulb.py', '192.168.1.53', 'bbedcbe3335b5a1dabe36f3c723d8ca0', '--scene', '4']' returned non-zero exit status 2 2019-02-02 21:18:18.095 (Philips Prawa) onCommand called for Unit 1 cmd 'Set Level' Level '20' Color '' 2019-02-02 21:18:18.095 Error: (Philips Prawa) Call command failed: Command '['bash', '-c', './MyBulb.py', '192.168.1.53', 'bbedcbe3335b5a1dabe36f3c723d8ca0', '--scene', '3']' returned non-zero exit status 2 2019-02-02 21:18:19.416 Error: (Philips Prawa) Call command failed: Command '['bash', '-c', './MyBulb.py', '192.168.1.53', 'bbedcbe3335b5a1dabe36f3c723d8ca0', '--scene', '2']' returned non-zero exit status 2
@Bodzio122333 Did you turn off the lamp physically? Is the lamp active in the application MiHome? Does the lamp have a reliable wifi connection? Is the lamp using a static address?
@SamaelRanger Hello, I'm trying use your plugin with Xiaomi Philips Zhirui Smart LED Bulb E14 Candle The lamp is active in the MiHome APP, IP address by DHCP, in the log of Domoticz when it power on physically
2019-02-03 18:19:47.813 (Philips Zhirui E14 Candle) Get status failed: Command '['bash', '-c', './MyBulb.py', '192.168.1.199', '2039b67161d60183880ce8dc72574f33']' returned non-zero exit status 1
2019-02-03 18:19:47.813 (Philips Zhirui E14 Candle) Update status failed: 'BulbStatus' object has no attribute 'color_temperature'
2019-02-03 18:19:47.813 (LED Candle - CCCW) Updating device from 0:'0' to have values 0:'0'.
2019-02-03 18:19:47.818 (Philips Zhirui E14 Candle) Problem with LED Candle - CCCW
2019-02-03 18:19:47.818 (LED Candle - Scenes) Updating device from 0:'0' to have values 0:'0'.
2019-02-03 18:19:47.821 (Philips Zhirui E14 Candle) Problem with LED Candle - Scenes
2019-02-03 18:19:47.821 (Philips Zhirui E14 Candle) Starting device update
2019-02-03 18:19:47.821 (Philips Zhirui E14 Candle) onHeartbeat finished
2019-02-03 18:19:50.929 Status: User: Admin initiated a switch command (4/LED Candle - Scenes/Set Level)
2019-02-03 18:19:50.929 (Philips Zhirui E14 Candle) Pushing 'onCommandCallback' on to queue
2019-02-03 18:19:50.978 (Philips Zhirui E14 Candle) Processing 'onCommandCallback' message
2019-02-03 18:19:50.978 (Philips Zhirui E14 Candle) Calling message handler 'onCommand'.
2019-02-03 18:19:50.978 (Philips Zhirui E14 Candle) onCommand called for Unit 1 cmd 'Set Level' Level '10' Color ''
2019-02-03 18:19:50.979 (Philips Zhirui E14 Candle) Call command: ['bash', '-c', './MyBulb.py', '192.168.1.199', '2039b67161d60183880ce8dc72574f33', '--scene', '1']
2019-02-03 18:19:51.222 Error: (Philips Zhirui E14 Candle) Call command failed: Command '['bash', '-c', './MyBulb.py', '192.168.1.199', '2039b67161d60183880ce8dc72574f33', '--scene', '1']' returned non-zero exit status 1
2019-02-03 18:19:55.872 Status: User: Admin initiated a switch command (5/LED Candle - CCCW/Set Level)
2019-02-03 18:19:55.873 (Philips Zhirui E14 Candle) Pushing 'onCommandCallback' on to queue
2019-02-03 18:19:55.883 (Philips Zhirui E14 Candle) Processing 'onCommandCallback' message
2019-02-03 18:19:55.883 (Philips Zhirui E14 Candle) Calling message handler 'onCommand'.
2019-02-03 18:19:55.883 (Philips Zhirui E14 Candle) onCommand called for Unit 2 cmd 'Set Level' Level '14' Color ''
2019-02-03 18:19:55.883 (Philips Zhirui E14 Candle) Call command: ['bash', '-c', './MyBulb.py', '192.168.1.199', '2039b67161d60183880ce8dc72574f33', '--level', '14']
2019-02-03 18:19:56.082 Error: (Philips Zhirui E14 Candle) Call command failed: Command '['bash', '-c', './MyBulb.py', '192.168.1.199', '2039b67161d60183880ce8dc72574f33', '--level', '14']' returned non-zero exit status 1
console:
$ ./MyBulb.py 192.168.1.199 2039b67161d60183880ce8dc72574f33
<PhilipsBulbStatus power=on, brightness=1, color_temperature=1, scene=1, delay_off_countdown=0>
$ ./MyBulb.py 192.168.1.199 2039b67161d60183880ce8dc72574f33 --power ON
<PhilipsBulbStatus power=on, brightness=1, color_temperature=1, scene=1, delay_off_countdown=0>
$ ./MyBulb.py 192.168.1.199 2039b67161d60183880ce8dc72574f33 --power OFF
<PhilipsBulbStatus power=off, brightness=1, color_temperature=1, scene=1, delay_off_countdown=0>
@AlexKholodkov it is the same problem as in #5. Please get the latest version, I hope it works. Or I fix it next day.
@SamaelRanger Well, I saw this problem, this is just for your information. I am using the latest version of git. Thanks
@hawaii6 Could you check for the latest version of the plugin? Should I improve something else?
@SamaelRanger just updated, bash -c errors disappeared, it still doesn't work from Domoticz, but it works fine from the command line.
Domoticz log: 2019-02-04 17:14:05.714 (Philips Zhirui E14 Candle) sensor_measurement 2019-02-04 17:14:05.872 (Philips Zhirui E14 Candle) Get status failed: Command '['./MyBulb.py', '192.168.1.199', '59772e650b11f69d476ed84f56c92bcf']' returned non-zero exit status 1 2019-02-04 17:14:05.872 (Philips Zhirui E14 Candle) Update status failed: 'BulbStatus' object has no attribute 'color_temperature' 2019-02-04 17:14:05.873 (LED Candle - CCCW) Updating device from 0:'0' to have values 0:'0'. 2019-02-04 17:14:05.877 (Philips Zhirui E14 Candle) Problem with LED Candle - CCCW 2019-02-04 17:14:05.877 (LED Candle - Scenes) Updating device from 0:'0' to have values 0:'0'. 2019-02-04 17:14:05.881 (Philips Zhirui E14 Candle) Problem with LED Candle - Scenes 2019-02-04 17:14:05.881 (Philips Zhirui E14 Candle) Starting device update 2019-02-04 17:14:05.881 (Philips Zhirui E14 Candle) onHeartbeat finished ... 2019-02-04 17:18:35.801 Status: User: Admin initiated a switch command (4/LED Candle - Scenes/Set Level) 2019-02-04 17:18:35.802 (Philips Zhirui E14 Candle) Pushing 'onCommandCallback' on to queue 2019-02-04 17:18:35.808 (Philips Zhirui E14 Candle) Processing 'onCommandCallback' message 2019-02-04 17:18:35.808 (Philips Zhirui E14 Candle) Calling message handler 'onCommand'. 2019-02-04 17:18:35.808 (Philips Zhirui E14 Candle) onCommand called for Unit 1 cmd 'Set Level' Level '10' Color '' 2019-02-04 17:18:35.808 (Philips Zhirui E14 Candle) Call command: ['./MyBulb.py', '192.168.1.199', '59772e650b11f69d476ed84f56c92bcf', '--scene', '1'] 2019-02-04 17:18:36.073 Error: (Philips Zhirui E14 Candle) Call command failed: Command '['./MyBulb.py', '192.168.1.199', '59772e650b11f69d476ed84f56c92bcf', '--scene', '1']' returned non-zero exit status 1
command line: pi@odroidxu4:~/domoticz/plugins/domoticz-Xiaomi-Led-Lamp$ ./MyBulb.py 192.168.1.199 59772e650b11f69d476ed84f56c92bcf --power ON --scene 2 --debug Namespace(IPaddress='192.168.1.199', brightemp=None, debug=True, level=None, power='ON', scene=2, temp=None, token='59772e650b11f69d476ed84f56c92bcf')
I think I found a problem, I reinstalled the miio-python library by root user, both lamps e14 and e27 are working excellent, sometimes there is one error in log of Domoticz. Thanks a lot, it's great work!
2019-02-04 18:58:06.787 (Philips Zhirui E14 Candle) delay_off_countdown => 0
2019-02-04 18:58:06.787 (Philips Zhirui E14 Candle) power => off
2019-02-04 18:58:06.787 (Philips Zhirui E14 Candle) scene => 2
2019-02-04 18:58:06.787 (Philips Zhirui E14 Candle) brightness => 80
2019-02-04 18:58:06.787 (Philips Zhirui E14 Candle) color_temperature => 38
2019-02-04 18:58:06.788 (LED E14 Candle - CCCW) Updating device from 0:'80' to have values 0:'80'.
2019-02-04 18:58:06.793 (Philips Zhirui E14 Candle) Update 0: '80' '{"t": 158, "ww": 0, "g": 0, "cw": 0, "r": 0, "m": 2, "b": 0}' (LED E14 Candle - CCCW)
2019-02-04 18:58:06.793 (LED E14 Candle - Scenes) Updating device from 0:'20' to have values 0:'20'.
2019-02-04 18:58:06.797 (Philips Zhirui E14 Candle) Update 0: '20' '{"t": 158, "ww": 0, "g": 0, "cw": 0, "r": 0, "m": 2, "b": 0}' (LED E14 Candle - Scenes)
2019-02-04 18:58:06.797 (Philips Zhirui E14 Candle) Starting device update
2019-02-04 18:58:06.797 (Philips Zhirui E14 Candle) onHeartbeat finished
2019-02-04 18:58:08.732 Error: Python Plugin Manager hardware (2) thread seems to have ended unexpectedly
...
2019-02-04 18:58:17.572 Status: User: Admin initiated a switch command (6/LED E27 Ball - Scenes/Set Level)
2019-02-04 18:58:17.572 (Philips Zhirui E27 Ball) Pushing 'onCommandCallback' on to queue
2019-02-04 18:58:17.574 (Philips Zhirui E27 Ball) Processing 'onCommandCallback' message
2019-02-04 18:58:17.574 (Philips Zhirui E27 Ball) Calling message handler 'onCommand'.
2019-02-04 18:58:17.575 (Philips Zhirui E27 Ball) onCommand called for Unit 1 cmd 'Set Level' Level '40' Color ''
2019-02-04 18:58:17.575 (Philips Zhirui E27 Ball) Call command: ['./MyBulb.py', '192.168.1.70', 'd111ad07a77a02a949e3d730a8f82e4d', '--scene', '4']
2019-02-04 18:58:18.507 (Philips Zhirui E27 Ball)
2019-02-04 18:58:18.507 (Philips Zhirui E27 Ball) onHeartbeat called, fetch True 2019-02-04 18:58:18.507 (Philips Zhirui E27 Ball) sensor_measurement 2019-02-04 18:58:22.735 Error: Python Plugin Manager hardware (2) thread seems to have ended unexpectedly
Oh, I see. Error: Python Plugin Manager hardware (2) thread seems to have ended unexpectedly may means that operation took more than 30 sec. Currently I can only recommend to turn off debug (by switch debug off in hardware settings for both lamps) and monitor log from time to time. Debug trace may slow down operations. So it may help. I own only one lamp of this type so I can't reproduce this error. Will investigate more on heartbeat interval, may be there are some bugs.
After everything worked, I turned off the debug, there are no more errors. I'm happy.
Sorry mate, im lack of time, new baby in home and my personal PC just died. Gonna check it in next week.
Im using your scripts to control xiaomi philips downlight and I setup my enviroment that im shuting down power by phisical switch. This gives error in domoticz log every status refresh time. So log is full of that logs:
2019-01-24 10:25:09.089 Error: (DEVICE_NAME) Unrecognized error: Command '['bash', '-c', './MyBulb.py 192.168.1.11 b812f21927XXXXX']' returned non-zero exit status 1