Category Archives: Misc

Smart Christmas Baubles

Thanks to Gosse Adema and his instructable, I’ve also created smart Christmas baubles.

I currently have 3 baubles that I’ve connected to Home-Assistant, and I made some amendments to Gosse’s code to add MQTT Support (inspiration and code taken from corbanmailloux.)

You can get a copy of my code on my github page.

Here are some pics of my baubles:

Bauble1

Bauble1

Bauble2

Bauble2

Bauble3

Bauble3

Merry Christmas 🙂




Back-lit House Number

After the TV cabinet and the staircase, I got a new house number an LED treatment. Using the same H801, I glued a small piece of LED strip on the back of each number and set it in Home-Assistant to come up at dusk and switch off at midnight. I also set the colour to change through the colour spectrum so it’s less boring ?

LED House Number

LED House Number

Since the picture was taken I’ve removed the “old” number 40 beside the doorbell…




Xiaomi Mi Robot Vacuum

I have finally purchased a robotic vacuum cleaner. After much time trying to get the best smart / connected automated vacuum cleaner for my money, I opted for the Xiaomi Mi Robot Vacuum.

Xiaomi Mi Robot Vacuum

Xiaomi Mi Robot Vacuum

I have to say it’s excellent at navigating through the house in each and every nook it can get into, yet not once has it got stuck somewhere.

And the app is pretty good in telling you what the vacuum has done as well as sending you notifications (if you want) each time something happens (e.g. start cleaning, completed, main brush stuck, etc.)

Xiaomi Cleaning House Map

Xiaomi Cleaning House Map

The best part though is that in addition to controlling the vacuum from the Xiaomi app, it can also be integrated into Home-Assistant:

Xiaomi on Home-Assistant

Xiaomi on Home-Assistant

Clicking the button will simply start vacuuming.

I then created a simple automation to initiate the cleaning on specific days/time IF I’m not home.

If only I could also automate emptying the vacuum bin…




How to choose the right CCTV Security Camera

Having trialled “DIY” cameras (using a Webcam taped to the window, or a smartphone taped to the window), I am now looking for a proper solution for my CCTV needs.

I have spent a fair amount of time looking at various cameras and options, and I thought I’d share my findings in case someone else finds it useful.

Points to consider when buying a CCTV camera:

  1. IR Cut Filter
    1. You probably need a camera with an IR Cut Filter to cut IR light during day time, see below the difference.
    2. Some colours are more prone to becoming purple without an IR Cut filter
  2. Lens Size
    1. The biggest problem with CCTV installations is that the wrong lens is chosen. This normally results in people being too small to recognise and with CCTV pictures only being around 40k each, and not the 10 million you get on your photo camera, you cannot electronically zoom in. To be able to recognise a 1.7m person on a standard* CCTV system they must be at least 50% height of screen.
    2. Use the below links to calculate the lens size, or get a vari-focal camera that allows you to adjust the lens size.
      1. http://www.cctv-information.co.uk/i/Choosing_the_Wrong_Lens
      2. http://polarisusa.com/lens-calculator
      3. https://www.pelco.com/partners/tools-calculators/camera-lens-field-of-view-calculator-fov
  3. Resolution
    1. If you want to catch someone’s face or be able to read a number plate, you’ll need a higher resolution, especially if what you’re pointing at is far. Note however that the higher the resolution, the bigger storage space you’ll need. Realistically you’d need at least a Full HD camera so probably looking at a minimum of 2 or 3MP camera.
  4. Position
    1. If you plan on setting your cameras outside, you need to make sure they will withstand the elements. Look for IP66 rated camera
    2. The next thing to consider is how you’re going to power your camera. Even if you were to opt for Wireless cameras (I strongly recommend you don’t), they still need to be powered. I’m opting for a POE (Power Over Ethernet) camera. This means the camera is powered by the network cable, thus saving me having to run power cables to the camera (and sorting loads of extra sockets in a safe place). It also means it’ll reduce interferences due to the data and power cable being potentially too close to each other.
  5. Form Factor
    1. Do you want a dome or bullet form factor?
      Dome is less likely to be knocked off by a burglar (esp. vandal proof versions). Another positive point is that wind won’t make it shake. However depending on the installed position, you may see rain drops that would trigger motion detection. My personal reason though is you won’t see cob web on your videos during night recordings (Spiders have a knack for putting webs on Bullet CCTVs because they generate a bit of heat and are usually nicely placed to catch flies)
  6. PTZ Cameras (Pan-Tilt-Zoom)
    1. These are nice as you can manually change where the camera points at, but realistically you’d either need a compatible application that will control the PTZ movement based on motion detection, or need to set the camera so that it constantly pans back and forth. Personally I can’t see the extra price justification for this unless you have a very wide area to monitor
  7. Night monitoring
    1. Depending on where you want to monitor, if you need night vision you can either chose a camera with IR LEDs (giving you a black and white picture at night), purchase a separate IR flood light (meaning you only buy a standard camera, the IR flood light will provide night IR light based on a photo sensor or movement sensor (PIR). You can always get a regular flood light that will just switch on with movement. LED ones are a bit more pricey but save you money on the long run as they need less power, this is especially interesting if you’re pointing at a busy area like kerb in town
  8. Wireless or Networked, POE?
    1. I personally would not recommend WiFi cameras. They are prone to signal drops and interferences, meaning you’ll end up with green squares / lines every so often which could come at a crucial moment. They can also be hacked or at least made inefficient if targeted by a Wifi jammer/scrambler.
    2. In addition, you will most likely have to drill a hole through the wall if the camera is fixed outside, you may as well run a network cable. If indeed the camera is placed outside, the power adapter connector can be much bigger than the cable itself, requiring a fairly big hole to pass it through.
    3. With this in mind it’s better to opt for a POE (Power Over Ethernet) camera and your hole is the diameter of your cable (you cut the cable to pass it through, then crimp a network connector to plug into the camera). POE will mean a single cable providing power and network connection. It does require a POE switch or at least a POE injector. Depending on how many cameras your setup will be made of, a POE switch might make more commercial sense.
  9. Where to record the videos?
    1. While many CCTV providers and website will try and sell you an NVR (Network Video Recording) device, I personally opted for a camera with a built-in SD card. The video gets recorded on the SD Card, thus decluttering the network and removing potential bottlenecks, while remaining accessible via the network. It also means that should the worst happen, it’s unlikely that the evidence will be stolen: it’s easy to take the NVR box away, much harder to climb up the wall, open the camera and get the SD out or take the camera altogether.
    2. And before you ask, a decent camera will reuse the card once filled, so you don’t run out of space, meaning once the card is full, the older video is deleted to make space for the newer one. The amount of videos recorded (or how far back in time you can go) is only limited by the size of the SD camera. I find my  128GB SD Card on my 4MP camera gives me ~1 month worth of data when only recording motion detected videos (e.g. no 24/7).
    3. You can still use the camera feed for live monitoring. And since most recent cameras offer dual channel, you can use the full resolution to record on the SD card and use a lower resolution for live monitoring so once again you don’t use all your network bandwidth.
  10. Which software to use?
    1. Well this is the million dollar question. Depending on where you save the videos, you may have to use the camera manufacturer’s software (usually browser based application) or you can use third party application that take the video feed in and then perform analysis on it (like motion detection, face recognition etc.). Some manufacturers will also provide an app for your smartphone. I personally use motion which is a good free Linux application. And with a simple web page, you can have a live feed on you computer or smartphone. There are plenty of alternative software options out there if “motion” is not your cup of tea.
  11. Additional guides on how to choose a CCTV based on your needs
    1. http://topcctvcameras.co.uk/buyers-guide-home-cctv-cameras-2015/
    2. http://www.wikihow.com/Choose-a-Suitable-Security-Camera



LED Strip Lights

For a while now I’ve been wanting to add some LED Strips to my setup.

I wanted to get colour changeable strips that I could remotely control via DomotiGa.

I ended up getting 2 controllers based on the customisable H801 chip from AliExpress:

H801

H801

The downside is that I needed an Android Phone to set it up (Connect to my WiFi network), but once done, I no longer need the Android Phone.

In the future I’ll update the firmware to customise it and make it more secure, but for now it works relatively easy.

With advice taken from this post, I managed to create a simple script to send commands to the controller:

sendip -p ipv4 -is 192.168.4.15 -p udp -us 30978 -ud 30977 -d 0xfbeb000000000079979d00 -v 192.168.4.131
  • The first IP address is the address the command is sent from
  • The second IP address is the address of the H801 controller
  • The actual command is made of several parts: 0xfbeb 0000000000 79979d 00:
    • 0xfbeb is constant
    • Next come the hex values for the colours R G B W1 W2 (0000000000)
    • Then comes part of the controller’s MAC Address, in reverse order. The MAC Address is 18:fe:34:9d:97:79
    • The last bit (00) is again constant

This simple method allows me to easily switch the strip on and off and change its colour, and the results are quite impressive:

LED Strip Under TV Cabinet

LED Strip Under TV Cabinet

LED Strip Staircase

LED Strip Staircase

 

Because I have 2 controllers, I wanted to use a single script and parse as an argument the controller number that I wanted to communicate with.

The end result is the below script:

#!/usr/bin/python
# -*- coding: utf-8 -*-

import time
import sys
import subprocess

LEDStripBase="echo PASSWORD | sudo -S sendip -p ipv4 -is 192.168.0.24 -p udp -us 30978 -ud 30977 -d 0xfbeb"
LEDStrip1="000063509900 -v 192.168.0.40 > /dev/null"
LEDStrip2="000091559900 -v 192.168.0.41 > /dev/null"
# Kill the Xmas script if running
cmd="echo PASSWORD | sudo -S pkill -9 -f LEDStripXmas"
ps = subprocess.Popen(cmd, shell=True)
time.sleep(0.1)

if(len(sys.argv[2])==1):
	MyParam2 = "0" + hex(int(sys.argv[2]))[2:]
else:
	MyParam2 = hex(int(sys.argv[2]))[2:]

if(len(sys.argv[3])==1):
	MyParam3 = "0" + hex(int(sys.argv[3]))[2:]
else:
	MyParam3 = hex(int(sys.argv[3]))[2:]

if(len(sys.argv[4])==1):
	MyParam4 = "0" + hex(int(sys.argv[4]))[2:]
else:
	MyParam4 = hex(int(sys.argv[4]))[2:]

try:
	if(sys.argv[1] == '1'):
		cmd = LEDStripBase + MyParam2 + MyParam3 + MyParam4 + LEDStrip1
		ps = subprocess.Popen(cmd, shell=True)
	if(sys.argv[1] == '2'):
		cmd = LEDStripBase + MyParam2 + MyParam3 + MyParam4 + LEDStrip2
		ps = subprocess.Popen(cmd, shell=True)

except:
	pass

Note: I only soldered the RGB and Vcc pins as I’m not looking to use the white channels, hence the hard coded 0000 in the above script

All I need to do now to change the colour [to purple on the 1st controller) is to call the script as follows:

LEDStrip 1 255 0 255

 

Now to take it to the next level, I created a separate script to slowly run through the colour spectrum. I mainly run it at Christmas so called it LEDStripXmas.py (hence the command in previous script to kill this one if running):

#!/usr/bin/python
# -*- coding: utf-8 -*-

import time
import sys
import subprocess

LEDStripBase="echo PASSWORD | sudo -S sendip -p ipv4 -is 192.168.0.24 -p udp -us 30978 -ud 30977 -d 0xfbeb"
LEDStrip1="000063509900 -v 192.168.0.40 > /dev/null"
LEDStrip2="000091559900 -v 192.168.0.41 > /dev/null"

colors=[255,0,0]
while(True):
	# Cycle through RGB Spectrum
	colors[0]=255
	colors[1]=0
	colors[2]=0
	for decColour in range(0,3,1):
		if(decColour == 2):
			incColour = 0
		else:
			incColour = decColour + 1
		for i in range(0,255,1):
			colors[decColour] = colors[decColour] -1
			colors[incColour] = colors[incColour] +1
			R = hex(colors[0])[2:]
			if(len(R)==1):
				R = "0" + R
			G = hex(colors[1])[2:]
			if(len(G)==1):
				G = "0" + G
			B = hex(colors[2])[2:]
			if(len(B)==1):
				B = "0" + B
			if(sys.argv[1] == '1'):
				cmd = LEDStripBase + R + G + B + LEDStrip1
			else:
				cmd = LEDStripBase + R + G + B + LEDStrip2
			ps = subprocess.Popen(cmd, shell=True)
			time.sleep(0.1)

For the below movie, I’ve reduced the wait time (normal cycle takes about 1 min)

I then added the strips as devices in DomotiGa.

They are added as virtual devices, with Value1 being the strip’s status (on|off) and values 2,3,4 carrying the decimal value of the R G B colours respectively:

LED Strips - DomotiGa

LED Strips – DomotiGa

Then all I had to do is to call an action when one of the values of the device changes:

LEDStrip.py 1 <$188|2$> <$188|3$> <$188|4$>

And finally in SmartVISU I added a device:

LED Strip SmartVisu

LED Strip SmartVisu

Clicking on the colour brings the colour picker:

ED Strip SmartVisu Colour Picker

ED Strip SmartVisu Colour Picker




Repurposing an old LCD TV into an interactive wall calendar

Now that I’ve upgraded the living room TV, I’ve moved my old 42” Plasma into our bedroom and I’m now left with a spare 22′ LCD TV.

Until now we had an old school paper wall calendar, mainly for birthdays and anniversaries, but let’s be honest we don’t look at it that often as it’s pretty much static (albeit with the monthly page flip)

I’ve stumbled upon DAKBoard and decided to repurpose my old tv into an interactive wall Calendar.

It’s free to sign up and create your own dashboard. I set up a family calendar in Google, set my location for the weather, and changed the picture setting to pull the live feed from my CCTV.

First I bought a Raspberry Pi Zero W as the “brain” of the new calendar. It would really only be opening the DAKBoard site and that’s pretty much all. No need for a big Raspberry Pi.

Then I installed Raspbian Jessie on it, mounted it so I could edit the WiFi settings thanks to David Maitland’s post. (I have no micro USB to USB adapter so no way of interacting with the Raspberry Pi other than via WiFi, which needs setting up manually).

Once connected to WiFi, I SSH’ed on it to setup the usual VPN (I use TightVNC, not the built in VNC server) and Samba.

Now it’s time to set up DAKBoard to open automatically at startup:

  1. Edit /home/pi/.config/lxsession/LXDE-pi/autostart and add this line. (replace ########### with the key from DAKBoard under Account):
    @chromium-browser --disable-session-crashed-bubble --disable-infobars --incognito --kiosk http://dakboard.com/?p=###########

     

  2. install unclutter to hide the mouse:
    sudo apt-get install unclutter

     

  3. Disable screen blanking so the TV always shows the dashboard:
    sudo nano /etc/lightdm/lightdm.conf

    insert the below line in the [SeatDefault] block:

    xserver-command=X -s 0 dpms

     

  4. Disable the screensaver
  5. I then use DomotiGa and one of my LightWaveRF sockets to switch the TV on and off based on motion detection on my PIR
DAKBoard

DAKBoard

In the future I might look into dismantling the TV to get it to fit into a custom frame as per this instructable

[17th March 2017]

If you also plan on using VNC, there’s a chance that DAKBoard launched on the VNC display and not the HDMI display. If that’s the case, stop VNC from starting automatically. With my setup I set:

sudo systemctl disable [email protected]

(see this post for more info on how to setup TightVNC)

Then I simply added a line in /home/pi/.config/lxsession/LXDE-pi/autostart :

@nohup vncserver :1

 




Controlling a Sky+HD box

Now that I can reasonably control my TV and my AV Amplifier, I wanted to check whether I could also control my Sky+HD box for further automation (e.g. switch the box off if I switch the TV Off).

Sky+HD Box

Sky+HD Box

After little research I stumbled upon a repository from dalhundal that could do almost exactly that. Only issue at the moment is that this is pretty much a one way function, just like using a physical remote control: I can send commands but don’t receive a status back.

I then added a simple Shell Actions in DomotiGa to send the on/off command:

sky-remote-cli 192.168.0.40 power

and the TV Guide button:

sky-remote-cli 192.168.0.40 tvguide

 

Next step is to look at this page to see if I can retrieve the box’s status.

[2018-03-02 edit]

Above link doesn’t appear to move too much and I found a workaround. Check this page for more…




Onkyo TX-NR656 AV Amplifier

With the recent TV upgrade (see this post) I also upgraded my AV Amplifier.

My old Denon was nice but without any HDMI port, it means I needed lots of cables, and I had an issue with the central speaker channel: I could hear a big “bang” noise every time I switched on, off, changed the source or the sound mode. Being 10 years old, it wasn’t worth getting it repaired.

So I upgraded to an Onkyo TX-NR656.

Onkyo TX-NR656

Onkyo TX-NR656

With all the latest features, I cut in half the number of cables at the back since video and audio go from the device to the amplifier via the HDMI cable.

And with ARC (Audio Return Channel), I don’t even need an audio cable from the TV to the amplifier if I watch a video that’s not connected to the amplifier (e.g. a movie off a DLNA server)

Another neat feature is that the amplifier is WiFi enabled, and can be controlled over the network.

DomotiGa supports the Onkyo, but the commands are still a bit sparse and somewhat buggy / not user friendly, so that’s a work in progress that I have with their team.

I have however discovered Home-Assistant.io which offers native integration with the Onkyo. More on this in the dedicated Home-Assistant post.




Home-Assistant.io

I’ve recently discovered Home-Assistant (https://home-assistant.io) which offers a manufacturer agnostic home automation platform.

I’m still in in the learning curve and will post here what I’m doing with it. Watch this space.


[15th Feb 2017]

The good news first:

  • The web interface looks really good and easy to interact with.
  • There is also a huge list of supported devices and platforms, including the much wanted Nest for me.
  • The install is quick and painless

Now for the not so good:

  • I have spent hours trying to achieve some of the most very basic tasks (add a device, add a simple automation) because there is no graphical UI for this, it’s all code driven.
  • Some of the devices that I use (e.g. CurrentCost) are not supported

So all in all, I’m not going away from DomotiGa just yet, but will most likely try and get both platforms to talk to each other to get the best of both worlds.

I’ll try and post some config and UI examples in the near future


[16 Aug 2017]

Home-Assistant gets updated every other week and already since I started using it, loads of components have been added thanks to its massive community.

The GUI has also been updated to now allow creation of automations with minimum coding required, so I’m now seriously thinking about switching over from DomotiGa to Home-Assistant. This is even more prevalent since SmartVISU doesn’t appear to connect to DomotiGa since the last apt-get upgrade a couple of weeks ago, which is a shame as I really grew fond of the design.




Panasonic Smart TV

I’ve finally upgraded my TV. My previous 42” Plasma was very nice, but only HD ready (so 720p) and not smart.

I’ve now got a 4K 58” Panasonic TX58DX700B which has the advantage of having a network interface.

Panasonic Viera TX58DX700B

Panasonic Viera TX58DX700B

And the bonus is that there is already a plugin in DomotiGa that supports Panasonic Viera TVs.

This means I can now receive the mute status (on/off) and the TV volume, but more important I also get the TV status (on/off) and I can switch off the TV from DomotiGa.

This is very handy for my home automation, i.e. dim the lights when the TV in on, and don’t switch the lights off if there is no motion detected on the PIRs AND the TV is on.