Python Plugin: Broadlink RM2 V3

Python and python framework
Andree
Posts: 69
Joined: Wednesday 07 June 2017 11:19
Target OS: Windows
Domoticz version:
Contact:

Re: Python Plugin: Broadlink RM2 V3

Post by Andree » Friday 07 July 2017 14:07

I can not believe it.I installed the x64 versions of Python.
The wiki was also specified to use x86.
Shame for me!
Now with Python 3.5.3 x86 I installed everything and the devices appeared.
Tonight I try to configure the various actions, I hope I have no problems anymore.
Thank you Zak and sorry for the trouble

zak45
Posts: 273
Joined: Sunday 22 January 2017 12:37
Target OS: Windows
Domoticz version: V3.8153
Contact:

Re: Python Plugin: Broadlink RM2 V3

Post by zak45 » Friday 07 July 2017 19:25

Andree wrote:I can not believe it.I installed the x64 versions of Python.
The wiki was also specified to use x86.
Shame for me!
Now with Python 3.5.3 x86 I installed everything and the devices appeared.
Tonight I try to configure the various actions, I hope I have no problems anymore.
Thank you Zak and sorry for the trouble
Happy you have it working .. enjoy !

Andree
Posts: 69
Joined: Wednesday 07 June 2017 11:19
Target OS: Windows
Domoticz version:
Contact:

Re: Python Plugin: Broadlink RM2 V3

Post by Andree » Monday 10 July 2017 9:39

Many thanks Zak, it works perfectly with both of my Broadlink RM Mini 3.
Thx for your work!

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

Re: Python Plugin: Broadlink RM2 V3

Post by DrJS » Monday 17 July 2017 16:25

Hi, after some quick diagnostic assistance.

I've got the Broadlink configured (successfully I assume) within my Domoticz. I can use it through the Android bridge, so I know the IP address, MAC address etc. are all correct.

However, within Domoticz, it doesn't appear to work. So I went to the Linux shell and executed the plugin_send.py against some INI files that I know have correct codes, but nothing happens. It doesn't even make the Broadlink orange light come on, yet the IP and MAC are correct.

Anyone know how else I can diagnose this? I've put various print commands within the .py and confirm that the python script is working and with all the right variables. I've downloaded the plugin_send.py again in case it has been updated, but a diff shows no changes. Obviously it's never going to work within Domoticz if I can't run it from the command line, but I'm at a loss why it's not working.

I've tried:

python3 plugin_send.py ini/BroadlinkRM2-7-34.ini
sudo python3 plugin_send.py ini/BroadlinkRM2-7-34.ini

Neither has any effect. This is the last part in getting this plugin to work so I'm really frustrated I'm probably missing something obvious!

Anyone have any thoughts how I can fix/diagnose this?
Thanks so much.

Here are the log lines when I invoke a button press: from the logs, you'd think it was working, but the RM2 never receives it (it doesn't light up, for example...)

2017-07-18 01:18:30.608 User: Admin initiated a switch command (192/BroadlinkRM2 Unit 1 - 7-34 Sort in order Fan On/Speed/On)
2017-07-18 01:18:30.658 (BroadlinkRM2 Lounge) Code Sent....
2017-07-18 01:18:30.658 (BroadlinkRM2 Lounge) Command line : "/home/pi/domoticz/plugins/BroadlinkRM2/plugin_send.py" /home/pi/domoticz/plugins/BroadlinkRM2/ini/BroadlinkRM2-7-34.ini
2017-07-18 01:18:30.658 (BroadlinkRM2 Unit 1 - 7-34 Sort in order Fan On/Speed) Updating device from 1:'On-9' to have values 1:'On-10'.
2017-07-18 01:18:30.673 (BroadlinkRM2 Lounge) Update 1:'On-10' (BroadlinkRM2 Unit 1 - 7-34 Sort in order Fan On/Speed)
2017-07-18 01:18:30.674 (BroadlinkRM2 Lounge) Calling message handler 'onCommand'.
2017-07-18 01:18:30.674 (BroadlinkRM2 Lounge) onCommand called for Unit 34: Parameter 'On', Level: 0 , Connected : True
2017-07-18 01:18:30.674 (BroadlinkRM2 Lounge) Generate on Command for learned code stored on unit :34
2017-07-18 01:18:30.679 (BroadlinkRM2 Lounge) Code loaded : 26009600124113403c173c16124113403c173c17124112403d163c173c1711413d161241134012413c163c173c1712413c17120002da134013403b183c17124013403c173c17124013403c173d163b1811413d161340134012413c173c163c1713403b18120002da134012413c183b17124013403c173c17114212403d163d163b1811423c161241134013403b183b173c1712413b1812000d050000
2017-07-18 01:18:30.740 (BroadlinkRM2 Lounge) Connected to Broadlink device.
2017-07-18 01:18:30.741 (BroadlinkRM2 Lounge) b'&\x00\x96\x00\x12A\[email protected]<\x17<\x16\x12A\[email protected]<\x17<\x17\x12A\[email protected]=\x16<\x17<\x17\x11A=\x16\x12A\[email protected]\x12A<\x16<\x17<\x17\x12A<\x17\x12\x00\x02\xda\[email protected]\[email protected];\x18<\x17\[email protected]\[email protected]<\x17<\x17\[email protected]\[email protected]<\x17=\x16;\x18\x11A=\x16\[email protected]\[email protected]\x12A<\x17<\x16<\x17\[email protected];\x18\x12\x00\x02\xda\[email protected]\x12A<\x18;\x17\[email protected]\[email protected]<\x17<\x17\x11B\[email protected]=\x16=\x16;\x18\x11B<\x16\x12A\[email protected]\[email protected];\x18;\x17<\x17\x12A;\x18\x12\x00\r\x05\x00\x00'
2017-07-18 01:18:31.453 (BroadlinkRM2 Lounge) Code Sent....
2017-07-18 01:18:31.453 (BroadlinkRM2 Lounge) Command line : "/home/pi/domoticz/plugins/BroadlinkRM2/plugin_send.py" /home/pi/domoticz/plugins/BroadlinkRM2/ini/BroadlinkRM2-7-34.ini
2017-07-18 01:18:31.454 (BroadlinkRM2 Unit 1 - 7-34 Sort in order Fan On/Speed) Updating device from 1:'On-10' to have values 1:'On-11'.

User avatar
michaldobrotka
Posts: 55
Joined: Sunday 01 November 2015 18:21
Target OS: Raspberry Pi
Domoticz version: Beta
Contact:

Re: Python Plugin: Broadlink RM2 V3

Post by michaldobrotka » Saturday 22 July 2017 22:45

Hi Guys,
I made new installation of domoticz on Rpi after instant crashing last weeks. For few days I was testing with all my hardware and its now stable. Now Im trying to install the most important thing and Im desperate.
I installed Python 3.4.2. and everything was running as should. Than I installed Broadlink

Code: Select all

sudo pip3 install Crypto
sudo pip3 install broadlink
sudo pip3 install pyaes
sudo cp -r /usr/local/lib/python3.4/dist-packages/Crypto/ /usr/lib/python3.4/
sudo cp -r /usr/local/lib/python3.4/dist-packages/broadlink /usr/lib/python3.4/
and copied files into domoticz/plugins/BroadlinkRM2

Code: Select all

plugin_send.py
plugin_send.cmd
plugin_http.py
plugin_http.cmd
after reboot i cant connect to domoticz via browser at all :roll: :roll: :roll:
When Im runnig domoticz via ssh ./domoticz, it starts to load everything till it comes to Broadlink version 3.0.0 and its over.

I tried everything what I could find on forum but no effect

Code: Select all

cd /home/pi
sudo rm -r /usr/local/lib/python3.4/dist-packages/broadlink*
git clone https://github.com/mjg59/python-broadlink
sudo pip3 install python-broadlink/
sudo cp -r /usr/local/lib/python3.4/dist-packages/broadlink /usr/lib/python3.4/
sudo systemctl restart domoticz.service
As soon I rename plugin.py in domoticz/plugins folder domoticz is running wit error message

Code: Select all

2017-07-22 22:26:00.252 Error: (BroadlinkRM2) failed to load 'plugin.py', Python Path used was ':/usr/lib/python3.4/:/usr/lib/python3.4/plat-arm-linux-gnueabihf:/usr/lib/python3.4/lib-dynload'.
2017-07-22 22:26:00.252 Error: (Broadlink) Module Import failed, exception: 'ImportError'
2017-07-22 22:26:00.252 Error: (Broadlink) Module Import failed: ' Name: plugin'
2017-07-22 22:27:00.501 Error: Broadlink hardware (13) thread seems to have ended unexpectedly


Can someone help me please?
Domoticz on Raspi 3
Serial Mysensors GW on Arduino nano
Broadlink RM2
Rehau CO2 USB Stick
RF link 433 MHz
Amazon Echo Dot + HAbridge

zak45
Posts: 273
Joined: Sunday 22 January 2017 12:37
Target OS: Windows
Domoticz version: V3.8153
Contact:

Re: Python Plugin: Broadlink RM2 V3

Post by zak45 » Sunday 23 July 2017 1:11

@michaldobrotka
you have installed pyaes
do you have also copy it ???
sudo cp -r /usr/local/lib/python3.4/dist-packages/pyaes/ /usr/lib/python3.4/

FYI: you need only Crypto or pyaes, both are not necessary on v3

User avatar
michaldobrotka
Posts: 55
Joined: Sunday 01 November 2015 18:21
Target OS: Raspberry Pi
Domoticz version: Beta
Contact:

Re: Python Plugin: Broadlink RM2 V3

Post by michaldobrotka » Sunday 23 July 2017 8:53

HI @zak45
Thanks for your respond,
I just copied it but no change, after that i uninstalled Crypto but still same error.
Domoticz on Raspi 3
Serial Mysensors GW on Arduino nano
Broadlink RM2
Rehau CO2 USB Stick
RF link 433 MHz
Amazon Echo Dot + HAbridge

User avatar
michaldobrotka
Posts: 55
Joined: Sunday 01 November 2015 18:21
Target OS: Raspberry Pi
Domoticz version: Beta
Contact:

Re: Python Plugin: Broadlink RM2 V3

Post by michaldobrotka » Tuesday 25 July 2017 6:24

Hi @zak45,
Yesterday after I updated to latest beta I tried It again. I was able to run the plugin, even to configure Broadlink device, and I added one remote command for test. I restarted device and no error occurred. I went to bed. This morning I checked Domoticz and it was down again. It lasted not even one hour running. :(
Domoticz on Raspi 3
Serial Mysensors GW on Arduino nano
Broadlink RM2
Rehau CO2 USB Stick
RF link 433 MHz
Amazon Echo Dot + HAbridge

Paint
Posts: 9
Joined: Tuesday 11 July 2017 15:47
Target OS: -
Domoticz version:
Contact:

Re: Python Plugin: Broadlink RM2 V3

Post by Paint » Tuesday 25 July 2017 9:42

I couldn't get this to work on my rpi - i am currently trying to see if python 3.6.2 compiled from source will help.

While waiting forever for it to compile, I moved my Domoticz installation to a different machine (24c xeon running Ubuntu 16.04 lts) and it is working perfectly. Thank you so much, @zak45

I basically used your import functionality and learn mode to map my AC remote in excel and then wrote a quick vba script to create the ini files. I tested them in the CLI and it worked.

Last step is to write the lua to combine the AC Setpoint value with a selector switch (e.g. Off, ac fan low, ac fan high, fan only med) to trigger the right IR command.

Is there anyway to so multiple IR commands in one INI file?

Sent from my SM-G955U using Tapatalk

jackslayter
Posts: 222
Joined: Tuesday 07 October 2014 11:00
Target OS: Raspberry Pi
Domoticz version: LastBeta
Location: France RA
Contact:

Re: Python Plugin: Broadlink RM2 V3

Post by jackslayter » Wednesday 26 July 2017 8:48

Hi,
I have a problem with plugin_send.py in standalone

Code: Select all

Traceback (most recent call last):
  File "domoticz/plugins/Broadlink/plugin_send.py", line 15, in <module>
    import configparser
ImportError: No module named configparser

Code: Select all

pip install configparser
Requirement already satisfied: configparser in /usr/local/lib/python3.4/dist-packages
thank you
RPi2 + RFLink, Domoticz
Chacon - micromodule 200w, remote 3b, 2x module 1000w, remote 16b, smoke detector, door contact, 2x 3500w plug
Oregon - 3x Thgr122Nx / OWL - CM180 / TRC02_2 RGB / Cheap - PiR, door contact, Temp Hum / 4x REVOLT NC5461

Paint
Posts: 9
Joined: Tuesday 11 July 2017 15:47
Target OS: -
Domoticz version:
Contact:

Re: Python Plugin: Broadlink RM2 V3

Post by Paint » Wednesday 26 July 2017 14:56

jackslayter wrote:Hi,
I have a problem with plugin_send.py in standalone

Code: Select all

Traceback (most recent call last):
  File "domoticz/plugins/Broadlink/plugin_send.py", line 15, in <module>
    import configparser
ImportError: No module named configparser

Code: Select all

pip install configparser
Requirement already satisfied: configparser in /usr/local/lib/python3.4/dist-packages
thank you

can you try the command below?

Code: Select all

pip3 install configparser

User avatar
michaldobrotka
Posts: 55
Joined: Sunday 01 November 2015 18:21
Target OS: Raspberry Pi
Domoticz version: Beta
Contact:

Re: Python Plugin: Broadlink RM2 V3

Post by michaldobrotka » Wednesday 26 July 2017 14:59

Yesterday I uninstalled broadlink and pyaes and installed all new.
Added Broadlink in hardware an recorded some commands. Everything was working just fine, no errors, no delays, no cpu increase until I restarted domoticz. Then again no connection to system via browser.
Is someone who installed broadlink recently on raspi got it working on python 3.4.2?
Thanks
Domoticz on Raspi 3
Serial Mysensors GW on Arduino nano
Broadlink RM2
Rehau CO2 USB Stick
RF link 433 MHz
Amazon Echo Dot + HAbridge

jackslayter
Posts: 222
Joined: Tuesday 07 October 2014 11:00
Target OS: Raspberry Pi
Domoticz version: LastBeta
Location: France RA
Contact:

Re: Python Plugin: Broadlink RM2 V3

Post by jackslayter » Wednesday 26 July 2017 15:33

Paint wrote:
jackslayter wrote:Hi,
I have a problem with plugin_send.py in standalone

Code: Select all

Traceback (most recent call last):
  File "domoticz/plugins/Broadlink/plugin_send.py", line 15, in <module>
    import configparser
ImportError: No module named configparser

Code: Select all

pip install configparser
Requirement already satisfied: configparser in /usr/local/lib/python3.4/dist-packages
thank you

can you try the command below?

Code: Select all

pip3 install configparser
yes at first
RPi2 + RFLink, Domoticz
Chacon - micromodule 200w, remote 3b, 2x module 1000w, remote 16b, smoke detector, door contact, 2x 3500w plug
Oregon - 3x Thgr122Nx / OWL - CM180 / TRC02_2 RGB / Cheap - PiR, door contact, Temp Hum / 4x REVOLT NC5461

Paint
Posts: 9
Joined: Tuesday 11 July 2017 15:47
Target OS: -
Domoticz version:
Contact:

Re: Python Plugin: Broadlink RM2 V3

Post by Paint » Wednesday 26 July 2017 15:50

michaldobrotka wrote:Yesterday I uninstalled broadlink and pyaes and installed all new.
Added Broadlink in hardware an recorded some commands. Everything was working just fine, no errors, no delays, no cpu increase until I restarted domoticz. Then again no connection to system via browser.
Is someone who installed broadlink recently on raspi got it working on python 3.4.2?
Thanks
try using it on V3.5 or greater of Python. For RPI, you will need to manually compile it.

You can also try making the following change to the plugin.py, as per the wiki:
developer info
this code : learnedCommand=str(ir_packet.hex()) is pecific to python 3.5 or >, not work on 3.4

replaced by : learnedCommand=str(codecs.encode(ir_packet, 'hex_codec')) ( & import codecs ) to have it running in 3.x

jackslayter
Posts: 222
Joined: Tuesday 07 October 2014 11:00
Target OS: Raspberry Pi
Domoticz version: LastBeta
Location: France RA
Contact:

Re: Python Plugin: Broadlink RM2 V3

Post by jackslayter » Thursday 27 July 2017 10:45

Hi,
it's possible to learn code in standalone, like send ?
thx
RPi2 + RFLink, Domoticz
Chacon - micromodule 200w, remote 3b, 2x module 1000w, remote 16b, smoke detector, door contact, 2x 3500w plug
Oregon - 3x Thgr122Nx / OWL - CM180 / TRC02_2 RGB / Cheap - PiR, door contact, Temp Hum / 4x REVOLT NC5461

Paint
Posts: 9
Joined: Tuesday 11 July 2017 15:47
Target OS: -
Domoticz version:
Contact:

Re: Python Plugin: Broadlink RM2 V3

Post by Paint » Thursday 27 July 2017 11:52

At the moment, all learning has to be done via the broadlink import process or via the widget the plugin creates

Sent from my SM-G955U using Tapatalk

petzno
Posts: 24
Joined: Monday 19 October 2015 9:21
Target OS: Linux
Domoticz version:
Contact:

Re: Python Plugin: Broadlink RM2 V3

Post by petzno » Saturday 29 July 2017 11:50

My domoticz is crashing and going to offline several times a day after ensbling this plugin. This is the last message in the log before it happens:

2017-07-29 11:10:17.238 Error: (Broadlink) Error getting temperature data from Broadlink device....Timeout

Paint
Posts: 9
Joined: Tuesday 11 July 2017 15:47
Target OS: -
Domoticz version:
Contact:

Re: Python Plugin: Broadlink RM2 V3

Post by Paint » Saturday 29 July 2017 18:29

petzno wrote:My domoticz is crashing and going to offline several times a day after ensbling this plugin. This is the last message in the log before it happens:

2017-07-29 11:10:17.238 Error: (Broadlink) Error getting temperature data from Broadlink device....Timeout
Disable the temp sensor on the hardware page in domoticz.

Sent from my SM-G955U using Tapatalk

petzno
Posts: 24
Joined: Monday 19 October 2015 9:21
Target OS: Linux
Domoticz version:
Contact:

Re: Python Plugin: Broadlink RM2 V3

Post by petzno » Saturday 29 July 2017 20:33

Paint wrote:Disable the temp sensor on the hardware page in domoticz.

Sent from my SM-G955U using Tapatalk
Actually the temp sensor was the main reason I added the plugin, to get the indoor temp.

Paint
Posts: 9
Joined: Tuesday 11 July 2017 15:47
Target OS: -
Domoticz version:
Contact:

Re: Python Plugin: Broadlink RM2 V3

Post by Paint » Saturday 29 July 2017 21:34

petzno wrote:
Paint wrote:Disable the temp sensor on the hardware page in domoticz.

Sent from my SM-G955U using Tapatalk
Actually the temp sensor was the main reason I added the plugin, to get the indoor temp.
From my experience, the rm pro temp sensor is the only one that is accurate...and it's not that accurate.

Sent from my SM-G955U using Tapatalk

Post Reply

Who is online

Users browsing this forum: Bompie00 and 2 guests