Using BROADLINK RM2 on DOMOTICZ

Others (MiLight, Hue, Toon etc...)

Moderator: leecollings

Post Reply
User avatar
l0gic
Posts: 107
Joined: Tuesday 08 October 2013 9:35
Target OS: Linux
Domoticz version: Latest
Contact:

Re: Using BROADLINK RM2 on DOMOTICZ

Post by l0gic »

Hi Guys,
I think I may have an issue with the installation of the Broadlink code.

When running the learn.py I hit the following issue

Code: Select all

Traceback (most recent call last):
  File "./learn.py", line 19, in <module>
    device.enter_learning()
AttributeError: device instance has no attribute 'enter_learning'
I get a similar issue with the playcode.py

Code: Select all

Traceback (most recent call last):
  File "./playcode.py", line 30, in <module>
    device.send_data(myhex.decode('hex'))
AttributeError: device instance has no attribute 'send_data'
As I'm having issues with both scripts I'm assuming the issue is with the installation of the broadlink code.
I installed the code using the setup.py install and it seemed to complete without issue.

Any ideas anyone?

Cheers

Kevin
Non credus crepitus
tezzlicious
Posts: 39
Joined: Saturday 09 April 2016 13:47
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Contact:

Re: Using BROADLINK RM2 on DOMOTICZ

Post by tezzlicious »

l0gic wrote:Hi Guys,
I think I may have an issue with the installation of the Broadlink code.

When running the learn.py I hit the following issue

Code: Select all

Traceback (most recent call last):
  File "./learn.py", line 19, in <module>
    device.enter_learning()
AttributeError: device instance has no attribute 'enter_learning'
I get a similar issue with the playcode.py

Code: Select all

Traceback (most recent call last):
  File "./playcode.py", line 30, in <module>
    device.send_data(myhex.decode('hex'))
AttributeError: device instance has no attribute 'send_data'
As I'm having issues with both scripts I'm assuming the issue is with the installation of the broadlink code.
I installed the code using the setup.py install and it seemed to complete without issue.

Any ideas anyone?

Cheers

Kevin
replace
device = broadlink.device(host=("<your RM3 IP address>",80), mac=bytearray.fromhex("<your RM3 mac>"))
with
device = broadlink.rm(host=("<your RM3 IP address>",80), mac=bytearray.fromhex("<your RM3 mac>"))
User avatar
l0gic
Posts: 107
Joined: Tuesday 08 October 2013 9:35
Target OS: Linux
Domoticz version: Latest
Contact:

Re: Using BROADLINK RM2 on DOMOTICZ

Post by l0gic »

tezzlicious wrote:
replace
device = broadlink.device(host=("<your RM3 IP address>",80), mac=bytearray.fromhex("<your RM3 mac>"))
with
device = broadlink.rm(host=("<your RM3 IP address>",80), mac=bytearray.fromhex("<your RM3 mac>"))
Nice one, working well now!

Many thanks

Kevin
Non credus crepitus
tuspam
Posts: 37
Joined: Friday 25 December 2015 0:19
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Contact:

Re: Using BROADLINK RM2 on DOMOTICZ

Post by tuspam »

Last edited by tuspam on Monday 28 November 2016 21:53, edited 4 times in total.
tuspam
Posts: 37
Joined: Friday 25 December 2015 0:19
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Contact:

Re: Using BROADLINK RM2 on DOMOTICZ

Post by tuspam »

tezzlicious wrote: replace
device = broadlink.device(host=("<your RM3 IP address>",80), mac=bytearray.fromhex("<your RM3 mac>"))
with
device = broadlink.rm(host=("<your RM3 IP address>",80), mac=bytearray.fromhex("<your RM3 mac>"))

Code: Select all

root@raspberrypi:/home/pi/domoticz/scripts/python# python -V
Python 2.7.3
root@raspberrypi:/home/pi/domoticz/scripts/python# python learn.py
Traceback (most recent call last):
  File "learn.py", line 7, in <module>
    device = broadlink.rm(host=("<your RM3 IP address>",80), mac=bytearray.fromhex("<your RM3 mac>"))
ValueError: non-hexadecimal number found in fromhex() arg at position 0
root@raspberrypi:/home/pi/domoticz/scripts/python#

Any instruction noobs frendly how to install and use for python-broadlink?

Thanks a lot.
User avatar
l0gic
Posts: 107
Joined: Tuesday 08 October 2013 9:35
Target OS: Linux
Domoticz version: Latest
Contact:

Re: Using BROADLINK RM2 on DOMOTICZ

Post by l0gic »

Hi,
Grab the code from github and drop it in a directory on the Pi, I put it in the domoticz area.
There is a file called setup.py, run it as follows "python setup.py install" (no "").
You may find it fails as some dependencies are not available, it did for me.
If so a quick google will set you right, install the required dependencies.
Once the setup.py file runs without error you have installed the code.

HTH

Kevin
Non credus crepitus
tuspam
Posts: 37
Joined: Friday 25 December 2015 0:19
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Contact:

Re: Using BROADLINK RM2 on DOMOTICZ

Post by tuspam »

l0gic wrote:Hi,
Grab the code from github and drop it in a directory on the Pi, I put it in the domoticz area.
There is a file called setup.py, run it as follows "python setup.py install" (no "").
You may find it fails as some dependencies are not available, it did for me.
If so a quick google will set you right, install the required dependencies.
Once the setup.py file runs without error you have installed the code.

HTH

Kevin
I did it before

Code: Select all

root@raspberrypi:/home/pi/domoticz/scripts# python setup.py install
running install
running bdist_egg
running egg_info
creating broadlink.egg-info
writing broadlink.egg-info/PKG-INFO
writing top-level names to broadlink.egg-info/top_level.txt
writing dependency_links to broadlink.egg-info/dependency_links.txt
writing broadlink.egg-info/PKG-INFO
writing top-level names to broadlink.egg-info/top_level.txt
writing dependency_links to broadlink.egg-info/dependency_links.txt
writing manifest file 'broadlink.egg-info/SOURCES.txt'
reading manifest file 'broadlink.egg-info/SOURCES.txt'
writing manifest file 'broadlink.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-armv7l/egg
running install_lib
running build_py
creating build
creating build/lib.linux-armv7l-2.7
creating build/lib.linux-armv7l-2.7/broadlink
copying broadlink/__init__.py -> build/lib.linux-armv7l-2.7/broadlink
creating build/bdist.linux-armv7l
creating build/bdist.linux-armv7l/egg
creating build/bdist.linux-armv7l/egg/broadlink
copying build/lib.linux-armv7l-2.7/broadlink/__init__.py -> build/bdist.linux-armv7l/egg/broadlink
byte-compiling build/bdist.linux-armv7l/egg/broadlink/__init__.py to __init__.pyc
creating build/bdist.linux-armv7l/egg/EGG-INFO
copying broadlink.egg-info/PKG-INFO -> build/bdist.linux-armv7l/egg/EGG-INFO
copying broadlink.egg-info/SOURCES.txt -> build/bdist.linux-armv7l/egg/EGG-INFO
copying broadlink.egg-info/dependency_links.txt -> build/bdist.linux-armv7l/egg/EGG-INFO
copying broadlink.egg-info/not-zip-safe -> build/bdist.linux-armv7l/egg/EGG-INFO
copying broadlink.egg-info/top_level.txt -> build/bdist.linux-armv7l/egg/EGG-INFO
creating dist
creating 'dist/broadlink-0.1-py2.7.egg' and adding 'build/bdist.linux-armv7l/egg' to it
removing 'build/bdist.linux-armv7l/egg' (and everything under it)
Processing broadlink-0.1-py2.7.egg
removing '/usr/local/lib/python2.7/dist-packages/broadlink-0.1-py2.7.egg' (and everything under it)
creating /usr/local/lib/python2.7/dist-packages/broadlink-0.1-py2.7.egg
Extracting broadlink-0.1-py2.7.egg to /usr/local/lib/python2.7/dist-packages
broadlink 0.1 is already the active version in easy-install.pth

Installed /usr/local/lib/python2.7/dist-packages/broadlink-0.1-py2.7.egg
Processing dependencies for broadlink==0.1
Finished processing dependencies for broadlink==0.1
root@raspberrypi:/home/pi/domoticz/scripts#

Code: Select all

root@raspberrypi:/home/pi/domoticz/scripts/python# python learn.py
Traceback (most recent call last):
  File "learn.py", line 7, in <module>
    device = broadlink.rm(host=("<your RM3 IP address>",80), mac=bytearray.fromhex("<your RM3 mac>"))
ValueError: non-hexadecimal number found in fromhex() arg at position 0
root@raspberrypi:/home/pi/domoticz/scripts/python#
Dependency file is empty
/usr/local/lib/python2.7/dist-packages/broadlink-0.1-py2.7.egg/EGG-INFO/dependency_links.txt
User avatar
l0gic
Posts: 107
Joined: Tuesday 08 October 2013 9:35
Target OS: Linux
Domoticz version: Latest
Contact:

Re: Using BROADLINK RM2 on DOMOTICZ

Post by l0gic »

Hi,
your broadlink looks like it has installed fine.

I'm guessing your issue is
device = broadlink.rm(host=("<your RM3 IP address>",80), mac=bytearray.fromhex("<your RM3 mac>"))

You need to replace <your RM3 IP address> with the IP address of the broadlink unit and the same with the mac for <your RM3 mac>.
For the mac, remove the : e.g. aa:bb:cc:dd:ee:ff becomes aabbccddeeff

HTH Kevin
Non credus crepitus
tuspam
Posts: 37
Joined: Friday 25 December 2015 0:19
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Contact:

Re: Using BROADLINK RM2 on DOMOTICZ

Post by tuspam »

l0gic wrote:Hi,
your broadlink looks like it has installed fine.

I'm guessing your issue is
device = broadlink.rm(host=("<your RM3 IP address>",80), mac=bytearray.fromhex("<your RM3 mac>"))

You need to replace <your RM3 IP address> with the IP address of the broadlink unit and the same with the mac for <your RM3 mac>.
For the mac, remove the : e.g. aa:bb:cc:dd:ee:ff becomes aabbccddeeff

HTH Kevin
Thx Kevin

Too many choices - any details how exactly?

device = broadlink.rm(host=("<192.168.1.110>",80), mac=bytearray.fromhex("<aabbccddeeff>"))

device = broadlink.rm(host=("192.168.1.110",80), mac=bytearray.fromhex("aabbccddeeff"))

device = broadlink.rm(host=(192.168.1.110,80), mac=bytearray.fromhex(aabbccddeeff))

device = broadlink.rm(host=(192.168.001.110,80), mac=bytearray.fromhex("<aabbccddeeff>"))

etc.

Code: Select all

root@raspberrypi:/home/pi/domoticz/scripts/python# python learn.py
  File "learn.py", line 7
    device = broadlink.rm(host=(192.168.1.110,80), mac=bytearray.fromhex(B4430DEEE880))
                                        ^
SyntaxError: invalid syntax
root@raspberrypi:/home/pi/domoticz/scripts/python#

Code: Select all

root@raspberrypi:/home/pi/domoticz/scripts/python# python learn.py
Traceback (most recent call last):
  File "learn.py", line 7, in <module>
    device = broadlink.rm(host=(192168001110,80), mac=bytearray.fromhex(b4430deee880))
NameError: name 'b4430deee880' is not defined
root@raspberrypi:/home/pi/domoticz/scripts/python#
User avatar
l0gic
Posts: 107
Joined: Tuesday 08 October 2013 9:35
Target OS: Linux
Domoticz version: Latest
Contact:

Re: Using BROADLINK RM2 on DOMOTICZ

Post by l0gic »

Hi,

device = broadlink.rm(host=("192.168.1.110",80), mac=bytearray.fromhex("B4430DEEE880"))

should do it for you, I've not got access to my Pi ATM so I can't check.

ATB

Kevin

Edit;
just checked and assuming your IP and MAC are correct then the syntax is good to go.
Non credus crepitus
tuspam
Posts: 37
Joined: Friday 25 December 2015 0:19
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Contact:

Re: Using BROADLINK RM2 on DOMOTICZ

Post by tuspam »

l0gic wrote:Hi,

device = broadlink.rm(host=("192.168.1.110",80), mac=bytearray.fromhex("B4430DEEE880"))

should do it for you, I've not got access to my Pi ATM so I can't check.

....

Bingo - thanks a lot

Edit:
Everything works like a charm with RM2 and RM mini (without android device).
I got about 2 sec delay between click dummy switch on domoticz to RM action. Now i can control Broadlink via HA bridge using google home and amazon dot.

Thanks again.
noddy119
Posts: 12
Joined: Sunday 19 July 2015 14:27
Target OS: Linux
Domoticz version: 3.5837
Location: Norfolk, UK
Contact:

Re: Using BROADLINK RM2 on DOMOTICZ

Post by noddy119 »

Everything works like a charm with RM2 and RM mini (without android device).
I got about 2 sec delay between click dummy switch on domoticz to RM action. Now i can control Broadlink via HA bridge using google home and amazon do
Did you comment out (insert an # at the beginning of the line) the 'time.sleep' lines in playcode.py ?

Without these lines (for test purposes) the script runs quicker.... :P
tuspam
Posts: 37
Joined: Friday 25 December 2015 0:19
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Contact:

Re: Using BROADLINK RM2 on DOMOTICZ

Post by tuspam »

noddy119 wrote:
Did you comment out (insert an # at the beginning of the line) the 'time.sleep' lines in playcode.py ?

Without these lines (for test purposes) the script runs quicker.... :P
About 1 sec delay - awesome
korniza
Posts: 157
Joined: Thursday 27 August 2015 18:12
Target OS: Raspberry Pi / ODroid
Domoticz version: V3.6028
Location: Greece
Contact:

Re: Using BROADLINK RM2 on DOMOTICZ

Post by korniza »

I bought broadlink black bean.
Searching on web I found this https://github.com/davorf/BlackBeanControl
Does anyone is using any API for this device?
>>>> Google Home <<<<<
SBC: Odroid XU4 * Raspberry Pi2 * banana Pi v1
Peripherals: rfxtrx433E, aeon z-stick gen5, bluetooth dongles
Extended Software packages: Xeoma (video NVR), FHEM (extra home automation software)
Justintime
Posts: 228
Joined: Thursday 21 May 2015 9:08
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Contact:

Re: RE: Re: Using BROADLINK RM2 on DOMOTICZ

Post by Justintime »

tuspam wrote:
l0gic wrote:Hi,

device = broadlink.rm(host=("192.168.1.110",80), mac=bytearray.fromhex("B4430DEEE880"))

should do it for you, I've not got access to my Pi ATM so I can't check.

....

Bingo - thanks a lot

Edit:
Everything works like a charm with RM2 and RM mini (without android device).
I got about 2 sec delay between click dummy switch on domoticz to RM action. Now i can control Broadlink via HA bridge using google home and amazon dot.

Thanks again.
Just to be clear? The black bean works without interference of an Android device? Or only in combination with the RM2

So who is going to write a wiki? Because the information is not clear how to handle all this.
tuspam
Posts: 37
Joined: Friday 25 December 2015 0:19
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Contact:

Re: RE: Re: Using BROADLINK RM2 on DOMOTICZ

Post by tuspam »

Justintime wrote:
tuspam wrote:
l0gic wrote:Hi,

device = broadlink.rm(host=("192.168.1.110",80), mac=bytearray.fromhex("B4430DEEE880"))

should do it for you, I've not got access to my Pi ATM so I can't check.

....

Bingo - thanks a lot

Edit:
Everything works like a charm with RM2 and RM mini (without android device).
I got about 2 sec delay between click dummy switch on domoticz to RM action. Now i can control Broadlink via HA bridge using google home and amazon dot.

Thanks again.
Just to be clear? The black bean works without interference of an Android device? Or only in combination with the RM2

So who is going to write a wiki? Because the information is not clear how to handle all this.

Yes RM2 and RM mini (black bean) working without android device. I got 2 of them in different rooms.
Ps
In raspberry pi i have installed domoticz, ha-bridge, and python-broadlink - i can control all my devices via voice (Google Home in one room and Alexa in another)
Justintime
Posts: 228
Joined: Thursday 21 May 2015 9:08
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Contact:

Re: RE: Re: RE: Re: Using BROADLINK RM2 on DOMOTICZ

Post by Justintime »

tuspam wrote:
Justintime wrote:
tuspam wrote:

Bingo - thanks a lot

Edit:
Everything works like a charm with RM2 and RM mini (without android device).
I got about 2 sec delay between click dummy switch on domoticz to RM action. Now i can control Broadlink via HA bridge using google home and amazon dot.

Thanks again.
Just to be clear? The black bean works without interference of an Android device? Or only in combination with the RM2

So who is going to write a wiki? Because the information is not clear how to handle all this.

Yes RM2 and RM mini (black bean) working without android device. I got 2 of them in different rooms.
Ps
In raspberry pi i have installed domoticz, ha-bridge, and python-broadlink - i can control all my devices via voice (Google Home in one room and Alexa in another)
Thanks... Cool that it works with Alexa etc.
But i am still looking for the Holy grail on IR support in Domoticz.
With one device independent from an Android device.
tuspam
Posts: 37
Joined: Friday 25 December 2015 0:19
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Contact:

Re: RE: Re: RE: Re: Using BROADLINK RM2 on DOMOTICZ

Post by tuspam »

Justintime wrote:......
Thanks... Cool that it works with Alexa etc.
But i am still looking for the Holy grail on IR support in Domoticz.
With one device independent from an Android device.
So, You find one.
Justintime
Posts: 228
Joined: Thursday 21 May 2015 9:08
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Contact:

Re: RE: Re: RE: Re: RE: Re: Using BROADLINK RM2 on DOMOTICZ

Post by Justintime »

tuspam wrote:
Justintime wrote:......
Thanks... Cool that it works with Alexa etc.
But i am still looking for the Holy grail on IR support in Domoticz.
With one device independent from an Android device.
So, You find one.
So i just need a rm2 than?
tuspam
Posts: 37
Joined: Friday 25 December 2015 0:19
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Contact:

Re: RE: Re: RE: Re: RE: Re: Using BROADLINK RM2 on DOMOTICZ

Post by tuspam »

Justintime wrote:
tuspam wrote:
Justintime wrote:......
Thanks... Cool that it works with Alexa etc.
But i am still looking for the Holy grail on IR support in Domoticz.
With one device independent from an Android device.
So, You find one.
So i just need a rm2 than?
YES rm2 or black bean.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest