23. October 2016

Smart Home in 2016 – Overview for beginners

So. You want to start with Smart Home?


I spent a weekend researching about this topic. Here you can find extract with several links that might save you some time.

My goal was very simple. I’ve got Salt lamp with 15W light bulb and I would like to control it from mobile phone.

Before we embark on the journey I recommend to read RFC 1925 at least two points:

  • (1) It has to work.
  • (8) It is more complicated than you think.

Keep that in mind. Our journey can begin.

Group #1: Devices which do not care about net

The first group that I discovered were devices which has no integration with network.


It is simple and cheap hardware which allows time based control of power socket for the lamp: Solight time switch.


Price: 339 Kč / 12 EUR

Solight does not support remote control.


Similar solution, but with remote control is RSL2. You can control several sockets with one remote control. The neat feature of this solution is ability to dim the light.

Price: 459 Kč / 17 EUR

The downside for this and several other sockets described in the article is that they’re targeted at German/Western market and you need to buy reduction to Czech/Slovak power plug.


Price: 71 Kč / 3 EUR


Then I found socket with interesting design which has support for remote control and you can turn it on just by pressing button: PowerCube. The button does not require any extra batteries. That’s very useful feature. Just some people on the internet complained that sometimes thay had to push the button twice. The button can be paired with more PowerCubes or more buttons can be paired one PowerCube.


Price: 659 Kč / 24 EUR

Group #2: Devices which do not care about cloud

I found this group at the end of my search.

Ubiquiti mFi mPower

Wow! mFi mPower! It has everything, because it is running on Linux. Wifi and even SSH interface. Android app or any script can interact with the device. The price is very reasonable.


Unfortunately the software development for this platform was placed on hold early this year. That is not good. Just two days ago there was another huge DDOS attack at Dyn which knocked out even GitHub. I’m not saying that it was caused by mFi devices. I just want to stress out that security patches are very important for smart devices.

Price: 1020 Kč / 42 EUR

BeeWi Bluetooth Smart Plug

Another device which is able to operate without cloud is BeeWi socket which communicates via Bluetooth with mobile phone. It is also possible to connect BeeWi to cloud, which requires special gateway from the same vendor.


Price: 1099 Kč / 45 EUR

Group #3: Devices addicted to cloud

There is large group of devices which operates on WiFi, but these devices are dependent on cloud. The dependency is not necessary bad thing, but you should be aware of it. It might very easy happen that the cloud is not accessible and you won’t be able to control the devices.

Isn’t it strange that with every flip of switch you need to generate some command and operation on remote server in the cloud?


The best match for the solution controlled via WiFi seems to be TP-LINK HS110. Android app has very high reviews. Just the iPad version is missing, so you have to use iPhone.


Price: 1079 Kč / 44 EUR

D-Link DSP-W215 SmartPlug

I found very alarming reviews of D-Link DSP-W215. Users were complaining that the device violates Czech electrical standards.


Price: 1399 Kč / 58 EUR

Belkin – WeMo Insight Switch

WeMo solutions seems to be popular, but I found large number of very negative reviews of control app for Android. It reminds me on old bloated Samsung Kies. This solutions works via WiFi and requires connection to the cloud.


Price: 1561 Kč / 65 EUR

Group #4: Devices which talks together

This is the most complex group. These devices implements protocols like Z-Wave or Zigbee which does not operate with the same protocols as BlueTooth or WiFi. It means that you often need a server which controls behavior of devices and which is able to relay instructions from your mobile app to the protocol implemented by devices.

FIBARO – Wall Plug

FIBARO has simply great design, neat functions. Little bit more expensive, but where is the catch?


Price: 1799 Kč / 74 EUR

FIBARO – Home Center 2

Here is the catch. You need FIBARO Home Center 2 to be able to communicate with FIBARO Wall Plug. The device allows you to control and gather report from your smart home network. The only problem is that the price is little bit higher than you would expect.


Price: 16499 Kč / 687 EUR

There is also FIBARO Home Center Lite which has little bit simple HW configuration and it is about half the prices of Home Center 2.


It is possible to use your own server instead of FIBARO Home Center, but you’ll need USB dongle like Aeon Z-Wave which is able to communicate via Z-Wave protocol.


Price: 1320 Kč / 55 EUR


Once you’ve got USB dongle you can set up your own home automation server like OpenHAB. Just unzip the file, copy configuration. Start the Java server and connect to web interface. Then you can use application on your mobile phone to control your home network. OpenHAB is very flexible and authors received Duke’s choice award in 2013.

It is also possible to connect devices described in group “Addicted to cloud” and control these devices just from your own server. There are several other open source home automation systems. You can find the list at OpenSource.com.

Price: 0 Kč / 0 EUR


Zigbee is similar protocol to Z-Wave. It operates in 2.4 Ghz like WiFi or BlueTooth. You need also separate dongle to talk to this network of devices. Zigbee has been adopted also by Samsung Smartthings.

There are also other protocols, but the idea is always the same. You need dongle or special bridge to talk to your network of devices. These devices are often able to talk with each other.


As you can see the market is quite diverse and complex. We started with very simple solutions and gradually continued to very complex server controlled solutions. It is often confusing for beginners to spot difference between socket using WiFi or Z-Wave. I hope that this article shed some light to the topic.

Thank you for reading. If you see that something in article is not correct or misleading, let me know. I’ll be happy to fix it.

And what was my decision after weekend analysis of Smart Home? I will buy just a simple flash light and I will turn the switch manually 😉

11. October 2016

Siriel 05 – Open source game engines

After working with Unity Editor I have realized that it has several drawbacks from my point of view.

  • Build time for HTML5 was extremely long even when the game was very small. It took several minutes to build the application.
  • Personal license always displays logo of Unity and I had to wait for the logo to fade out even when doing small iterations and testing of the game.
  • Unity is close source and even when I found the bug, Unity QA was not able to simulate it and they dropped the issue.

I started to seek for other engines and I was surprised by myriad of engines described at Wikipedia. The list is quite exhaustive and it is little bit hard to recognize the maturity of each project.

There is another list at GitHub which contains just open source engines. Projects are sorted by stars which makes it easier to see how is the project popular.

3. October 2016

Siriel 04 – #ifdef in Unity could lead into bad code maintainability

I was playing with Unity. Extending functionality bit by bit. Then I decided to make my game available also for mobile device.

So I searched for another tutorial from Unity – 2D Roguelike 14 of 14 : Mobile Controls. The tutorial seemed to be ok. But at one moment I froze in horror. The author was using #ifdef directly in high level code.

In my opinion this is very bad code smell. If you’re C expert and you’re playing with low-level API then you’ll need #ifdef, but this is high level code.

You may ask what is wrong about #ifdef in my “C# Script”. Well, here is very nice answer for C++.

#ifdef is something which should be treated with maximal caution, because it has tendency to explode into many Heisenbugs.

1. October 2016

Siriel 03 – Instantiate Prefab from C# in Unity

I was playing with idea to extend the game functionality by adding multi-player support early on. There is very nice tutorial Unite 2014 – New Unity Networking in 5.x., but I was missing one detail. How was Sean Riley able to instantiate game object from prefab. I always ended with some kind of exception or failure.

After several attempts to determine the root cause of my problem I stumbled upon this video “28.Unity Prefabs, Instantiate – Unity C# Scripting Tutorial Beginners” – from Charger Games. I was watching very closely and replayed the sequence several times to find the trick.

Here is whole process in slow motion.

1. Create Prefab from some game object. In my case I will focus on instantiating a pear.


2. Create Empty Game Object and add component Script in C#.


3. Open the script in editor.

using UnityEngine;
using System.Collections;

public class LevelControllerScript : MonoBehaviour {

    void Start () {
    void Update () {


4. Define public GameObject, save the code.

using UnityEngine;
using System.Collections;

public class LevelControllerScript : MonoBehaviour {

    public GameObject pear;

    void Start () {
    void Update () {


5. Go back to Unity Editor and watch the magic. 🙂


6. Unity parsed the code and updated fields in Inspector panel. Drag you prefab and drop it into the new slot.


7. Go back to the code and instantiate it.

using UnityEngine;
using System.Collections;

public class LevelControllerScript : MonoBehaviour {

    public GameObject pear;

    void Start () {

    void Update () {
        if (Input.GetKeyDown(KeyCode.Space))

That’s all. It reminds me of Xcode when you had to drag some stuff into sockets to bind it with code.

Here you can test updated version of Siriel.

During publishing this post I discovered issue with Unity that some assets are not properly loaded when switching between build for Desktop and WebGL. Read more at Unity forum about workaround.

26. September 2016

Siriel 02 – The flip trick or left and right animation

The character in two 2D game should be able to walk left and right. The movement could be underlined by animation to the left or right.

In old days when computers had very little computational power it was necessary to draw left and also the right animation as you can see in following sprite sheet.


Today you can save time for drawing one direction of animation and simply use the trick with flip. When direction changes just flip the image.

Here is code snippet from Unity C# script:

void Flip()
    Vector3 theScale = transform.localScale;
    theScale.x *= -1;
    transform.localScale = theScale;

The code and idea is from Unity Live training 16 2013 – 2D Character Controllers – time 42:30.

Here is the updated version 0.2 of Siriel with Flip function. I also fixed the RigidBody2D in z-axis to avoid flying around in different directions with the character.

25. September 2016

Siriel 01 – Unity experiment

Long long time ago I wrote a game engine for arcade game with name Siriel. The main character was inspired by small plush toy which was small tomato with hat. The name originated from one English lesson at school where we learned the word Cereal. I liked the sound so I made phonetic transcription to Slovak language and the main character was born. The whole game was inspired by series of Dizzy games from Code Masters. for Didaktik M (compatible model with ZX Spectrum).

My vision was to create the game engine which people can use to create their own Dizzy-like games. The Siriel 1 for PC was written in Pascal and it has very simple graphics with resolution 320×200. That was the technological maximum that I was able to achieve on 486 machine. After learning some Pascal and playing with Assembler I was able to get far better graphics and I wrote Siriel 2. The second game had just one scenario and it took about 20 minutes to play it. The result was better, but I wanted something more.

I found some special Pascal and Assembler units which were able to create game in far better resolution 640×480. It was also necessary to add some memory management module which played with extended memory in DOS, so the whole application was able to use more than 512 KB RAM. That was the foundation for Siriel 3.5 engine. The version “3.5” was inspired by Dizzy 3.5. I wrote 3 datatiscs for the game engine. The problem was that I reached the technological limits of Pascal with Assembler. The game was running only in DOS.

During my studies at university I made several attempts to reboot the game engine project. The first one was based on Allegro and C++. Both technologies seemed promising, but I felt into problem known as “paralysis by analysis”. I had temptation to add all features at once to the new engine. The engine Siriel 4 was working even on Linux. I had feeling that something is wrong. It was very hard to add anything into growing engine. Sprite animation was cumbersome.

Then I found PyGame which has promise of using incredible powers of Python while keeping great performance of C++. I made attempt to wrote engine in Python. The result was quite ok, but creating packages for different platforms was hard.

I put the idea with Siriel on back burner for several years. I was fascinated by Flex technology introduced by Adobe and it seems that it might be even right combination to build the game in it. I used Flixel and you can play one of attempts as small game PF 2010.

Unfortunately even this was blind path. Adobe discontinued all activities with Flex in favor to HTML5. It took about 6 years to web technologies to reach the similar state. Sure HTML5 is now much more flexible than Flex was before.

I was trying to implement games using jQuery, Angular, KiwiJS. Games were working. The technology was quite ok. But stuff like animation required a lot of effort.

Recently I decided to experiment with Unity 5. I was surprised how mature the technology is. In very short time I was able to import assets from the game that I wrote nearly 20 years ago and in few minutes get animation running. What was even more surprising for me was that Unity was able to produce packages for Windows, Linux, Mac, Android, iOS and WebGL.

Here is the result of the first experiment 🙂 There is just simple keyboard control. The main character is able to make at least some funny jumps.

10. February 2016

Story behind PF2016

Slides available in formats: PDFSlideShare

Source code: GitHub/ysoftdevs/pf2016

30. December 2015

PF 2016

This year I have another special game for you as Pour Felicitér card.

Go to: http://www.ysofters.com/pf2016/

PF 2016 Puzzle Game

You can enjoy PF games from previous years: PF 2015, PF 2014, PF 2013,PF 2012,PF 2011, PF 2010

14. December 2015

Slides from talk at FI MUNI: C++ and Software Engineering 2015

Slides available in formats: PDFSlideShare

Source code: GitHub/ysoftdevs/cpp-examples

9. December 2015

Thunderbird and Outlook solution of problem with Courier IMAP sslv3 alert illegal parameter

E-mail clients like Thunderbird or Outlook stopped to communicate with Courier IMAP/SMTP/POP TLS after some upgrade.

The only clue in log file was this error message:

courier couriertls: accept: error:14094417:SSL routines:ssl3_read_bytes:sslv3 alert illegal parameter

The problem was that certificate for IMAP (/etc/courier/imapd.pem) and /etc/courier/dhparam.pem were containing too short key. The short key was sufficient in past for encrypted communication. Unfortunately maintainers of Debian package forgot to add fix for upgrade.

It is very simple to fix the issue. Just generate DH with sufficient length.

DH_BITS=2048 mkdhparams

This command will update /etc/courier/dhparm.pem.

Make sure to update all pem files in case that they contain DH record.

Restart services and clients should be able to reconnect without problem.

If you still experience some issues with PEM files check out article PEM routines:PEM_read_bio:no start line.

  • Where’s the fish?

  • Further info

  • Twitter

    Follow @jurajmichalek on twitter.

  • Babel fish

      Translate from:

      Translate to:

  • Tags

  • Topics

  • Comments