Info: do not use the official app if using broadlink library see https://github.com/mjg59/python-broadlink/issues/377
note: pip need to be installed (for linux users: sudo apt install python3-pip)
To be able to see the Web Pages, Custom menu need to be activated: Domoticz / settings / user.
Be sure that your active python version is > 3.4 (Change python version system-wide) this mean: python --version ( or sudo python --version for linux users) should give output e.g. python 3.x.x and not python 2.x.x see this link https://www.domoticz.com/wiki/Using_Python_plugins or this one : https://linuxconfig.org/how-to-change-from-default-to-alternative-python-version-on-debian-linux
Features:
Multi-Language Multi-Devices (MP1 / A1 / SP1-2-3 / RM2-3 Pro & mini / RM4 Pro & mini Web Admin page RF is now managed Multi-code ini file creation by drag & drop Create Broadlink ini from Pronto Hex Create ini from e-Control Modify number of repetition (do and test with caution) Import feature Send code with a simple URL and more .....
Installation :
create Broadlink directory under your Domoticz/plugins folder. download setup.py from here : https://raw.githubusercontent.com/zak-45/Broadlink-Domoticz-plugin/main/setup.py and put it into Broadlink directory.
Open a terminal session, go to Broadlink directory and execute this command : python setup.py (tested on Windows with admin right, maybe need sudo on linux e.g; : sudo python setup.py)
Provide response to questions. Restart Domoticz. Create a new hardware, type : Broadlink with Kodi Remote
Manual installation: download all files from provided link to the Broadlink directory. install these required modules:
[ 'cryptography==40.0.0', 'broadlink==0.18.3', 'setuptools', 'wheel', 'googletrans', 'translate', 'requests', 'requests_toolbelt', 'irgen']
and do not forget to put executable file under Broadlink/scr ( chmod +x )
WebAdmin Page overview:
For Devlopers: this is the port necessary to use MS visual debugger
--> main py : plugin.py Domoticz.Log('Waiting for MS Visual Studio remote debugger connection ....') ptvsd.enable_attach(address=('0.0.0.0', 5678))
--> subprocess : Dombroadlink.py ptvsd.enable_attach(address=('0.0.0.0', 6789))
module ptvsd need to be installed.
Lets try and play with it. Provide bugs/feedback here. https://www.domoticz.com/forum/viewtopic.php?t=33223
Enjoy !!
test platform : Windows 10 Version: 2020.2 (build 12120) Build Hash: ecd90cd57 Compile Date: 2020-06-04 20:50:42 dzVents Version: 3.0.9 Python Version: 3.7.5 (tags/v3.7.5:5c02a39a0b, Oct 14 2019, 23:09:19) [MSC v.1916 32 bit (Intel)]
A simple Python API for controlling IR/RF controllers from Broadlink. At present, the following devices are currently supported:
There is currently no support for the cloud API.
Setup a new device on your local wireless network:
import broadlink
broadlink.setup('myssid', 'mynetworkpass', 3)
Discover available devices on the local network:
import broadlink
devices = broadlink.discover(timeout=5)
Obtain the authentication key required for further communication:
devices[0].auth()
Enter learning mode:
devices[0].enter_learning()
Sweep RF frequencies:
devices[0].sweep_frequency()
Cancel sweep RF frequencies:
devices[0].cancel_sweep_frequency()
Check whether a frequency has been found:
found = devices[0].check_frequency()
(This will return True if the RM has locked onto a frequency, False otherwise)
Attempt to learn an RF packet:
found = devices[0].find_rf_packet()
(This will return True if a packet has been found, False otherwise)
Obtain an IR or RF packet while in learning mode:
ir_packet = devices[0].check_data()
(This will return None if the device does not have a packet to return)
Send an IR or RF packet:
devices[0].send_data(ir_packet)
Obtain temperature data from an RM2:
devices[0].check_temperature()
Obtain sensor data from an A1:
data = devices[0].check_sensors()
Set power state on a SmartPlug SP2/SP3:
devices[0].set_power(True)
Check power state on a SmartPlug:
state = devices[0].check_power()
Check energy consumption on a SmartPlug:
state = devices[0].get_energy()
Set power state for S1 on a SmartPowerStrip MP1:
devices[0].set_power(1, True)
Check power state on a SmartPowerStrip:
state = devices[0].check_power()
This is a command line interface for broadlink python library
Tested with BroadLink RMPRO / RM2
You should have the broadlink python installed, this can be made in many linux distributions using :
sudo pip install broadlink
Just copy this files
Using separate parameters for each information:
broadlink_cli --type 0x2712 --host 1.1.1.1 --mac aaaaaaaaaa --temp
Using all parameters as a single argument:
broadlink_cli --device "0x2712 1.1.1.1 aaaaaaaaaa" --temp
Using file with parameters:
broadlink_cli --device @BEDROOM.device --temp
This is prefered as the configuration is stored in file and you can change just a file to point to a different hardware
Learn commands :
# Learn and save to file
broadlink_cli --device @BEDROOM.device --learnfile LG-TV.power
# LEard and show at console
broadlink_cli --device @BEDROOM.device --learn
Send command :
broadlink_cli --device @BEDROOM.device --send @LG-TV.power
broadlink_cli --device @BEDROOM.device --send ....datafromlearncommand...
Get Temperature :
broadlink_cli --device @BEDROOM.device --temperature
Get Energy Consumption (For a SmartPlug) :
broadlink_cli --device @BEDROOM.device --energy
Once joined to the Broadlink provisioning Wi-Fi, configure it with your Wi-Fi details:
broadlink_cli --joinwifi MySSID MyWifiPassword