Skip to main content

Posts

Showing posts from April, 2018

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…

Extract temperature from Fibaro HCL to Homekit Room

For Apple mobile users who want to know the temperature of a room in Apple home using a temperature sensor from Fibaro HCL

Automation Flow:

Aeotec light/temp sensor > Fibaro HCL > bash script >; Domoticz virtual device > homebridge/homekit


Setup Steps

Step 1. Create a temperature virtual device in Domoticz and take note of the device id.

Step 2. Create a bash file with the following script, replacing the XX and user:password fields.


#!/bin/bash
status=/home/pi/scripts/temperature
domo_idx=XX
fib_idx=XX

curl "http://user:password@XX.XX.XX.XX/api/panels/temperature?type=devices&method=single&id="$fib_idx > $status
temperature=`cat $status |  sed 's/[{}]//g' |  awk -F : '{print $3}' | awk -F , '{print $1}'`

curl "http://XX.XX.XX.XX:8080/json.htm?type=command&param=udevice&idx="$domo_idx"&nvalue=0&svalue="$temperature


Step 3. Create a cron entry to run this script every 5 or 10 mins (temperature doe…

Home Automation High Level Components

Maybe to put more context into the previous post of a slow build out of home automation components, here's a big picture integration diagram on how everything works together to date.




User Interaction

Mobile AppsVoice CommandsCloud Services

Integration Components
Home Automation BridgesDomoticzMQTTScripts (Python, Bash, LUA, etc.)
Connectivity Methods
Z-Wave (Fibaro)Zigabee (Philips Hue)Sonos wireless meshWifi and LANBluetooth Low Energy (BLE)Infra-red
Automation Devices
Lights, Smart DimmersSmart Power plugsTemperature, humidity and light sensorsDoor sensorsCamerasNetwork speaker systemSmart TVAir-Conditioners / Thermostats

Use Homekit to control Fibaro HCL Z-Wave Dimmer

Home Automation Flow

Siri > Homebridge > Domoticz (LUA) > Fibaro HCL > Aeotec Nano Dimmer

Assume that Homebridge, Domoticz and Fibaro is already setup. The homebridge config.json file should have a room reference to avoid Homekit showing all devices

{
    "bridge": {
        "name": "Homebridge",
        "username": "CC:21:3E:E4:DE:33",
        "port": 51826,
        "pin": "031-45-154"
    },
    "description": "Configuration file for (e)xtended Domoticz platform.",
    "platforms": [
        {
            "platform": "eDomoticz",
            "name": "eDomoticz",
            "server": "127.0.0.1",
            "port": "8080",
            "ssl": 0,
            "roomid": 2,
            "mqtt": 1
        }
    ],
    "accessories": [
    ]
}



Step 1. …