Python Plugin : Broadlink

Python and python framework

Moderator: leecollings

DrMacabre
Posts: 71
Joined: Monday 26 December 2016 16:30
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.11590
Location: France
Contact:

Re: Python Plugin : Broadlink

Post by DrMacabre »

Thank you, what’s my domoticzplugin/import directory ? You mentioned android in your reply, am i missing something ?
zak45
Posts: 952
Joined: Sunday 22 January 2017 11:37
Target OS: Windows
Domoticz version: V2024.4
Contact:

Re: Python Plugin : Broadlink

Post by zak45 »

DrMacabre wrote: Sunday 09 January 2022 12:47 Thank you, what’s my domoticzplugin/import directory ? You mentioned android in your reply, am i missing something ?
when you install the Broadlink plugin, severals directories should be created under your domoticz plugin directory, "import" should be one if them.
Yep, android for tasks that need to be done on your android phone.
DrMacabre
Posts: 71
Joined: Monday 26 December 2016 16:30
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.11590
Location: France
Contact:

Re: Python Plugin : Broadlink

Post by DrMacabre »

Ok so i was doing it right but the import dir wasn’t created during the installation of the plugin though, i had to do it manually and all 3 json files are in it but nothing ever happened after i clicked the econtrol button on the web interface. Do you think this might be an issue due to ownership attributes of the json files or something ?
zak45
Posts: 952
Joined: Sunday 22 January 2017 11:37
Target OS: Windows
Domoticz version: V2024.4
Contact:

Re: Python Plugin : Broadlink

Post by zak45 »

yes .. can be.
this is the directory structure for the import process (windows):
e-control.PNG
e-control.PNG (84.56 KiB) Viewed 1792 times
DrMacabre
Posts: 71
Joined: Monday 26 December 2016 16:30
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.11590
Location: France
Contact:

Re: Python Plugin : Broadlink

Post by DrMacabre »

Oh ok, i see, that’s Broadlink/ini/import/ not Broadlink/import/ that’s why.

Thank you.
albebert
Posts: 20
Joined: Friday 18 September 2020 17:41
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin : Broadlink

Post by albebert »

Hi,

Learn RF is not working for me.

i've an hex code for my remote from Broadlink Manager :

JgA6AAsSDBIMEgsHFwcXBhcHFwcXBxcGGAYXBxcHFwcXBhcHFwcXEwsHFxILEwsTCxMLBxYTCwcXBxAADQUAAAAAAAAAAAAAAAAAAA==

anyone can send me a sample ini file for RF command please ?

edit :

with broadlink_cli.py i can learn RF and send it !

so just need to make a corect ini file for the plugin
zak45
Posts: 952
Joined: Sunday 22 January 2017 11:37
Target OS: Windows
Domoticz version: V2024.4
Contact:

Re: Python Plugin : Broadlink

Post by zak45 »

albebert wrote: Wednesday 12 January 2022 0:12 Hi,

Learn RF is not working for me.

i've an hex code for my remote from Broadlink Manager :

JgA6AAsSDBIMEgsHFwcXBhcHFwcXBxcGGAYXBxcHFwcXBhcHFwcXEwsHFxILEwsTCxMLBxYTCwcXBxAADQUAAAAAAAAAAAAAAAAAAA==

anyone can send me a sample ini file for RF command please ?

edit :

with broadlink_cli.py i can learn RF and send it !

so just need to make a corect ini file for the plugin
that's strange, if it work with broadlink_cli.py this should work with the GUI, same program used !!!??
albebert
Posts: 20
Joined: Friday 18 September 2020 17:41
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin : Broadlink

Post by albebert »

zak45 wrote: Wednesday 12 January 2022 11:43
albebert wrote: Wednesday 12 January 2022 0:12 Hi,

Learn RF is not working for me.

i've an hex code for my remote from Broadlink Manager :

JgA6AAsSDBIMEgsHFwcXBhcHFwcXBxcGGAYXBxcHFwcXBhcHFwcXEwsHFxILEwsTCxMLBxYTCwcXBxAADQUAAAAAAAAAAAAAAAAAAA==

anyone can send me a sample ini file for RF command please ?

edit :

with broadlink_cli.py i can learn RF and send it !

so just need to make a corect ini file for the plugin
that's strange, if it work with broadlink_cli.py this should work with the GUI, same program used !!!??
yes it's strange ^^ same program yes, i use the cli from plugin folder (fresh install with install.py and fresh domoticz install on a debian 9 )

not a big problem i don't learn RF all days :) so if i've a example of RF ini i can deal with it

in fact for now i've created a shell script that i call with dummy switch that use the broadlink_cli.py and it work well :)
zak45
Posts: 952
Joined: Sunday 22 January 2017 11:37
Target OS: Windows
Domoticz version: V2024.4
Contact:

Re: Python Plugin : Broadlink

Post by zak45 »

Just tried on my installation, no problem...
here is the ini file from the code I learned (windows system):

[DEFAULT]
pluginkey = Broadlink
pluginname = RM2
pluginfolder = C:\Program Files (x86)\Domoticz\plugins\Broadlink\
hardwareid = 31
unit = 017
customname = RF

[Device]
host = 192.168.1.xxx
mac = b4cccceeffaa

[LearnedCode]
017 = b2009e02085b0909092d082c090a080a092c092c080a090a082d080a082d0909092c092c090a082c090a092c080a090a082c092c090a092c080a0909092c090a082d082c090a092c090a080a082d092c080a092c080b082c090a080a092c092c0909090a082d092c080a0909092d080a092c080a092c0909092c090a082d082c090a080a092c0900015b085b0909092c092c090a0909092c092c080a090a082c090a082d080a092c092c090a092b090a092c080a090a082d082c090a092b090a0909092c090a082c092c090a092c090a080a092c092c080a092c0909092c090a0909092c092c080a0909092d092c080a090a082d080a082d080a092c0909092c090a082d082c090a0909092c0800015c085b090a082d082c090a080a092c092c09090909092d080a082d0909092c092c080b092c080a092c080a090a082d082c090a092c080a090a082d080a082d092b090b082c090a080a092c092c0909092c090a082c090a080a092c092c0909090a082d092c0909090a082d080a092c0909092c0909092d080a092c082c090a0909092c0900015b085b090a082c092d080a080a092c092c090a080a082d0909092c0909092c092c090a092c080a092c090a080a082d082d080a092c0909090a082d080a082d092c080b082c090a080a092c092c090a082c090a082c090a0909092c092c090a080a092c092c080a090a092c080a092c090a082c090a082d080a082d082d080a090a082c0900015b085b090a082d092b090a0909092c092c0909090a082d0909092c0909092c092c090a092c0909092c090a080a082d092b090a092c080b080a082d080a092c092c080b082c090a080a092c092c090a082c090a082c090a0909092c092c090a080a082d092c090a080a082d080a092c0909092c0909092d080a082d082d080a0909092d080005dc092c090a080a082d082d
albebert
Posts: 20
Joined: Friday 18 September 2020 17:41
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin : Broadlink

Post by albebert »

thanks a lot.

i'll try it !
zak45
Posts: 952
Joined: Sunday 22 January 2017 11:37
Target OS: Windows
Domoticz version: V2024.4
Contact:

Re: Python Plugin : Broadlink

Post by zak45 »

Here it is your command:

[DEFAULT]
pluginkey = Broadlink
pluginname = RM2
pluginfolder = C:\Program Files (x86)\Domoticz\plugins\Broadlink\
hardwareid = 31
unit = 017
customname = RF

[Device]
host = 192.168.1.xxx
mac = b4cccceeffaa

[LearnedCode]
017 =
26003a000b120c120c120b07170717061707170717071706180617071707170717061707170717130b0717120b130b130b130b0716130b07170710000d050000000000000000000000000000

the code you have supplied is a Base64 code, so need to be converted to Hex first.
you can create an ini file on the import folder and click the import button, this should create your ini file automatically.
mojso
Posts: 86
Joined: Friday 08 November 2019 23:07
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin : Broadlink

Post by mojso »

@zak45

the plugin worked perfectly until yesterday. but from today I get this error

Code: Select all

	
2022-01-18 17:18:09.815 Error: BR3: Traceback (most recent call last):
2022-01-18 17:18:09.815 File "/home/pi/domoticz/plugins/Broadlink/plugin.py", line 1746, in send
2022-01-18 17:18:09.815 DEVICE.send_data(SENDCOMMAND)
2022-01-18 17:18:09.815 File "/usr/local/lib/python3.7/dist-packages/broadlink/__init__.py", line 639, in send_data
2022-01-18 17:18:09.815 response = self.send_packet(0x6a, packet)
2022-01-18 17:18:09.815 File "/usr/local/lib/python3.7/dist-packages/broadlink/__init__.py", line 349, in send_packet
2022-01-18 17:18:09.815 payload = self.encrypt(payload)
2022-01-18 17:18:09.815 File "/usr/local/lib/python3.7/dist-packages/broadlink/__init__.py", line 236, in encrypt
2022-01-18 17:18:09.815 encryptor = self.aes.encryptor()
2022-01-18 17:18:09.815 File "/usr/lib/python3/dist-packages/cryptography/hazmat/primitives/ciphers/base.py", line 121, in encryptor
2022-01-18 17:18:09.815 self.algorithm, self.mode
2022-01-18 17:18:09.815 File "/usr/lib/python3/dist-packages/cryptography/hazmat/backends/openssl/backend.py", line 295, in create_symmetric_encryption_ctx
2022-01-18 17:18:09.815 return _CipherContext(self, cipher, mode, _CipherContext._ENCRYPT)
2022-01-18 17:18:09.815 File "/usr/lib/python3/dist-packages/cryptography/hazmat/backends/openssl/ciphers.py", line 112, in __init__
2022-01-18 17:18:09.815 self._backend._ffi.from_buffer(cipher.key),
2022-01-18 17:18:09.815 TypeError: from_buffer() cannot return the address of the raw string within a bytes or unicode object
2022-01-18 17:18:09.815
2022-01-18 17:18:09.815 Error: BR3: Warning : Code sent ....Probably timeout

I think after installing the thermostat weekly sheduler I can no longer use Broadlink, I uninstalled the thermostat weekly sheduler but the Broadlink plugin did not work
zak45
Posts: 952
Joined: Sunday 22 January 2017 11:37
Target OS: Windows
Domoticz version: V2024.4
Contact:

Re: Python Plugin : Broadlink

Post by zak45 »

look at your cryptography module, maybe try to install last version.
mojso
Posts: 86
Joined: Friday 08 November 2019 23:07
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin : Broadlink

Post by mojso »

zak45 wrote: Wednesday 19 January 2022 11:37 look at your cryptography module, maybe try to install last version.
please how to reinstall the cryptography module.


sudo pip install cryptography --upgrade - now I get this error

Code: Select all

2022-01-19 12:15:01.942 Error: BR3: ERR : remote_plugin--_Error receive / save file from Cloud Drive : https://synnas.publicvm.com:4430/s/pNbw6pD7w33TTQX/download_--21
2022-01-19 12:15:01.943 Error: BR3: No transport, write directive to '127.0.0.1:47058' ignored.
2022-01-19 12:15:12.767 Error: Error opening url: http://127.0.0.1:8080/json.htm?type=command&param=switchlight&idx=711&switchcmd=On
2022-01-19 12:15:36.977 Error: Error opening url: http://127.0.0.1:8080/json.htm?type=command&param=switchlight&idx=712&switchcmd=On
2022-01-19 12:15:44.076 Error: Error opening url: http://127.0.0.1:8080/json.htm?type=command&param=switchlight&idx=711&switchcmd=On
2022-01-19 12:17:09.936 Error: Error opening url: http://127.0.0.1:8080/json.htm?type=command&param=switchlight&idx=712&switchcmd=On
2022-01-19 12:20:11.083 Error: BR3: Traceback (most recent call last):
2022-01-19 12:20:11.083 File "/usr/local/lib/python3.7/dist-packages/broadlink/__init__.py", line 369, in send_packet
2022-01-19 12:20:11.083 response = cs.recvfrom(2048)
2022-01-19 12:20:11.083 socket.timeout: timed out
2022-01-19 12:20:11.083
2022-01-19 12:20:11.083 During handling of the above exception, another exception occurred:
2022-01-19 12:20:11.083
2022-01-19 12:20:11.083 Traceback (most recent call last):
2022-01-19 12:20:11.083 File "/home/pi/domoticz/plugins/Broadlink/plugin.py", line 1803, in broadlink_connect
2022-01-19 12:20:11.083 DEVICE.auth()
2022-01-19 12:20:11.083 File "/usr/local/lib/python3.7/dist-packages/broadlink/__init__.py", line 270, in auth
2022-01-19 12:20:11.083 response = self.send_packet(0x65, payload)
2022-01-19 12:20:11.083 File "/usr/local/lib/python3.7/dist-packages/broadlink/__init__.py", line 374, in send_packet
2022-01-19 12:20:11.083 raise exception(0xfffd)
2022-01-19 12:20:11.083 broadlink.exceptions.DeviceOfflineError: The device is offline
2022-01-19 12:20:11.083
2022-01-19 12:20:11.083 Error: BR3: Error to connect to Broadlink device: 192.168.1.117
2022-01-19 12:23:00.658 Error: Error opening url: http://127.0.0.1:8080/json.htm?type=command&param=switchlight&idx=951&switchcmd=On
2022-01-19 12:23:04.079 Error: Error opening url: http://127.0.0.1:8080/json.htm?type=command&param=switchlight&idx=951&switchcmd=On
2022-01-19 12:23:07.612 Error: Error opening url: http://127.0.0.1:8080/json.htm?type=command&param=switchlight&idx=951&switchcmd=On
2022-01-19 12:25:11.294 Error: BR3: Traceback (most recent call last):
2022-01-19 12:25:11.294 File "/usr/local/lib/python3.7/dist-packages/broadlink/__init__.py", line 369, in send_packet
2022-01-19 12:25:11.294 response = cs.recvfrom(2048)
2022-01-19 12:25:11.294 socket.timeout: timed out
2022-01-19 12:25:11.294
2022-01-19 12:25:11.294 During handling of the above exception, another exception occurred:
2022-01-19 12:25:11.294
2022-01-19 12:25:11.294 Traceback (most recent call last):
2022-01-19 12:25:11.294 File "/home/pi/domoticz/plugins/Broadlink/plugin.py", line 1803, in broadlink_connect
2022-01-19 12:25:11.294 DEVICE.auth()
2022-01-19 12:25:11.294 File "/usr/local/lib/python3.7/dist-packages/broadlink/__init__.py", line 270, in auth
2022-01-19 12:25:11.294 response = self.send_packet(0x65, payload)
2022-01-19 12:25:11.294 File "/usr/local/lib/python3.7/dist-packages/broadlink/__init__.py", line 374, in send_packet
2022-01-19 12:25:11.294 raise exception(0xfffd)
2022-01-19 12:25:11.294 broadlink.exceptions.DeviceOfflineError: The device is offline
2022-01-19 12:25:11.294
2022-01-19 12:25:11.294 Error: BR3: Error to connect to Broadlink device: 192.168.1.117

I succeeded.
I reinstalled the crypto module.
I deleted the browser history.
I set up Local Networks again (no username / password):
zak45
Posts: 952
Joined: Sunday 22 January 2017 11:37
Target OS: Windows
Domoticz version: V2024.4
Contact:

Re: Python Plugin : Broadlink

Post by zak45 »

Great !
zak45
Posts: 952
Joined: Sunday 22 January 2017 11:37
Target OS: Windows
Domoticz version: V2024.4
Contact:

Re: Python Plugin : Broadlink

Post by zak45 »

vceklic wrote: Saturday 22 January 2022 9:23Anyone?
Should work now.
garycooper
Posts: 21
Joined: Sunday 10 March 2019 20:50
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin : Broadlink

Post by garycooper »

Hi, sorry but link doesn't work anymore.
kollemt
Posts: 29
Joined: Monday 18 February 2019 20:41
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.1
Contact:

Re: Python Plugin : Broadlink

Post by kollemt »

I have installed the Broadlink plugin on my Raspberry Pi.
All is working ok in Domoticz to control my tvs.
Only after a reboot I always get always the attached error and always have to deactivate and activate the broadlink hardware to avoid the device shows Red.
How to get rid of this message ?
Attachments
3CFF57C2-D78D-408D-8DBB-5F73064DE594.png
3CFF57C2-D78D-408D-8DBB-5F73064DE594.png (89.25 KiB) Viewed 1757 times
EBCBBD96-5DBA-455B-9D24-9AF9E9BEA59E.jpeg
EBCBBD96-5DBA-455B-9D24-9AF9E9BEA59E.jpeg (325.52 KiB) Viewed 1757 times
zak45
Posts: 952
Joined: Sunday 22 January 2017 11:37
Target OS: Windows
Domoticz version: V2024.4
Contact:

Re: Python Plugin : Broadlink

Post by zak45 »

Sorry, but your screenshot is not 'readable'.
provide full text log.
kollemt
Posts: 29
Joined: Monday 18 February 2019 20:41
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.1
Contact:

Re: Python Plugin : Broadlink

Post by kollemt »

In problem log after a reboot and a domoticz stop and start



2022-01-28 08:17:40.233 Error: Broadlink TV woonkamer: (Broadlink) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/Broadlink/:/usr/lib/python37.zip:/usr/lib/python3.7:/usr/lib/python3.7/lib-dynload:/usr/local/lib/python3.7/dist-packages:/usr/lib/python3/dist-packages:/usr/lib/python3.7/dist-packages'.
2022-01-28 08:17:40.233 Error: Broadlink TV woonkamer: Module Import failed, exception: 'InternalError'
2022-01-28 08:17:40.233 Error: Broadlink TV woonkamer: Error Line details not available.
2022-01-28 08:17:40.233 Error: Broadlink TV woonkamer: Exception traceback:
2022-01-28 08:17:40.233 Error: Broadlink TV woonkamer: ----> Line 129 in '/home/pi/domoticz/plugins/Broadlink/plugin.py', function <module>
2022-01-28 08:17:40.233 Error: Broadlink TV woonkamer: ----> Line 12 in '/usr/local/lib/python3.7/dist-packages/requests_toolbelt/__init__.py', function <module>
2022-01-28 08:17:40.233 Error: Broadlink TV woonkamer: ----> Line 12 in '/usr/local/lib/python3.7/dist-packages/requests_toolbelt/adapters/__init__.py', function <module>
2022-01-28 08:17:40.233 Error: Broadlink TV woonkamer: ----> Line 12 in '/usr/local/lib/python3.7/dist-packages/requests_toolbelt/adapters/ssl.py', function <module>
2022-01-28 08:17:40.233 Error: Broadlink TV woonkamer: ----> Line 55 in '/usr/lib/python3/dist-packages/requests/__init__.py', function <module>
2022-01-28 08:17:40.233 Error: Broadlink TV woonkamer: ----> Line 59 in '/usr/lib/python3/dist-packages/requests/packages/__init__.py', function <module>
2022-01-28 08:17:40.233 Error: Broadlink TV woonkamer: ----> Line 49 in '/usr/lib/python3/dist-packages/requests/packages/__init__.py', function vendored
2022-01-28 08:17:40.233 Error: Broadlink TV woonkamer: ----> Line 47 in '/usr/lib/python3/dist-packages/urllib3/contrib/pyopenssl.py', function <module>
2022-01-28 08:17:40.233 Error: Broadlink TV woonkamer: ----> Line 8 in '/usr/lib/python3/dist-packages/OpenSSL/__init__.py', function <module>
2022-01-28 08:17:40.233 Error: Broadlink TV woonkamer: ----> Line 12 in '/usr/lib/python3/dist-packages/OpenSSL/rand.py', function <module>
2022-01-28 08:17:40.233 Error: Broadlink TV woonkamer: ----> Line 6 in '/usr/lib/python3/dist-packages/OpenSSL/_util.py', function <module>
2022-01-28 08:17:40.233 Error: Broadlink TV woonkamer: ----> Line 195 in '/usr/local/lib/python3.7/dist-packages/cryptography/hazmat/bindings/openssl/binding.py', function <module>
2022-01-28 08:17:40.233 Error: Broadlink TV woonkamer: ----> Line 151 in '/usr/local/lib/python3.7/dist-packages/cryptography/hazmat/bindings/openssl/binding.py', function init_static_locks
2022-01-28 08:17:40.233 Error: Broadlink TV woonkamer: ----> Line 134 in '/usr/local/lib/python3.7/dist-packages/cryptography/hazmat/bindings/openssl/binding.py', function _ensure_ffi_initialized
2022-01-28 08:17:40.233 Error: Broadlink TV woonkamer: ----> Line 120 in '/usr/local/lib/python3.7/dist-packages/cryptography/hazmat/bindings/openssl/binding.py', function _register_osrandom_engine
2022-01-28 08:17:40.233 Error: Broadlink TV woonkamer: ----> Line 78 in '/usr/local/lib/python3.7/dist-packages/cryptography/hazmat/bindings/openssl/binding.py', function _openssl_assert



2022-01-28 08:17:54.728 Error: Broadlink TV slaapkamer: ERR : remote_plugin--_Error receive / save file from Cloud Drive : https://synnas.publicvm.com:4430/s/pNbw ... nload_--21
2022-01-28 08:45:10.687 Error: Broadlink TV woonkamer: ERR : remote_plugin--_Error receive / save file from Cloud Drive : https://synnas.publicvm.com:4430/s/pNbw ... nload_--21
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest