Python Plugin : Broadlink

Python and python framework

Moderator: leecollings

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 »

Same problem here :

viewtopic.php?t=40417
TomCunningham
Posts: 1
Joined: Sunday 08 October 2023 1:45
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin : Broadlink

Post by TomCunningham »

zak45 wrote: Thursday 11 May 2023 19:04
Verify no user/password required for local Lan.

And the Git version is on go...!!
I'm puzzled here, the user/password for the local LAN, do you mean the SSID and password? If so, how is that supplied to setup?
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 »

Capture d'écran 2023-10-08 232542.png
Capture d'écran 2023-10-08 232542.png (14.89 KiB) Viewed 3062 times
Loky31
Posts: 40
Joined: Monday 11 March 2019 13:46
Target OS: -
Domoticz version:
Contact:

Re: Python Plugin : Broadlink

Post by Loky31 »

Hi,

I'm tryng to move from the old version of the plugin to this one but I'm struggling as the setup.py does not work ...
I have the follwoing error :
File "setup.py", line 230
print("\r>> Bytes downloaded -->" + state + str(leng) + state, end='', flush=True)
^
SyntaxError: invalid syntax

I don't really know what to do there... Other point is that I have quite some IR and RF devices made with my current plugin . Will it cange anything when migrating ?What I have to do to keep it working ?

thanks a lot in advance.
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 »

Loky31 wrote: Thursday 25 January 2024 9:40 I have the follwoing error :
File "setup.py", line 230
print("\r>> Bytes downloaded -->" + state + str(leng) + state, end='', flush=True)
^
SyntaxError: invalid syntax
looks like you still use python 2.x ????

First, always made a backup of your existing plugin folder (with ini files)
You need to copy old ini files to your new path, and import them
No more is needed to have Domoticz device linked to the ini file, but can be done if necessary.
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 »

New plugin version 2.1. Released:
broadlink module to 0.18.0
RF learn bug fixes
cpceb
Posts: 2
Joined: Sunday 24 March 2024 19:53
Target OS: Linux
Domoticz version:
Contact:

Re: Python Plugin : Broadlink

Post by cpceb »

Hello,

I just tested the installation of the pluging, unfortunately without success . . .

Domoticz is installed on a linux distribution (Yunohost), is using python 3.9.2, has " python3-pip" installed, and domoticz plugin folder is /var/www/domoticz/plugins

In a first time I created the Broadlink folder :
/var/www/domoticz/plugins/Broadlink/

Copy in this folder the file :
https://raw.githubusercontent.com/zak-4 ... n/setup.py

Make it executable, and launcht it with the command "python setup.py"

But I get the following error message :

Code: Select all

 put *.py files executable (+x) OK
chmod: impossible to access at 'scr/*.sh': no file or folder of this type
ERROR to start subprocess
1s
sudo chmod +x scr/*.sh 
b''
 ERROR to put +x to  *.sh files 
A strange thing is in "/var/www/domoticz/plugins/Broadlink/" I have the follwing files and folder :

Code: Select all

drwxr-xr-x 8 domoticz domoticz   4096 24 mars  17:04 Broadlink-Domoticz-plugin-main
-rw-r--r-- 1 domoticz domoticz 571514 24 mars  17:32 BroadlinkSetup.zip
-rwxr-xr-x 1 domoticz domoticz   8880 24 mars  16:50 setup.py
setup.py has installed broadlink not in /var/www/domoticz/plugins/Broadlink/, but in /var/www/domoticz/plugins/Broadlink/Broadlink-Domoticz-plugin-main :

Code: Select all

root@yunohost2:/var/www/domoticz/plugins/Broadlink/Broadlink-Domoticz-plugin-main# ls -l
total 524
drwxr-xr-x 2 domoticz domoticz   4096 24 mars  17:04 bkp
-rw-r--r-- 1 domoticz domoticz   7840 24 mars  17:32 broadlink_cli.py
-rw-r--r-- 1 domoticz domoticz   1452 24 mars  17:32 broadlink_discovery.py
-rw-r--r-- 1 domoticz domoticz  35505 24 mars  17:32 Dombroadlink.py
drwxr-xr-x 3 domoticz domoticz   4096 24 mars  17:04 ini
-rw-r--r-- 1 domoticz domoticz   1063 24 mars  17:32 LICENSE
drwxr-xr-x 2 domoticz domoticz   4096 24 mars  17:04 lng
drwxr-xr-x 2 domoticz domoticz   4096 24 mars  17:04 log
-rw-r--r-- 1 domoticz domoticz 214226 24 mars  17:32 plugin.py
-rw-r--r-- 1 domoticz domoticz   7313 24 mars  17:32 README.md
-rw-r--r-- 1 domoticz domoticz    247 24 mars  17:32 requirements.txt
drwxrwxrwx 2 domoticz domoticz   4096 24 mars  17:04 scr
-rw-r--r-- 1 domoticz domoticz   8880 24 mars  17:32 setup.py
-rw-r--r-- 1 domoticz domoticz 214164 24 mars  17:32 tst-plugin
drwxr-xr-x 5 domoticz domoticz   4096 24 mars  17:04 web
I had manually make the folder scr executable, try to launch again setup.py, without success.

Does somebody has an idea about the problem ?

Thank's.
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 »

you just need to move all from Broadlink-Domoticz-plugin-main to plugins/Broadlink.
and made chmod +x to scr/*.sh
Will take a look to the extraction process.
cpceb
Posts: 2
Joined: Sunday 24 March 2024 19:53
Target OS: Linux
Domoticz version:
Contact:

Re: Python Plugin : Broadlink

Post by cpceb »

Hello,

I finally have been able to install the script after have downloading it in domoticz/plugin (instead of domoticz/plugin/Broadlink) and updating it in two points :

Line 284 :

Code: Select all

command = 'sudo chmod +x scr/*.sh '
Become

Code: Select all

command = 'sudo chmod +x Broadlink-Domoticz-plugin-main/scr/*.sh '
And from lines 339 to 364, I commented the lines like this :

Code: Select all

#
# we check directory structure
###mydir = ['ini', 'lng', 'log', 'scr', 'web']
###
###for items in mydir:
###    if os.path.exists(items):
###        print('Directory {} exist, OK'.format(items))
###
###    else:
###
###        print('Error : Directory {} do not exist, verify error... exiting'.format(items))
###        sys.exit()
#
# we check files
###if os.path.exists(updname):
###    print('Error : zip file : {} still exist, not normal !!!'.format(updname))
###    sys.exit()
###
###filelist = ['plugin.py', 'Dombroadlink.py']
###
###for items in filelist:
###    if os.path.exists(items):
###        print('File {} exist, OK'.format(items))
###
###    else:
###
###        print('Error : File {} do not exist, verify error... exiting'.format(items))
###        sys.exit()
As I understood, we need to create the folder "Broadlink" here : domiticz/plugin

Then copy the script in domoticz/plugin/Broadlink and execute it.

I suppose the problem is that the script downloads and unzips the files here : domoticz/plugin/Broadlink /Broadlink-Domoticz-plugin-main

But as the script is in the folder domoticz/plugin/Broadlink, he tries to execute some functiond in this folder, while the files (sub folder scr) are in reality in another folder, domoticz/plugin/Broadlink /Broadlink-Domoticz-plugin-main.
lambrosgg
Posts: 2
Joined: Monday 10 June 2024 19:53
Target OS: Windows
Domoticz version:
Contact:

Re: Python Plugin : Broadlink

Post by lambrosgg »

I can't setup (SSID+password) the RM4 mini following the instructions. I even tried to follow the advanced ones here https://github.com/mjg59/python-broadlink that specify the ip and i get "got an unexpected keyword argument 'ip_address'" error. Is it supposed to be "BroadlinkProv" in the SSID? I can only get to normal AP mode with the light blinking fast. I connect it to the laptop (windows 10) that I am running the commands on, but nothing happens. The "broadlink.setup('myssid', 'mynetworkpass', 3)" doesnt seem to work, the device is still in AP mode. Any ideas?
lambrosgg
Posts: 2
Joined: Monday 10 June 2024 19:53
Target OS: Windows
Domoticz version:
Contact:

Re: Python Plugin : Broadlink

Post by lambrosgg »

I managed to connect it on my network and it gets detected in the Network Scan with a temperature reading.
broadlink1.JPG
broadlink1.JPG (48.89 KiB) Viewed 1968 times
However it shows as 0x520c and I cant switch the device on the Webadmin. Clicking "overwrite default device type" and selecting 0x520c from the list does nothing, its still 0x272a even after rebooting plugin or domoticz. I can see the device on the switches tabs but no temperature reading. What file is supposed to be selected on the top of the page?
broadlink2.JPG
broadlink2.JPG (282.29 KiB) Viewed 1968 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 »

Do you have the external temp module ?
DomoBerny
Posts: 1
Joined: Friday 25 October 2024 3:39
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin : Broadlink

Post by DomoBerny »

Hello, a have a problem, the plugin same to work in log but if i try to create one new device, Broadlink with kod.......,. is not in menu.
Some one can help me,,Please.

Thank in advance!
Attachments
Log Domoticz 1st resrat Broadlink.txt
(7.73 KiB) Downloaded 20 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 »

DomoBerny wrote: Friday 25 October 2024 3:50 Hello, a have a problem, the plugin same to work in log but if i try to create one new device, Broadlink with kod.......,. is not in menu.
Some one can help me,,Please.

Thank in advance!
not sure this work :
2024-10-24 22:07:18.492 Error: Brooadlink RM3 mini: (BroadlinkRM2) failed to load 'plugin.py', Python Path used was ':/usr/lib/python311.zip:/usr/lib/python3.11:/usr/lib/python3.11/lib-dynload:/usr/local/lib/python3.11/dist-packages:/usr/lib/python3/dist-packages:/usr/lib/python3.11/dist-packages'.
2024-10-24 22:07:18.532 Status: RFLink: Using serial port: /dev/ttyUSB0
2024-10-24 22:07:18.628 Status: Python EventSystem: Initializing event module.
2024-10-24 22:07:18.628 Status: EventSystem: Started
2024-10-24 22:07:18.629 Status: EventSystem: Queue thread started...
2024-10-24 22:07:18.655 Error: Brooadlink RM3 mini: Exception: 'ModuleNotFoundError'. No traceback available.
2024-10-24 22:07:18.829 Status: controler Z: using config in: /home/pi/domoticz/Config
User avatar
Thuis
Posts: 270
Joined: Tuesday 11 September 2018 11:36
Target OS: Linux
Domoticz version: Beta
Location: The Netherlands
Contact:

Re: Python Plugin : Broadlink

Post by Thuis »

Due to latest ubuntu 24.04 everything python is f$@#% up. Got everything python working again, but not for broadlink.
I get:
Spoiler: show
Error: RM2: (Broadlink) failed to load 'plugin.py', Python Path used was '/home/ubuntu/domoticz/plugins/Broadlink/:/home/ubuntu/domoticz/plugins/domoticzPythonVenv:/home/ubuntu/domoticz/$PYTHONPATH:/usr/lib/python312.zip:/usr/lib/python3.12:/usr/lib/python3.12/lib-dynload:/usr/local/lib/python3.12/dist-packages:/usr/lib/python3/dist-packages:/usr/lib/python3.12/dist-packages'.
2025-05-30 21:17:59.609 Error: RM2: Traceback (most recent call last):
2025-05-30 21:17:59.609 Error: RM2: File "/home/ubuntu/domoticz/plugins/Broadlink/plugin.py", line 134, in <module>
2025-05-30 21:17:59.609 Error: RM2: import broadlink
2025-05-30 21:17:59.609 Error: RM2: File "/usr/local/lib/python3.12/dist-packages/broadlink/__init__.py", line 8, in <module>
2025-05-30 21:17:59.609 Error: RM2: from .alarm import S1C
2025-05-30 21:17:59.609 Error: RM2: File "/usr/local/lib/python3.12/dist-packages/broadlink/alarm.py", line 3, in <module>
2025-05-30 21:17:59.609 Error: RM2: from .device import Device
2025-05-30 21:17:59.609 Error: RM2: File "/usr/local/lib/python3.12/dist-packages/broadlink/device.py", line 9, in <module>
2025-05-30 21:17:59.609 Error: RM2: from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
2025-05-30 21:17:59.609 Error: RM2: File "/usr/lib/python3/dist-packages/cryptography/hazmat/primitives/ciphers/__init__.py", line 11, in <module>
2025-05-30 21:17:59.609 Error: RM2: from cryptography.hazmat.primitives.ciphers.base import (
2025-05-30 21:17:59.609 Error: RM2: File "/usr/lib/python3/dist-packages/cryptography/hazmat/primitives/ciphers/base.py", line 10, in <module>
2025-05-30 21:17:59.609 Error: RM2: from cryptography.exceptions import (
2025-05-30 21:17:59.609 Error: RM2: File "/usr/lib/python3/dist-packages/cryptography/exceptions.py", line 9, in <module>
2025-05-30 21:17:59.609 Error: RM2: from cryptography.hazmat.bindings._rust import exceptions as rust_exceptions
2025-05-30 21:17:59.609 Error: RM2: ImportError: PyO3 modules compiled for CPython 3.8 or older may only be initialized once per interpreter process
Spoiler: show
pip show broadlink
Name: broadlink
Version: 0.18.3
Summary: Python API for controlling Broadlink devices
Home-page: http://github.com/mjg59/python-broadlink
Author: Matthew Garrett
Author-email: [email protected]
License: UNKNOWN
Location: /usr/local/lib/python3.12/dist-packages
Requires: cryptography
Required-by:
Spoiler: show
pip show cryptography
Name: cryptography
Version: 41.0.7
Summary: cryptography is a package which provides cryptographic recipes and primitives to Python developers.
Home-page:
Author:
Author-email: The Python Cryptographic Authority and individual contributors <[email protected]>
License: Apache-2.0 OR BSD-3-Clause
Location: /usr/lib/python3/dist-packages
Requires:
Required-by: broadlink

I am guessing something with a python package? I have no clue. Anyone an idea i could try ?
Thanks in advance.
I Love Domoticz ! And the community around it :-)
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest