Python Broadlink RM2/Pro broken

Python and python framework

Moderator: leecollings

Post Reply
DrJS
Posts: 7
Joined: Saturday 29 April 2017 15:00
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.587
Contact:

Python Broadlink RM2/Pro broken

Post by DrJS »

Hi, I was asked to open a new thread for this, as I appear not to be the only one who's experienced this.

After much fannying around with loading 0.3 up manually (0.4 is still unfortunately broken, which is such a shame) I HAVE managed to get the plug in present within Domoticz. However, it only half loads the configuration screen. Domoticz appears to be otherwise working. Here is my log:

2017-05-02 16:43:32.808 Domoticz V3.7403 (c)2012-2017 GizMoCuz
2017-05-02 16:43:32.808 Build Hash: 78af35c, Date: 2017-04-30 16:33:55
2017-05-02 16:43:32.808 Startup Path: /home/pi/domoticz/
2017-05-02 16:43:34.032 Sunrise: 05:28:00 SunSet:20:20:00
2017-05-02 16:43:34.032 EventSystem: reset all events...
2017-05-02 16:43:34.163 PluginSystem: Started, Python version '3.5.3'.
2017-05-02 16:43:34.171 Active notification Subsystems: email, gcm, pushover (3/12)
2017-05-02 16:43:34.172 WebServer(HTTP) started on address: :: with port 8080
2017-05-02 16:43:34.178 WebServer(SSL) started on address: :: with port 443
2017-05-02 16:43:34.180 Proxymanager started.
2017-05-02 16:43:34.181 Starting shared server on: :::6144
2017-05-02 16:43:34.181 TCPServer: shared server started...
2017-05-02 16:43:34.181 RxQueue: queue worker started...
2017-05-02 16:43:36.182 Nest: Worker started...
2017-05-02 16:43:36.182 EventSystem: reset all events...
2017-05-02 16:43:36.183 EventSystem: reset all device statuses...
2017-05-02 16:43:36.184 EventSystem: Started
2017-05-02 16:43:36.534 PluginSystem: Entering work loop.
2017-05-02 16:43:38.186 Fritzbox: connected to: fritz.box:1012

You can see that Python plug-in is loaded (I upgraded to 3.5.3), and also to the latest Beta of Domoticz, so I'm now at a loss as to what's going wrong with it only "half working" - by that, I mean I can't configure it, as per the dialogue box below:
domoticz problem.png
domoticz problem.png (119.29 KiB) Viewed 983 times
Does anyone have any idea what I can do to get this working properly...? As you can see from the box, my Domoticz build is 3.7403 and I'm running this on a Pi if that's relevant. I've tried renaming the plugin subfolder from "BroadlinkRM2" to "broadlinkRM2" as I've seen it used interchangeably with and without the initial capital letter - it doesn't seem to make any difference.

Here's the initial part of plugin.py in the plugins/broadlinkRM2 folder: it DOES seem to have the necessary parts that would (or should!) be creating the dialogue box to enter the IP address etc. But as you can see in the screen shot above, they're just not happening... :roll:

# Broadlink RM2 Python Plugin for Domoticz
#
# Dev. Platform : Win10 x64 & Py 3.5.3 x86
#
# Author: zak45, 2017
# 1.1.0: code compatible py 3.x
# 2.0.0: import from e-Control or any other ini file with similar structure
# webserver for file transfer
# Off action managed for generated devices
# clean action to erase files from import folder

# Below is what will be displayed in Domoticz GUI under HW
#
"""
<plugin key="BroadlinkRM2" name="Broadlink RM2" author="zak45" version="2.0.0" wikilink="http://www.domoticz.com/wiki/plugins/BroadlinkRM2.html" externallink="https://github.com/mjg59/python-broadlink">
<params>
<param field="Address" label="IP Address" width="200px" required="true" default="127.0.0.1"/>
<param field="Mode1" label="Mac" width="100px" required="true" default="000000000000"/>
<param field="Mode2" label="Folder to store ini files" width="300px" required="true" default="C:/BroadlinkRM2"/>
<param field="Mode3" label="Get Temperature Device" width="75px">
<options>
<option label= "False" value="no"/>
<option label= "True" value="yes" default="True"/>
</options>


Thanks so much
Jeremy
DrJS
Posts: 7
Joined: Saturday 29 April 2017 15:00
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.587
Contact:

Re: Python Broadlink RM2/Pro broken

Post by DrJS »

Right, I ended up rebuilding the system from scratch and I've got the plug in present and correct.

Getting a few errors in the log though, that I'd appreciate some help with?

2017-05-03 18:18:18.910 User: Admin initiated a switch command (1/Broadlink RM2-1 - Command/Set Level)
2017-05-03 18:18:18.948 (Broadlink RM2-1) Calling message handler 'onCommand'.
2017-05-03 18:18:18.948 (Broadlink RM2-1) onCommand called for Unit 1: Parameter 'Set Level', Level: 10 , Connected : False
2017-05-03 18:18:18.948 Error: (Broadlink RM2-1) Error Connecting to Broadlink device....
2017-05-03 18:18:18.948 (Broadlink RM2-1) All plugin system is on pause for 5s...
2017-05-03 18:18:18.948 (Broadlink RM2-1) When Broadlink led is lit press the button on your remote within 5 seconds
2017-05-03 18:18:18.948 Error: (Broadlink RM2-1) 'onCommand' failed 'NameError':'name 'device' is not defined'.
2017-05-03 18:18:18.948 Error: (Broadlink RM2-1) ----> Line 150 in /home/pi/domoticz/plugins/broadlinkRM2/plugin.py, function onCommand
2017-05-03 18:18:18.948 Error: (Broadlink RM2-1) ----> Line 408 in /home/pi/domoticz/plugins/broadlinkRM2/plugin.py, function learn
2017-05-03 18:18:23.756 (Broadlink RM2-1) Calling message handler 'onHeartbeat'.
2017-05-03 18:18:23.756 Error: (Broadlink RM2-1) Error Connecting to Broadlink device....
2017-05-03 18:18:25.738 New sensors allowed for 5 minutes...
2017-05-03 18:18:34.113 New sensors allowed for 5 minutes...
2017-05-03 18:18:45.153 User: Admin initiated a switch command (1/Broadlink RM2-1 - Command/Set Level)
2017-05-03 18:18:45.191 (Broadlink RM2-1) Calling message handler 'onCommand'.
2017-05-03 18:18:45.191 (Broadlink RM2-1) onCommand called for Unit 1: Parameter 'Set Level', Level: 10 , Connected : False
2017-05-03 18:18:45.191 Error: (Broadlink RM2-1) Error Connecting to Broadlink device....
2017-05-03 18:18:45.191 (Broadlink RM2-1) All plugin system is on pause for 5s...
2017-05-03 18:18:45.191 (Broadlink RM2-1) When Broadlink led is lit press the button on your remote within 5 seconds
2017-05-03 18:18:45.192 Error: (Broadlink RM2-1) 'onCommand' failed 'NameError':'name 'device' is not defined'.
2017-05-03 18:18:45.192 Error: (Broadlink RM2-1) ----> Line 150 in /home/pi/domoticz/plugins/broadlinkRM2/plugin.py, function onCommand
2017-05-03 18:18:45.192 Error: (Broadlink RM2-1) ----> Line 408 in /home/pi/domoticz/plugins/broadlinkRM2/plugin.py, function learn
2017-05-03 18:18:53.358 User: Admin initiated a switch command (1/Broadlink RM2-1 - Command/Set Level)
2017-05-03 18:18:53.407 (Broadlink RM2-1) Calling message handler 'onCommand'.
2017-05-03 18:18:53.407 (Broadlink RM2-1) onCommand called for Unit 1: Parameter 'Set Level', Level: 20 , Connected : False
2017-05-03 18:18:53.407 (Broadlink RM2-1) Nothing to send
2017-05-03 18:18:53.758 (Broadlink RM2-1) Calling message handler 'onHeartbeat'.
2017-05-03 18:18:56.775 User: Admin initiated a switch command (1/Broadlink RM2-1 - Command/Set Level)
2017-05-03 18:18:56.813 (Broadlink RM2-1) Calling message handler 'onCommand'.
2017-05-03 18:18:56.813 (Broadlink RM2-1) onCommand called for Unit 1: Parameter 'Set Level', Level: 20 , Connected : False
2017-05-03 18:18:56.813 (Broadlink RM2-1) Nothing to send
2017-05-03 18:19:23.757 (Broadlink RM2-1) Calling message handler 'onHeartbeat'.

Incidentally these are the steps I went through to build the system after loading up the image.

1. Build the system and install Domoticz by sudo curl -L install.domoticz.com | bash
2. sudo apt-get install python3-pip libglib2.0-dev
3. updatebeta
4. sudo apt-get install ftp (to access my NAS which is where I've stored the Broadlink plugin downloaded from Dropbox)
5. sudo apt-get install python-yaml
6. sudo apt-get install libyaml-dev
7. sudo pip3 install Crypto

NO - this broke Pip3 (libyaml-dev)
Needed:
sudo apt-get remove python3-pip
sudo apt-get install python3-setuptools
sudo easy_install3 pip
sudo apt-get python3-pip

8. sudo apt-get install dos2unix (to make sure the py files are in the right format)
9. dos2unix on all files & chmod 755 all files
10. sudo pip3 install . (in the domoticz/plugins/broadlinkRM2 folder)
11. sudo cp -r /usr/local/lib/python3.4/dist-packages/Crypto/ /usr/lib/python3.4/
12. sudo cp -r /usr/local/lib/python3.4/dist-packages/broadlink /usr/lib/python3.4/
13. sudo service domoticz restart

Done.
zak45
Posts: 953
Joined: Sunday 22 January 2017 11:37
Target OS: Windows
Domoticz version: V2024.4
Contact:

Re: Python Broadlink RM2/Pro broken

Post by zak45 »

Fine you have it running.

Error Connecting to Broadlink device....

this mean do not able to see/find the device on the network..

Do yo have put right settings on the configuration page ?
Post Reply

Who is online

Users browsing this forum: domja and 1 guest