Page 16 of 27
Re: Python Plugin : Broadlink
Posted: Sunday 28 February 2021 8:26
by vernwood
zak45 wrote: ↑Saturday 27 February 2021 18:01
vernwood wrote: ↑Saturday 27 February 2021 5:53
hi zak45
does the plugin support the new sp4 power socket already?
Not yet officialy, but you can made a test and select sp2 as device.
Code: Select all
2021-02-28 08:14:08.421 Error: Python Plugin System: (broadlink_sp4l_01) Error to connect to Broadlink device: xx.x.x.xx
2021-02-28 08:15:16.812 Error: Python Plugin System: (broadlink_sp4l_01) Traceback (most recent call last):
2021-02-28 08:15:16.812 File "/home/pi/domoticz/plugins/Broadlink/plugin.py", line 1803, in broadlink_connect
2021-02-28 08:15:16.812 DEVICE.auth()
2021-02-28 08:15:16.812 File "/usr/local/lib/python3.7/dist-packages/broadlink/__init__.py", line 271, in auth
2021-02-28 08:15:16.812 check_error(response[0x22:0x24])
2021-02-28 08:15:16.812 File "/usr/local/lib/python3.7/dist-packages/broadlink/exceptions.py", line 97, in check_error
2021-02-28 08:15:16.812 raise exception(error_code)
2021-02-28 08:15:16.812 broadlink.exceptions.AuthenticationError: Authentication failed
2021-02-28 08:15:16.812
2021-02-28 08:15:16.813 Error: Python Plugin System: (broadlink_sp4l_01) Error to connect to Broadlink device: xxx.x.x.xx
Re: Python Plugin : Broadlink
Posted: Sunday 28 February 2021 17:24
by zak45
vernwood wrote: ↑Sunday 28 February 2021 8:26
hi zak45
does the plugin support the new sp4 power socket already?
Hmmm, do not work... Have seen that python-broadlink now manage sp4 plug... so this will be included into the next release, but the question now is when ??? Need to found some free time !!!
Re: Python Plugin : Broadlink
Posted: Monday 05 April 2021 15:43
by pvklink
I get an error during execution of sudo python setup.py
Could not find a version that satisfies the requirement httpx==0.13.3 (from googletrans) (from versions: )
No matching distribution found for httpx==0.13.3 (from googletrans)
i use python 3.5.4
@update
i installed python 3.7
sudo apt-get install python3.7 libpython3.7
and made it default
After that i did a new install sudo python setup.py
And that looks much better but stops after some time with the next error:
Error : Directory ini do not exist, verify error... exiting
Re: Python Plugin : Broadlink
Posted: Monday 05 April 2021 16:48
by zak45
pvklink wrote: ↑Monday 05 April 2021 15:43
I get an error during execution of sudo python setup.py
Error : Directory ini do not exist, verify error... exiting
setup.py verify directory existance : 'ini', 'lng', 'log', 'scr', 'web'
These need to be under the plugin folder.
Maybe some rights problem ?
Re: Python Plugin : Broadlink
Posted: Monday 05 April 2021 22:05
by pvklink
solved, made these folders myself and reinstalled the setup.py.
Look Great, and works great !
Have some small issues with my browser with some buttons, will add a screendump soon..
Questions:
1. Do the ini-files need some format in the name or can we choose a random name for the ini-files so that the gui shows an easy to read ini file?
2. is it possible to make an ini-file with al entries filled (also the domoticz device name) even when the domoticz device is not there ?
or do you first have to add an ini -file with customname = RF and then add device with the Broadlink WEB Gui
ps: i know i can activate the learnmodus and add an ini-file that way...
3. Why do i have 2 domoticz "opdrachten" devices one with and one without button "opruimen"
Re: Python Plugin : Broadlink
Posted: Monday 05 April 2021 23:35
by zak45
pvklink wrote: ↑Monday 05 April 2021 22:05
Questions:
1. Do the ini-files need some format in the name or can we choose a random name for the ini-files so that the gui shows an easy to read ini file?
2. is it possible to make an ini-file with al entries filled (also the domoticz device name) even when the domoticz device is not there ?
or do you first have to add an ini -file with customname = RF and then add device with the Broadlink WEB Gui
ps: i know i can activate the learnmodus and add an ini-file that way...
3. Why do i have 2 domoticz "opdrachten" devices one with and one without button "opruimen"
1: ini file name is not customizable
2: it is possible, but you need to create this ini file under the ini/import folder and run the import process.
Domoticz device is optional, you can always initiate the IR or RF send command thru Web GUI or command line or http call.
3 : ???
Re: Python Plugin : Broadlink
Posted: Tuesday 06 April 2021 7:53
by pvklink
cant add attachments... Otherwise i could show you
- the gui-issues
- 2 broadlink control devices
I think the board quota is full....
Re: Python Plugin : Broadlink
Posted: Tuesday 06 April 2021 11:40
by pvklink
your plugin is AMAZING!
I have an usb/IR lamp for which a have a complex dzvents script to manage it.
for example: to turn it to the color blue i have to:
1. turn it off (otherwise the state is not right)
2. turn it on
3. turn 3 times the color button (then i get blue)
With this ini file i can do the same!
Only not with the current gui on port 9000 (option: more codes), because you can use an ini file only ones
But with the text-editor

it works!
You have to add some timers otherwise it goes wrong...
Code: Select all
# multi-Code item, heeft dus geen zendcodes, maar een cluster van ini's die dat wel hebben!
# kleur blauw(20): uit(12), aan(15), 3xkleur(10)
# heeft geen eigen domoticz device, evt via usblamp te besturen met een http opdracht erbij
# &timer=1 moet je ook toevoegen anders gebeurt er soms iets raars met de kleuren meer x-keer kleur
[DEFAULT]
pluginkey = Broadlink
pluginname = Broadlink
pluginfolder = /home/pi/domoticz/plugins/Broadlink/
hardwareid = 32
unit = 020
customname = Multi-Code
[Device]
host = 192.168.20.61
mac = 780f77fd8633
[LearnedCode]
020 = ini=Broadlink-32-012.ini&timer=1&ini=Broadlink-32-015.ini&timer=1&ini=Broadlink-32-010.ini&timer=1&ini=Broadlink-32-010.ini&timer=1&ini=Broadlink-32-010.ini&timer=1
Re: Python Plugin : Broadlink
Posted: Tuesday 06 April 2021 19:40
by zak45
GUI is for basic multi command, the editor provide a way to do more complex command
timer value is in second from 1 to 9 and often necessary..
Nice you like it...

Re: Python Plugin : Broadlink
Posted: Tuesday 06 April 2021 21:05
by pvklink
like it very much!
I have the new plugin working perfectly on my test environment.
I Try to get this working on my future docker server environment.
I use a working default docker image domoticz/domoticz:latest. This contains the latest beta
I have this domoticz docker working with volumes and plugins outside docker , see my docker-compose.yml
outside = home/pi/IOTstack/volumes/domoticz/data/plugins/Broadlink (files)
inside container= /opt/domoticz/userdata
And i did a first try to create my own image/container based on image domoticz/domoticz:latest
The dockerfile is included but not ready.
I already have included python and the broadlink files.
@update: last thing to do :
Last part is to install/activate broadlink i think?
- i get an error on that with:RUN python -m pip install python-broadlink-master
error: Could not install packages due to an EnvironmentError: 404 Client Error: Not Found for url:
https://pypi.org/simple/python-broadlink-master/
- i installed python 3.7 in the image, but cant activate it in the image, so an older version is used not suitable for broadlink
Code: Select all
FROM domoticz/domoticz:latest
USER root
RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y -q build-essential\
wget \
zip \
unzip \
git \
python-pip \
python3.7 \
libpython3.7/*
# VOLUME ["/opt/domoticz/scripts", "/opt/domoticz/backups", "/opt/domoticz/db", "/opt/domoticz/plugins", " /opt/domoticz/www/images/floorplans", " /opt/domoticz/www/templates"]
EXPOSE 8080 9440 9000
RUN mkdir -p /opt/domoticz/plugins
RUN cd /opt/domoticz/plugins && wget http://192.168.20.48:80/downloads/broadlink.zip && unzip -q broadlink.zip && rm broadlink.zip
RUN chmod -R 755 /opt/domoticz/plugins/Broadlink
RUN python -m pip install python-broadlink-master
# Start domoticz
# CMD ["/opt/domoticz/domoticz"]
[code]
version: '3.6'
services:
domoticz:
container_name: domoticz
image: domoticz/domoticz:latest
ports:
- "82:8080"
- "6144:6144"
- "1443:1443"
- "9000:9000"
devices:
- '/dev/ttyUSB0:/dev/ttyUSB0'
volumes:
- ./volumes/domoticz/data:/opt/domoticz/userdata
restart: unless-stopped
network_mode: bridge
environment:
- PUID=1000
- PGID=1000
#- LOG_PATH=/opt/domoticz/userdata/domoticz.log
mosquitto:
container_name: mosquitto
image: eclipse-mosquitto
restart: unless-stopped
user: "1000"
ports:
- "1883:1883"
volumes:
- ./volumes/mosquitto/data:/mosquitto/data
- ./volumes/mosquitto/log:/mosquitto/log
- ./volumes/mosquitto/pwfile:/mosquitto/pwfile
- ./services/mosquitto:/mosquitto/config:ro
network_mode: bridge
nodered:
container_name: nodered
build: ./services/nodered/.
restart: unless-stopped
user: "0"
privileged: true
environment:
- TZ=Etc/UTC
ports:
- "1880:1880"
volumes:
- "./volumes/nodered/data:/data"
- "/var/run/docker.sock:/var/run/docker.sock"
- "/var/run/dbus/system_bus_socket:/var/run/dbus/system_bus_socket"
devices:
- "/dev/gpiomem:/dev/gpiomem"
- "/dev/ttyAMA0:/dev/ttyAMA0"
- "/dev/vcio:/dev/vcio"
networks:
- iotstack_nw
logging:
options:
max-size: 5m
max-file: "3"
networks:
iotstack_nw:
name: IOTstack_Net
# external: true
driver: bridge
ipam:
driver: default
config:
- subnet: 10.77.60.0/24
Code: Select all
2021-04-07 11:21:26.864 Broadlink hardware started.
2021-04-07 11:21:26.864 Status: Broadlink: (Broadlink) Entering work loop.
2021-04-07 11:21:26.864 Status: Broadlink: (Broadlink) Started.
2021-04-07 11:21:27.940 Error: Broadlink: (Broadlink) failed to load 'plugin.py', Python Path used was '/opt/domoticz/userdata/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'.
2021-04-07 11:21:27.940 Error: Broadlink: (Broadlink) Module Import failed, exception: 'ModuleNotFoundError'
2021-04-07 11:21:27.940 Error: Broadlink: (Broadlink) Module Import failed: ' Name: broadlink'
2021-04-07 11:21:27.940 Error: Broadlink: (Broadlink) Error Line details not available.
Re: Python Plugin : Broadlink
Posted: Friday 09 April 2021 14:57
by pvklink
Almost There, to get domoticz and broadlink to work in docker !
Errors loading
1. RUN python3 -m pip install translate
# Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-_kLfE0/lxml/
2.RUN python3 -m pip install python-broadlink-master
# Could not install packages due to an EnvironmentError: 404 Client Error: Not Found for url:
https://pypi.org/simple/python-broadlink-master/
All the other parts went well :_)
Code: Select all
FROM domoticz/domoticz:latest
USER root
RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y -q build-essential\
wget \
zip \
unzip \
git \
python3-pip \
python3.7 \
libpython3.7/*
RUN python3 -m pip install setuptools
RUN python3 -m pip install wheel
RUN python3 -m pip install googletrans
RUN python3 -m pip install --upgrade setuptools
RUN python3 -m pip install translate
# Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-_kLfE0/lxml/
# solution : pip install --upgrade setuptools werkt dus ook NIET
RUN python3 -m pip install requests
RUN python3 -m pip install requests_toolbelt
RUN python3 -m pip install irgen
RUN python3 -m pip install python-broadlink-master
# Could not install packages due to an EnvironmentError: 404 Client Error: Not Found for url: https://pypi.org/simple/python-broadlink-master/
# VOLUME ["/opt/domoticz/scripts", "/opt/domoticz/backups", "/opt/domoticz/db", "/opt/domoticz/plugins", " /opt/domoticz/www/images/floorplans", " /opt/domoticz/www/templates"]
EXPOSE 8080 9440 9000
RUN mkdir -p /opt/domoticz/plugins
RUN cd /opt/domoticz/plugins && wget http://192.168.20.48:80/downloads/broadlink.zip && unzip -q broadlink.zip && rm broadlink.zip
# start python script !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# CMD [ "python", "/opt/domoticz/plugins/Broadlink/setup.py" ]
RUN chmod -R 755 /opt/domoticz/plugins/Broadlink
# Start domoticz
# CMD ["/opt/domoticz/domoticz"]
Re: Python Plugin : Broadlink
Posted: Friday 09 April 2021 22:54
by zak45
Maybe put full path for :
RUN python3 -m pip install python-broadlink-master
something like that :
RUN python3 -m pip install /folder1/folder2/../python-broadlink-master
Re: Python Plugin : Broadlink
Posted: Friday 09 April 2021 23:17
by pvklink
Ok, this below version gives no errors...

i used the image that has the latest (daily) beta: domoticz/domoticz:latest
- i can add the broadlink in the hardware tab, but after add it and commit it, there must be an option visible for turning loggin of the plugin on etc.
That part of the plugin does not show up?
I got no errors in the log on my volume share, domoticz works, only broadlink works not, and no port 9000
Anybody suggestions?
Code: Select all
FROM domoticz/domoticz:latest
USER root
RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y -q build-essential\
wget \
zip \
unzip \
git \
python3-pip \
python3.7 \
python3-lxml \
libpython3.7/*
RUN python3 -m pip install setuptools
RUN python3 -m pip install wheel
RUN python3 -m pip install googletrans
RUN python3 -m pip install -U pip
RUN pip install --upgrade setuptools
RUN python3 -m pip install translate
RUN python3 -m pip install requests
RUN python3 -m pip install requests_toolbelt
RUN python3 -m pip install irgen
# VOLUME ["/opt/domoticz/scripts", "/opt/domoticz/backups", "/opt/domoticz/db", "/opt/domoticz/plugins", " /opt/domoticz/www/images/floorplans", " /opt/domoticz/www/templates"]
EXPOSE 8080 9440 9000
RUN mkdir -p /opt/domoticz/plugins
RUN cd /opt/domoticz/plugins && wget http://192.168.20.48:80/downloads/broadlink.zip && unzip -q broadlink.zip && rm broadlink.zip
# trials
# RUN python3 -m pip install python-broadlink-master
# RUN python3 -m pip install /opt/domoticz/plugins/Broadlink/python-broadlink-master/setup.py
# Could not install packages due to an EnvironmentError: 404 Client Error: Not Found for url: https://pypi.org/simple/python-broadlink-master/
RUN chmod -R 755 /opt/domoticz/plugins/Broadlink
CMD [ "python", "/opt/domoticz/plugins/Broadlink/python-broadlink-master/setup.py" ]
# start python script
CMD [ "python", "/opt/domoticz/plugins/Broadlink/setup.py" ]
# Start domoticz
CMD ["/opt/domoticz/domoticz"]
Re: Python Plugin : Broadlink
Posted: Tuesday 20 April 2021 11:28
by pvklink
Here a first start for a Dockerfile-example for broadlink in a separate container
Code: Select all
FROM ubuntu:18.04
LABEL maintainer="a@a"
ENV PYTHONIOENCODING=utf-8
#install pip3
RUN apt update
RUN apt install python3-pip libffi-dev fping libssl-dev --yes
RUN pip3 install flask flask_restful loguru cryptography==2.6.1 --no-cache-dir
#Create working directory
RUN mkdir /opt/broadlinkmanager
RUN mkdir /opt/broadlinkmanager/data
EXPOSE 9000
COPY broadlinkmanager /opt/broadlinkmanager
ENTRYPOINT ["/usr/bin/python3", "/opt/broadlinkmanager/broadlinkmanager.py"]
Re: Python Plugin : Broadlink
Posted: Tuesday 20 April 2021 16:24
by gizmocuz
@pvklink,
Interesting development.... I was just trying to get this working with docker... .... and failed
Have you got it working ? Do you have a git repository with all needed files ?
Re: Python Plugin : Broadlink
Posted: Tuesday 20 April 2021 17:14
by pvklink
No., all on my RPI... no problem in showing it to you ... by teams, skype ?
Ofcoure you can receive everything i got!

I do not have broadlink working in a docker, rest i have working ...
You can PM me!
Re: Python Plugin : Broadlink
Posted: Thursday 22 April 2021 13:21
by gizmocuz
Thanks! Send you an email
Re: Python Plugin : Broadlink
Posted: Monday 26 April 2021 23:01
by Skwi
Hi, I had this plugin running fine on my synology until now : I updated the syno package python and now the plugin won't start :
2021-04-26 20:59:09.967 Error: (Broadlink) failed to load 'plugin.py',
Python Path used was '/usr/local/domoticz/var/plugins/Broadlink/:/var/packages/py3k/target/usr/local/lib/python38.zip:/var/packages/py3k/target/usr/local/lib/python3.8:/var/packages/py3k/target/usr/local/lib/python3.8/lib-dynload:/var/packages/py3k/target/usr/local/lib/python3.8/site-packages'.
2021-04-26 20:59:09.967 Error: (Broadlink) Module Import failed, exception: 'ModuleNotFoundError'
2021-04-26 20:59:09.967 Error: (Broadlink) Module Import failed: ' Name: broadlink'
2021-04-26 20:59:09.967 Error: (Broadlink) Error Line details not available.
2021-04-26 20:59:59.027 Error: Broadlink hardware (20) thread seems to have ended unexpectedly
When I run python -V => Python 2.7.12, but I also have python3 -V => Python 3.8.6
I remember I had to modify the setup.py to put python3 everywhere to get it work, and couldn't find how to tell my synology to use python3 when using "python"
Domoticz is running with Python Version: 3.8.6. (version compiled with python by jadahl)
So I don't get why I have to use the "domoticz python version" and when the python on the OS changes, it brokes domoticz.
Re: Python Plugin : Broadlink
Posted: Wednesday 28 April 2021 10:14
by pvklink
thats why dockers are invented........
Re: Python Plugin : Broadlink
Posted: Thursday 29 April 2021 23:59
by Skwi
I installed it on docker today, but I had to launch if from the container console. Thus, I had to remove the "sudo" at some places in the setup.py and that works fine. I also had to create the log folder manually and replace the old path with the new one in the .ini