Sunday, November 19, 2017

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://github.com/softScheck/tplink-smartplug


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 every 5 mins and turns on and off the power to the HCL in 10 seconds when the Fibaro API does not respond.

Cron entry:

*/5 * * * * wget http://:@/api/globalVariables/Test --timeout 30 -O - 2>/dev/null  | grep "Test" || /home/pi/scripts/restart_fibaro.sh

Make sure to replace the following and for the Fibaro HCL

Sunday, May 14, 2017

Daikin FT aircon and Remotec ZXT 120

In the quest to make the existing appliances "smart" or otherwise enabling dumb devices to be even dumber with unnecessary initiative.

I got the reputed bad review Remotec ZXT 120. As I already expected it to be bad, my expectations were clearly exceeded.

This isn't the first attempt I've tried to get IR blasters to work. I vaguely remembered early attempts at trying to program the IR on my Palm 3 and Palm V. Needless to say, this went a lot better than expected.

Tip 1:

After reading the instructions first (rare occasion) , being a bit more careful. I discovered you need to change the mode of the Remotec first before joining the Z-wave bridge, in my case Fibaro. This is important as you cannot change the mode once connected. If you forget to do so, you need to exclude the device and do the setup again.


Tip 2:

The temperature is wrong.  Well, there is an offset that can be configured on the z-wave bridge. There is a parameter to allow for the offset. The short of it is that the thermostat is slow and inaccurate, but you can muck around with it until you get fairly average temp readings over a long averaged period which isn't that bad.

Tip 3:

I use a Daikin FT25DVM. The Remotec site have a serious number of codes for Daikin and I must have spent at least 2 hours trying codes in a tikam tikam approach. Noted not the best, hence I never got the code until I did a google and find a forum response of yet another pettson complaining about the Remotec and Daikin, But the silver lining was that he gave the code. Much thanks there.

It's Code 6 !!

If I did start from 1 and went on to the 2nd number instead  of jumping around, it might have been faster. I was also misled by the Fibaro HCL to say a soft reset is needed before the code is implemented, which was not true. You can just set the numbers in and save and it is immediately usable in the controls.

Actual Use

So I can now turn on my air-con from my phone in any room without any knowledge if it's actually on or not from a thermostat that might tell me an hour or so later. Is there any good stuff out of this? Now I can add the air-con to scenes for Alexa. So "Alexa, turn on sleep", it actually can turn on the AC. Just in time for hot weather when the Fan just isn't enough.


Saturday, April 15, 2017

Motion Lights using Philips Hue with Z-Wave Sensors


To work around the limitations of Fibaro HCL that does not allow you to use LUA scripts, Domotics fill that gap and allows you to use more than just Z-wave devices.

The major problem with using Hue with the HCL, is that the Hue API requires action via a HTTP PUT to change the state of the lights. The HCL only allows HTTP GET using the string method for Virtual Devices.

Domoticz allows you to add Hue directly as "Hardware" and automatically adds all the  bulbs and scenes as "Devices". To trigger the API to Domoticz, we use HTTP GET (yes, that is a Yay!!!).

Create a 2 button virtual device with the following string using the IP address and port of the Domoticz server

On button:

GET /json.htm?type=command&param=switchlight&idx=&switchcmd=On&level=0&passcode= HTTP/1.10x0D0x0A0x0D0x0A

Off  button:

GET /json.htm?type=command&param=switchlight&idx=&switchcmd=Off&level=0&passcode= HTTP/1.10x0D0x0A0x0D0x0A

When we create the new scene with the motion sensor being "breached", we can then select the On to link to the new Virtual Device.

Now for the vanity part where we can use Domotics FibaroLink to update the status of the virtual device label in Fibaro. This is best described in this link : http://www.vesternet.com/resources/application-notes/apnt-87#.WPHGlIh96Cg


.





Monday, April 03, 2017

Alexa, Turn on Computer

There is many ways to wake your computer up and put your computer to hibernate using Alexa.

I will use:

1. computer with cygwin enabled with sshd service
2. domoticz on a raspberry pi
3. ha-bridge on raspberry pi
4. Amazon echo

I'm more of a computer user than a developer, but I find that Domoticz is great as it helps non-developers download unix commands and allow a direct call to shell scripts.

More great things about Domoticz is that it convert HTTP POST to GET methods when you are using triggers that can't do POST to Philips Hue lights (I will cover that in another post)


Step 1: Setup a dummy hardware used for virtual switches



Step 2: Create a virtual sensor as a light switch called Computer

For the On script use:
script:///home/pi/domoticz/scripts/pc-wake.sh

The bash script should contain

#!/bin/bash
wakeonlan  BC:5F:F4:88:92:B6


For the Off script use:
script:///home/pi/domoticz/scripts/pc-hibernate.sh

This bash script contents are; (Replace X with the IP address of the computer)

#!/bin/bash
ssh user@192.168.1.X "shutdown /h" &


The off switch assumes you have an sshd service running on your computer with private keys installed on the raspberry pi with no password so it auto autenticates and runs without entering a password. Windows 10 command to hibernate is shutdown /h

You will need to google again to find out how to setup sshd, as it's too long to put into this post.


For ha-bridge to use this, add the domoticz command to Computer (Replace NN with switch ID, you can get this from the devices tab under the "Setup" drop down.

On
http://192.168.1.Y:8080/json.htm?type=command&param=switchlight&idx=NN&switchcmd=On

Off
http://192.168.1.Y:8080/json.htm?type=command&param=switchlight&idx=NN&switchcmd=Off


To use

Alexa, turn on computer
Alexa, turn off computer






Sunday, April 02, 2017

Alexa Turn On / Off TV


I have a Samsung LED smart TV. The "smart" TV let's you turn off the TV, but it doesn't let you turn it on as the IP address is not available when it's off.

That sort of makes sense.

While it is possible to then download a command to turn off the TV. you will need to go through the TV settings to enable HDMI-CEC. This means that turning on the apple TV for example will in turn turn on the TV and set the channel to Apple TV.


What you need.

1. Domoticz
2. iSamsung command (https://www.domoticz.com/wiki/Samsung_TV)
3. atvremote command (i took this from homeassistant)


Use Domoticz to create a dummy device and add a virtual selector device.




There are 4 buttons I programmed and here are the corresponding commands.

if your TV has the IP address 192.168.1.x (Replace x with the actual IP address of the TV)

To turn the TV off
script:///usr/local/bin/iSamsungTV 192.168.1.x -KEY KEY_POWEROFF

To use Apple TV to turn on the TV to Apple TV channel
script:///srv/homeassistant/bin/atvremote -a menu

To change the channel another HDMI input
script:///usr/local/bin/iSamsungTV 192.168.1.x -KEY KEY_HDMI

To change the channel to COMPONENT input
script:///usr/local/bin/iSamsungTV 192.168.1.x -KEY KEY_COMPONENT1


Now that we have Domoticz working, we need to add the buttons to ha-bridge for Alexa commands

For Domotics IP 192.168.1.y (Replace y) and switch ID is NN (Replace NN with the actual switch ID

To turn on the TV
http://192.168.1.y:8080/json.htm?type=command&param=switchlight&idx=NN&switchcmd=Set%20Level&level=10


to turn off the TV
http://192.168.1.y:8080/json.htm?type=command&param=switchlight&idx=NN&switchcmd=Set%20Level&level=0


To change the channel, we can create another ha-bridge device and just leave the turn on button for HDMI and Cable TV, respectively

http://192.168.1.y:8080/json.htm?type=command&param=switchlight&idx=NN&switchcmd=Set%20Level&level=20
http://192.168.1.y:8080/json.htm?type=command&param=switchlight&idx=NN&switchcmd=Set%20Level&level=30



To Use these command with Alexa, you can say this.

Alexa, Turn On TV (Defaults to Apple TV)
Alexa, Turn Off TV
Alexa, Turn On HDMI (does a round robin approach to HDMI surfing
Alexa, Turn On Cable TV (changes the channel to component which is my cable box)




Wednesday, March 29, 2017

Using bridges to integrate gaps

There are some great products out there, but some great products just don't connect to other great products out of the box.

Things that work Out of the box
1. Alexa with Hue
2. Homekit/Siri with Hue
3. Fibaro HCL to Sonos (limited features using plug in)


Things that can be bridged
1. Alexa to Fibaro HCL (ha-bridge)
2. Alexa to Sonos (ha-bridge + sonos-http-api)
3. Fibaro HCL to Hue for Automation Scenes (Domoticz)
4. Fibaro HCL to Sonos for Scene Automation (sonos-http-api)


Things that shouldn't be bridged
1. Alexa with Siri


Automation Management Control
1. Alexa for voice controls
2. Individual Fibaro, Hue and Sonos schedulers for alerts and alarms
3. IFTTT for integration with cloud services and email.
4. Fibaro for integrated scenes, e.g. door opens, lights come on and music start playing. Z-wave motion sensor triggers Hue light.



Restarting Home Automation

Many years ago, I attempted to embark on home automation. Those were the days of X-10 and honestly, a lot of effort to make simple things work. Needless to say, I didn't get very far and gave up pretty much early into the game to wait for more sustainable standards.

This year, I decided to go home automation shopping and picked up a bunch of the most popular / stable products off the shelf and add them to my semi smart home.

The whole setup now consists of

1. Alexa Echo and Echo Dot
2. Philips Hue Lights
3. Apple TV
4. Sonos (Playbar and sub (for TV), Play1 and a Play5)
5. Dlink NAS
6. Raspberry Pi
7. Bluetooth audio receiver
8. Fibaro Home Center Lite (HCL) Z-Wave Bridge and various Z-wave devices including
(i) Power Plug Switches with/without power metering
(ii) Door Sensor
(ii) Motion Sensor
9. Computer
10. Mobile phones

I also managed to hook up the old CCTV unit to the Fibaro HCL using polled extraction of JPEG.

After hooking it all up, the last couple of weeks have been really interesting with lights coming on at odd and devices refusing to turn on by Alexa. It does take a while to determine patterns to program behaviors accordingly.

As there was a lot of integration work that was done to have everything work together, I decided to start posting again. Stay tuned for home automation use cases and how to get it all working together.



Friday, January 04, 2013

is the PPC Mac still usable?

I'm back to using the PPC Macs again just for fun. Namely the G5 iMac 10.4 and recently donated G4 iBook 10.5.

The designs are quaint and with the right mix of software, can still be quite a usable computer. Most applications are on the internet (and I refrain from using the word "cloud").

 Optimised Firefox


So the first thing to do to make this computer usable is to get the "latest" and "optimised" browser which I downloaded from http://rpm-mozilla.org.uk


Media Player

If Quicktime isn't able to play a media file, I like VLC and you can still get a PPC version from their download page. Select the Universal version.

http://www.videolan.org/vlc/download-macosx.html



Remote Desktop Client

To use other applications and get more power, we probably have to connect to our main system.

We will need a remote desktop tool for that. We could use the standard VNC to another machine on the home network which is great. This feature is available from finder, you need to enable the "Connect" button with a right click on the top of the Finder window. Select "Customize Toolbar". If you don't have a right click, it's "Ctrl - click". Add the "Connect" button to the menu.

To connect to a VNC services type in "vnc://:", e.g. vnc://192.168.0.10:5901

Mapping a Network Storage - We can also use this to map to our NAS or file shares by "smb://:" e.g. smb://192.168.0.10/share

However if the server we want to access is far away and accessible via ssh, we can use use No Machine Client, the requirement is that you need X11 for it to work. (refer below)

http://www.nomachine.com/download-package.php?Prod_Id=3834


Useful Utilities for Geeks
  • Terminal
Need I say more?

  • X11
10.5 users can download from here. http://roundhere.net/journal/install-x11-on-mac-os-x-10-4-tiger-without-dvd/