Category Archives: Misc

Edimax SP-2101W Wi-Fi Smart Plug with Energy Monitoring

I saw this little plug on Amazon recently and decided to add it to my “arsenal” of gadgets.

Edimax SP-2101W

Edimax SP-2101W

The interesting bit about it is that not only it can be remotely controlled, but it also provide energy monitoring, so you know if the “dumb” appliance that’s connected to it is on or off.

I’ve connected my kettle to it as a test, and I think it might stay there for a while now.

This entry was posted in Misc on by .
 
 

Getting the status of a Sky+ HD Box

Thanks to C4rtm4N I now have the status of my Sky+ HD box in Home-Assistant. When used in conjunction with dalhundal‘s sky-remote-cli it becomes close to a fully fledged solution.

Playback or Live TV is now automatically paused if the Sky+HD box is on…

The code I used (for now, there appears to be times when it generates errors in HA) is:

Sensor to catch the box’s status:

Template Switch to control the box:

The shell commands are:

of course replace the ip addresses with that of the Sky box (which should be fixed by your router). You’ll need to ensure sky_remote_cli is installed of course:

Head over to dalhundal‘s page for more info on sky-remote-cli…

 

This entry was posted in Misc on by .
 
 

Replacing Cloudmqtt broker with my own via mosquitto

I’ve been using the excellent cloudmqtt since my early days getting to know MQTT. It’s been flawless except for about 3-4 times this month where it failed and I had to contact cloudmqtt support. Now I have to praise the support team as they did an excellent job very quickly, but the few faults made me think it was time to get myself my own broker.

In addition to going away from potential third party failures, it would allow me to keep controlling my devices should I have any internet access issues.

So I followed this page to set up mosquitto on my server.

Once done, I didn’t want to just switch everything over from cloudmqtt to mosquitto as I have quite a few devices to connect to cloudmqtt, some less accessible than others. I therefore created a bridge between my mosquitto and cloudmqtt to get the best of both worlds.

This was done by a new mosquitto config in the /etc/mosquitto/conf.d/ directory, I used cloudmqtt.conf (it can be any name as long as it ends with .conf so mosquitto will read it) with the following info:

All I then had to do was to point my Home-Assistant config to my own mosquitto broker.

Et voilà !

Xiaomi Dafang Camera

I’ve recently purchased a Xiaomi Dafang Camera from GearBest. Why? Well it was cheap, 1080p resolution and has Pan-Tilt functionality as well as audio recording.

Xiaomi Dafang

Xiaomi Dafang

A couple of let downs however:

  1. The camera did not offer any RTSP streaming functionality (so not possible to use motion)
  2. The camera uploads the video feed to some server in China for the Xiaomi Mi app to retrieve

Not happy with either of the above, I started to look around for a solution and Elias Kotlyar managed to hack it to provide exactly what I was after.

I now have a camera that behaves like a “normal” CCTV camera via motion. I’ve also created a switch in Home-Assistant so as to enable motion detection video recording only when nobody’s home. Check my github page for more details.

In addition to the aforementioned standard features, Elias offered manual control of the LED so I can use this as a quick way of showing the camera status (on, off, motion recording enabled) My short term goal is to add MQTT to the camera to make it easier to control the LED and potentially the motors to pan & tilt. Longer term goal would be to get motion to control the pan-tilt functionality automatically. But that is likely to be a much more complex problem to solve, especially since motion documented that feature as “permanently at the experimental stage“…

The camera is however so good and cheap that I already bought another one 🙂

Watch this space…

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
This entry was posted in Misc on by .
 
 

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:

  • 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:

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:

 

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):

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:

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):

     
  2. install unclutter to hide the mouse:

     
  3. Disable screen blanking so the TV always shows the dashboard:

    insert the below line in the [SeatDefault] block:

     
  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:

(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 :