Friday, August 24, 2018

Multiple Broadlink RM mini 3 integration using MQTT

Broadlink now has quite a lot of integration options almost out of the box. If you enable Broadlink IHC, you can directly link it to Alexa by giving the device a unique name.

There is a homebridge plug in for homekit integration but I haven't tried or tested this. https://lprhodes.github.io/slate/

I wanted to put the device in domoticz so I can have more control over what can trigger my broadlink. I decided to use broadlink-mqtt for this, which is a fairly easy method to trigger from any source.

Setup Instructions for broadlink-mqtt

1. git clone https://github.com/eschava/broadlink-mqtt

2. vi /home/pi/broadlink-mqtt/mqtt.conf

3. Update the mqtt.conf file with the device type set as multiple_lookup

device_type = 'multiple_lookup'
mqtt_multiple_subprefix_format = '{type}_{mac_nic}/'

4. Start the python script and check that it started and detected all the RM devices.

Check the log file to see what the IP / MAC addresses are.
DEBUG Connected to RM2 Broadlink device at '192.168.1.101' (MAC 34:ea:34:01:01:01)
DEBUG Connected to RM2 Broadlink device at '192.168.1.102' (MAC 34:ea:34:00:00:00)


5. Record the IR command - substitute the 00_00_00 with the last 3 octets of the mac address for the device. (I haven't tried this yet, as I previously added my commands when I only had 1 RM mini)

mosquitto_pub -h 192.168.1.10 -t broadlink/RM2_00_00_00/aircon/off -m auto


6. Configure Domoticz virtual device to replay the IR command

If the MQTT IP address is 192.168.1.10, the following "On Action" can be used to turn on and off the broadlink virtual switch device created in Domoticz

script:///usr/bin/mosquitto_pub -h 192.168.1.10 -t broadlink/RM2_00_00_00/aircon/on -m auto
script:///usr/bin/mosquitto_pub -h 192.168.1.10 -t broadlink/RM2_00_00_00/aircon/off -m auto


Update to avoid python 2.7 errors, use python3.

$ sudo pip3 install paho-mqtt

and start by

$ python3 /home/pi/broadlink-mqtt/mqtt.py




Splitting the home network

Who wouldn't want to separate the traffic at home for security reasons. The more common ones include wireless guest and wireless users. ...