Author Archives: Admin

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:







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…

CurrentCost Script

Until now I used DomotiGa to get the date off my CurrentCost EnviR energy sensor.

Since I’ve moved all my automations to Home-Assistant, the only bit that was not supported by HA was the CurrentCost device. I didn’t want to run DomotiGa just to get the data off the EnviR and then send it to HA via MQTT.

I’ve finally finished a script thanks to Robin Wilson that gets the EnviR data from the serial port and sends it to HA. DomotiGa can now truly rest in peace.

The final script is this one:


H801 LED Strip Controller Upgrade

While I’m perfectly happy with the H801 LED Strip controller’s abilities, there were a few niggles that I didn’t like:

  • The controller would always advertise as an access point, allowing “anyone” to connect as long as they knew the default SSID password (88888888)
  • Communication is 1 way with no feedback
  • The script I wrote to go through the colour spectrum was ran off the server and basically sending a command to the H801 over the WiFi network every 0.1 sec
  • I had to create an on/off switch as well as 3 sliders to select the (RGB) LED colour

Knowing the H801 is based on the ESP8266 chip and programmable, I looked for a better solution and finally settled on corbanmailloux solution for the following reasons:

  • The H801 is no longer an access point, making it more difficult to hack
  • it’s MQTT “enabled” and offers 2 way communication
  • It’s Home-Assistant compatible, and already includes support for RGB attributes via a colour picker and other effects
  • It already has the function to loop through the colour spectrum; actually it has 2 of them at different speeds, plus the possibility to time colour transitions and a flash feature, for notifications for example
MQTT JSON Light on Home-Assistant

MQTT JSON Light on Home-Assistant

I used the code off the mqtt_esp8266_rgb folder. The only things I had to change in config.h were:

  • LED colour pins to be compatible with the H801:
  • change the WiFi settings and the MQTT settings

Because I use cloudmqtt, I also changed the MQTT port in the main mqtt_esp8266_rgb.ino file:

I followed the instructions on corbanmailloux git page to install Arduino and the relevant libraries, and I used the esptool from micropython to upload the firmware

Goodbye DomotiGa, Long Live Home-Assistant

Following what I think is due to a general OS update, SmartVISU no longer connects to DomotiGa. I’ve tried to fix it, but I’ve thought for a while now to transfer everything over to Home-Assistant since support for IoT devices is much better and update are a lot more frequent

So I’ve finally taken the plunge. One of the main hubs that was used in DomotiGa was the RFXTrx433 Transceiver. I’ve disconnected it from DomotiGa and added it to Home-Assistant. I’ve spend the best part of 2 weekends and several weekday evenings recreating the devices and events that were in DomotiGa.

Home-Assistant Main Page

Home-Assistant Main Page

There’s still a lot of work to be done, but I’ve done the most important bits. I’ve also broken down the content on several pages unlike cramming almost everything in one page like I did in SmartVISU.

I’ve also used this an opportunity to save my config to GitHub for back up and in case it helps someone else.

The only thing I’ll be missing as not built-in is the data from my CurrentCost Sensors, but I’ll be running a light version of DomotiGa to send that data to my Home-Assistant setup.

Kello Smart Alarm Clock, Part 2

I’ve now had enough time to play with my Kello and I’ve done enough integrations to share some updates.

Now Kello doesn’t have an API per se, but there are a few commands that can be used to communicate with it.

This enabled me to created a Kello interface on Home-Assistant so I can control my Kello remotely. Bonus: I can even do this when I’m not home.

The main interface is this one:

Kello on Home-Assistant

Kello on Home-Assistant

And here are some of the functions that I’ve achieved:

  • When I stop the alarm, I then get greeted with the weather forecast for the day as well as estimated time to go to work
  • I can play various radio stations, change the volume
  • If for any reason the Kello loses WiFi connection, I get a notification email
  • When I leave home, or when I set the house mode to “Holidays”, all alarms get deactivated
  • When I reach home or when the house mode is no longer set to “Holidays”, all alarms are enabled


Here is a list of the commands I used to achieve the above:


Where xx is the volume in hex (Dec from 0 to 100, so 0x00 to 0x64 in hex)


Muting all Alarms:


Unmuting all Alarms:


Play (online) Media:


Stop Media:


And don’t forget the IFTTT Integration for more automation, check my previous post on how do to this.

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…

Kello Smart Alarm Clock

I have recently taken the plunge and jumped on the kickstarter wagon for the first time.
I successfully backed up a project called Kello.
And after months of anticipation, I finally received the product: a smart alarm clock:



Now not only does this alarm look good, but it’s also WiFi and IFTTT enabled and for me that was the major sales point. The plan was to integrate it with my automation setup.

I’ve only had it for about a month and already I’m really impressed with its prowess. The first thing I did was to connect it to IFTTT.

At the time of writing IFTTT is only a beta feature access needs to be requested ([email protected]). They are really responsive and I was granted access within 24h via the use of the TestFlight app on iOS

IFTTT integration currently offers 4 triggers:

  • alarm_start: triggers when an alarm starts ringing.
  • alarm_snooze: triggers when you press snooze.
  • alarm_stop: triggers when you stop the alarm.
  • alarm_soon_-1440, ..., alarm_soon_-120, alarm_soon_-6: the number on the right is the number of seconds before the alarm rings. Only use multiples of 60, up to 1440 seconds (24 minutes) before the alarm rings.

The other interesting bit is that the device can programatically be made to play online content with a one line piece of code:

The URL can be adjusted to play any online content (I’ve not tested all formats). The IP address needs to be the Kello’s IP address (best to set it to static on your router’s DHCP settings)

Armed with the above, I wanted to adjust my weather greeting script so as to play the audio on the Kello. The idea is to have the Kello play its set alarm sound to wake me up, then when I stop the alarm, a rule is triggered to play the weather forecast for the day (I pressed the stop button so I’m awake enough to pay attention to the forecast)

Here is how I did it.

  1. IFTTT:
    1. Go to
    2. Press on the gear icon on the top right of your screen.
    3. Copy your webhook ID (the text after ‘’).
  2. Home Assistant:
    1. Add IFTTT with your webhook ID to your configuration.yaml:
    2. Add a new shell command to your configuration.yaml file. Replace the IP with your Kello’s IP address and replace the URL with the address of the weather forecast sound file you want to play (this is created and uploaded separately)
  3. Kello App:
    1. Go to the settings.
    2. Press ‘IFTTT’.
    3. Paste your webhook ID.
  4.  IFTTT:
    1. Create a new Applet.
    2. For the if THIS condition, choose Webhooks.
    3. Click on Receive a web request
    4. For the Event Name, choose one of the event as listed earlier on. I chose alarm_stop
    5. Click on Create trigger
    6. For the then THAT action, choose Webhooks.
    7. Click on Make a web request
    8. Fill in as below, replacing the URL and password with your own (*):

      IFTTT/Kello Applet Settings

      IFTTT/Kello Applet Settings

    9. Click on Create action

(*): To be able to receive events from IFTTT, your Home Assistant instance needs to be accessible from the web. This can be achieved by forwarding port 8123 from your router to the device running Home Assistant.

My next “project” is to mute or stop an alarm from playing if for any reason I’m not home so I don’t disturb anyone. Check this post to see how I did it

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.
  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