Skip to main content

Posts

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 …
Recent posts

Installing Raspbian Stretch on a new Pi

My first pi is fully used and has hit production mode where it runs the house and I can't use it as a play toy anymore. It's running Jessie, which is super stable.

Guess to move on, I've got a 2nd pi which I've decided to put raspbian stretch and here are some notes of the install because it never really goes as planned.

After downloading and running raspi-config to region, etc. apt upgrade failed with hash sum mismatch using the default apt sources. I tried a few and what worked for me was:

deb http://mirror.rise.ph/raspbian/raspbian/ stretch main contrib non-free rpi

after apt-get upgrade worked, I went on to install java. I had some issues as well with  "Error: missing `server' JVM at `/usr/lib/jvm/java-8-openjdk-armhf/jre/lib/arm/server/libjvm.so'." which was fixed with

sudo apt-get purge openjdk-8-jre-headless
sudo apt-get install openjdk-8-jre-headless

sudo apt-get install openjdk-8-jre

Ok, moving on to some software, i prefer a manual installations si…

Displaying a common device status

Once everything is merged, the challenge will be to make sure all devices are reported to the correct status. There are 2 main stores of device state in my setup;

DomoticzFibaro Basically we want Domoticz to know the state of the Fibaro devices and also Fibaro to be able to know the state of the domoticz devices.
There shouldn't be 2 different master sources of data. As Domoticz seems to be the master controller and other devices, e.g. Philips hue is capable of updating the status in domoticz automatically and homebridge uses the domoticz plugin, I'm going with Domoticz as the master status and everything will just query domoticz for the state.
To do this, there need to be a virtual device for each appliance that will be have it's state reported. Domotics support all sorts of virtual device, the more common ones we will use is  SwitchesSockets (On/Off)Motion SensorContact SensorsLamps/DimmerTemperature The full list is located here. https://github.com/PatchworkBoy/homebridge…

Fibaro HCL Virtual Device Slider

How to setup Fibaro home center lite (HCL) slider for virtual devices.

As the Fibaro HCL does not support LUA. The question was how to update the number value of the slider to send to the HTTP string. Thanks to this site which is a really good reference https://www.vesternet.com/resources/application-notes/apnt-88/

The 2 use cases here are;

Sonos HTTP API Volume

To allow for volume control for all Sonos devices, add a virtual device with the IP address for SONOS HTTP API and specify the default port to 5005. Create Slider and put the following text into the string.

GET /volume/_sliderValue_ HTTP/1.10x0D0x0A0x0D0x0A


Domotiz Virtual Devices

GET /json.htm?type=command&param=switchlight&idx=XX&switchcmd=Set%20Level&level=_sliderValue_ HTTP/1.10x0D0x0A0x0D0x0A

Replace XX with the device ID.

HomeKit Outdoor Weather and Indoor Temperature

This post adds both outdoor temperature and indoor temperature to Apple Homekit.

Outdoor Weather / Temperature

Using homebridge-weather https://www.npmjs.com/package/homebridge-weather

Add the following weather accessory to the homebridge config.json

    "accessories": [
    {
      "accessory": "Weather",
      "apikey": "enter_your_own_key_here",
      "locationByCoordinates": "lat=your_lattitudelon=your_longitude",
      "name": "Weather"
    }
    ]


Indoor Temperature

I'm taking indoor temperature from the Fibaro HCL temperature sensor, i.e. Aeotec multi-sensor.

Option1: cron/bash file to extract temperature to load into Domoticz temperature device

In the earlier post, I created a batch file to extract the temperature via REST API from Fibaro HCL to upload to a domo device. Not the most graceful way to do it, but it old school and works.


Option 2: Create a MQTT temperature feed using node-r…

Automating Samsung MU6100 Series K

Finally upgraded to a new Samsung 4K TV and iSamsungTV stopped working. The good thing is that so have most people and there is a new app, samsungctlhttps://github.com/Ape/samsungctl which  allows command line interface to the TV using websocket, because everyone needs a to open a terminal window to change a channel.

I used this link to install samsungctl https://www.domoticz.com/wiki/Plugins/SamsungTV.html

Basically I needed to

sudo pip3 install samsungctlsudo pip3 install websocket-client

After the installation, I had some error messages, i.e. "AttributeError: 'numpy.ndarray' object has no attribute 'tobytes'", which was solved by; sudo pip3 install numpy --upgrade
The new TV can be turned on with WakeOnLAN now. This makes my Broadlink RM3 fairly redundant as the older Samsung wasn't able to turn on hence, I needed the IR blaster before.

Control Sonos outside your home using HomeKit

Applying the same concept as the Aeotec Dimmer for Homekit control, we can also use the Domoticz virtual dimmer to control the Sonos using node-sonos-http-api.

Homekit > Domoticz Virtual Dimmer (LUA) > node-sonos-http-api > Sonos

I'm starting to derive a shorter version of the LUA script for easier maintenance and using the base On and Off action commands on Virtual Device configuration page. Replace the IP address with the raspberry pi running node-sonos-htttp-api.

Virtual Device Name SonosOne_Volume

Action On Command: http://192.168.1.XX:5005/Sonos%20One/play
Action Off Command: http://192.168.1.XX:5005/Sonos%20One/pause


LUA script

/home/pi/domoticz/scripts/lua/script_device_SonosOne_Volume.lua


commandArray = {}

DEV='SonosOne_Volume'

if otherdevices[DEV] == 'Off' then
        os.execute('curl "http://192.168.1.XX:5005/Sonos%20One/pause"')
else
        Level = otherdevices_svalues[DEV]
        os.execute('curl "http://192.168.1.XX…