Skip to main content

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;

  • Domoticz
  • Fibaro
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 
  • Switches
    • Sockets (On/Off)
    • Motion Sensor
    • Contact Sensors
    • Lamps/Dimmer
  • Temperature
The full list is located here. https://github.com/PatchworkBoy/homebridge-edomoticz. Most devices will use the standard sockets device, i.e. On or Off. 

The "Ping test"  hardware devices that can be added to domoticz if you wish to check the status of the NAS or the TV or other ping-able device. Note that this does not apply to mobiles or iPhones which need a separate script to update the device status.

HomeBridge Updates

Add the device to the Homekit room and the device will automatically appear in Apple Home. I did not add a ping test device to homebridge directly, but add the actual virtual control device to homebridge and on the backend, use the ping test device to update the actual device.

For devices that I think needed to be on all the time, I can add notifications to when the ping goes down, e.g. if your NAS was turned off instead rather than have an extra icon in Apple Home.


Fibaro Updates

Once the devices are added to Domoticz, in Domoticz go to;

Setup > More Options > Data Push > Fibarolink
https://www.domoticz.com/wiki/FibaroLink

This will allow you to send a device state to a Fibaro label. It does not help update the global variable. You will need to create a Fibaro virtual device with a bunch of labels and name it correctly. These labels will be updated with the status of the Domoticz virtual device, e.g. On/Off.

This is probably the easiest way to be able back reporting if you prefer to use the Fibaro app which is much prettier than the domoticz app at this time. If you also like control buttons in Fibaro app, refer to the post on Fibaro virtual devices controlling Domoticz using HTTP commands.

Note, it's also possible to update Fibaro global variables where needed, this can't be done via FibaroLink, but should be easy enough to put into the On/Off action of the virtual device to call a script:/// to use the Fibaro API to update accordingly. I've not done this yet as so far, I haven't found a need for it.


Comments

Popular posts from this blog

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 …

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.

Restart Fibaro HCL when it stops working automatically

It seems that the Fibaro HCL seems to hang every now and then. Instead of trying to restart it regularly, which doesn't really work, as it's almost impossible to predict when this will happen.

This method checks that the HCL is actually running and in the event it stops working, trigger a script that will restart it.


1. Get a non Fibaro controlled power plug and scripts to control it.

I used a wifi smart plug, TP-link HS100 and downloaded the scripts from

https://blog.georgovassilis.com/2016/05/07/controlling-the-tp-link-hs100-wi-fi-smart-plug/

2. Create a bash script to restart the Fibaro, e.g. restart_fibaro.sh

#!/bin/bash

ip_addr=
scripts=

$scripts/tplink-smartplug.py -t $ip_addr -c off
sleep 10
$scripts/tplink-smartplug.py -t $ip_addr -c on


3. Create a test global variable in the Fibaro HCL

Go to the variables panel and create a test variable, e.g. Test


4. Add a cron entry to test that the Fibaro API is still working and restart if it's not.

The cron script is scheduled ev…