Browsed by
Tag: Domotica

Homey: a first impression

Homey: a first impression

Homey Flow EditorTwo weeks ago my Homey finally arrived. It’s still in beta, but that’s fine by me :-).

Currently I have the following devices and services setup:

  • Klik-aan-klik-uit (Kaku) remote (433Mhz)
  • Nest thermostat
  • Philips Hue lighting
  • TV (infrared)
  • PVR (infrared))
  • Receiver (infrared)
  • Kodi (trigger like: ‘on movie start’, ‘on pause’)
  • Fibaro motion sensor (Z-wave)
  • #Slack (for notifications)
  • Buienradar (trigger to inform you when it starts to rain)

Adding new devices is very simple, because Homey will recognize most devices automatically. If an infrared device is not recognized automatically, you can learn Homey each key manually.

Homey devices

Homey already supports a lot of devices and Apps. Apps can be added via the Homey App store. Because Homey is open, it’s also possible to create you own Apps. So the number of Apps can grow fast if a lot people start developing themselves.

Flow Editor

Homey comes with a build in Flow Editor. The Flow Editor makes it possible to create several flows. A flow is constructed by defining the IF (trigger) and a THEN (action). Optional you can use logical expressions to fine tune the IF.

Homey Flow Editor

Below an example of a flow to turn on the TV including the PVR and receiver. The flow is trigger by pressing a button on the Kaku-remote. When the button is pressed the led-ring of the Homey will turn red and an infrared signal is send to the TV, PVR and receiver. At the end Homey will say that the TV is turned on.

Homey turn on TV

Another flow I have running is turning on the lights in the hallway when motion is detected. Another flow is turning of the light when motion is no longer detected. For detecting motion a use the Fibaro motion sensor.

Homey motion sensor

I nice feature is that you can send notifications to your mobile or to #Slack. So even when I’m not home, I still know what is happening at home.

Still in beta

There are still some flaws in the software and Homey is not always triggering the flows when it should, but hey I still love my Homey. The guys at Athom are working really hard on the software and with each update Homey works better. Most of the issues I had where solved by looking for answers on the forum or with a software update.

Only speech recognition is not working as it should, but I hope this will be improved in one of the next updates.

Homey Clickthrough

Homey Clickthrough

I’m still waiting for the delivery of my Homey. I hope to receive mine this month. In the meantime Athom made a nice video showing what you can do with Homey. I love what you can do with it already.

Homey Clickthrough



HomeyA new year has begun, so it’s time for a new gadget 😉 I just ordered an Homey! I want it to control my lights (Philips Hue), room temperature (Nest) and my home cinema.

What is Homey?
Homey is your personal assistant who will make your home personal again. Whatever you want to do, Homey takes care of the technical parts, so you’re left with the fun. Interact with your home and your devices in the way you interact with anyone else: using natural, spoken commands.

They just started delivering the first batch, so I hope to receive mine this month.

Update (13-01-2016): Looks my Homey will be shipped around 15 February 2016.

Measuring light strength with a Netduino

Measuring light strength with a Netduino

Light sensor schemaMeasuring the light strength is pretty simple when you own a Netduino.

You only need a normal resistor and a Light Dependent Resistor (LDR) which should be connected to the Netduino as shown in the schema.

With these few lines of code you can read the value from the LDR.

This code will open the A0 analog input port and read the value from it.

It returns a value between 0 and 100. 0 means bright and 100 means dark. In this example the value is inverted, so 0 means dark and 100 means bright.

public static void ReadLightSensor()
int minValue = 0;
int maxValue = 100;
int lightingInterval = 15 * 60 * 1000;

// Open the analog port
var lightSensor = new SecretLabs.NETMF.Hardware.AnalogInput(Pins.GPIO_PIN_A0);

// Set the value range between 0 and 100
lightSensor.SetRange(minValue, maxValue);

while (true)
// Read the value and invert it: 0 = dark, 100 = bright
var lightSensorValue = maxValue – lightSensor.Read();

// Do something with the value


If you show the measured values in a chart it will look like this:
Light strength chart

A new domotica dashboard

A new domotica dashboard

For over five years I measure the temperature in different rooms at home. Al these year I had a dashboard where I could see the temperatures in a chart.  The dashboard also shows me the minimum and maximum temperature per room over a certain period. The picture below shows the dashboard.
The old Domotica Dashboard

Over the years my interest for domotica began to grow and I wanted more than just measuring the temperature. Inspired by the Bwired site, I started looking what else can be done.

Electricity usage

I first looked into measuring my electricity usage (I don’t have gas in my home). To be able to measure this, I needed a new electricity meter, because mine was not ‘smart’. After a new smart meter was installed I started using the system of Net2Grid to measure the electricity usage. It’s a nice system which gives you a good insight in your usage. With the Energy Insight App you can even see your usage on your smart phone.

The equipment for reading information from the smart meter is connected to the P1 port of the meter. Because I wanted know what kind of port this is, I started reading about it. It seemed that the P1 port is just a serial port which can be read as such. I read about some people who where using a Netduino board to read the information from the P1 port. So I order one and started experimenting with it. See this post about how to read the P1 port using a Netduino.

Because I already was using the Net2Grid system, I didn’t use the Netduino for I while, but during the Christmas holidays I picked up the project where I left it and started extending the code for reading the information coming from the P1 port and I also rewrote the back-end part I used for my temperature measurement, so I could also send the information coming from the smart meter.

The new dashboard

Because I now can read the smart meter myself, I was also able to integrate the information in my dashboard (so I didn’t need to switch to the Net2Grid dashboard). So I started developing a new version of the dashboard. The result is shown in the picture below.

The new Domotica DashboardAs you can see, this is a complete different dashboard. This dashboard does not only show me the temperature as the old one did, but also the power usage and the current consumption coming from the smart meter.


As you can see in the picture of the new dashboard, I also measure the light strength. This information is also coming from the Netduino by using a simple LDR for measuring the light strength. I will write a post about how this works later.

The reason for measuring the light strength is, that I want to automate my lighting. As lighting I use the Philips Hue LED lighting system. Because this system is connected to my local network and has an open API, I’m able to operate the lights programmatically. This is a project still in progress :-). But the basic idea is to switch to lights on when it gets dark en turn them off when it’s bright (all within a predefined time of day). But more about that later.

Explanation of the message coming from a P1 port

Explanation of the message coming from a P1 port

Iskra ME382In a previous article I described how you can use a Netduino to read the P1 port of a smart meter. In this article I will explain the contents of the message coming from this P1 port.

A message will always start with a ‘/’ and end with a ‘!’.

Below an example of such a message with some explanation for each message line

Message Explanation
/ISk5\2ME382-10030-0:96.1.1(4B413650303035313332363238353133) brand and type of the meter (this is a ‘ISKRA ME382’)
1-0:1.8.1(00357.909*kWh) +T1, taken off-peak power (357 kWh)
1-0:1.8.2(00253.970*kWh) +T2, taken peak power (253 kWh)
1-0:2.8.1(00000.000*kWh) -T1, returned off-peak power (0 kWh)
1-0:2.8.2(00000.000*kWh) -T2, returned peak power (0 kWh)
0-0:96.14.0(0001) actual rate (1=off-peak power, 0=peak power)
1-0:1.7.0(0000.55*kW) current power consumption (550 Watt)
1-0:2.7.0(0000.00*kW) current return delivery (0 Watt)
0-0:17.0.0(0999.00*kW) maximum current/phase
0-0:96.3.10(1) switch position
0-0:96.13.1() numeric message
0-0:96.13.0() text message
! terminator

In case there’s a gas meter connected to the smart meter, you will see some extra lines with data coming from the gas meter.

Read data from a P1 port of a smart meter using a Netduino

Read data from a P1 port of a smart meter using a Netduino

Netduino P1 port connectionWhen you own a smart meter (in Dutch it’s called slimme meter), you probably know that these meters have a port for reading the meter’s data. This port is called the P1 port. This article will describe how you can connect to the P1 port and read the data coming from the meter using a Netduino Plus 2.

The first thing to do is connection the P1 port to the Netduino. The P1 port is a standard RJ11 socket. The P1 port is a half duplex serial port, with signals on TTL-level (0-5V) and with 4 pins connected. The RJ11 connector schema below will show the pins with the signal on each pin. As soon as the RTS-pin gets voltage, a data package will be send through the RxD pin. As long the RTS-pin has voltage, every 10 seconds data will be send.RJ11 connector

Normally serial ports on TTL-level will have an inverted signal. For the P1 port that’s not the case. Therefore you cannot connect the P1 port directly to the Netduino, but you will have to invert the signal first.

The schema below shows how to connect the P1 port to the Netduino using a HD74LS04P Signal Inverter IC. The Signal Invert IC contains 6 inverters, but only 2 are used.

P1 port schema

Once you have the hardware connected, you can start programming.

Opening the P1 port

You will need to use the following port settings to be able to read the P1 port’s data: baud rate: 9600, data bits: 7, parity: Even and stop bits: 1. Below the code for opening the port. In the above schema the P1 port is connected to the Netduino using connector D2, which means COM2.

string comPort = SerialPorts.COM2;
int baudRate = 9600;
int dataBits = 7;
var stopBits = StopBits.One;
var parity = Parity.Even;

// Create serial port
var serialPort = new SerialPort(comPort, baudRate, parity, dataBits, stopBits);

// Open serial port

Reading the data

Below you will find an example of the message as read from a P1 port. The first line will give information about the meter. As you can see, my meter is a ‘ISKRA ME382’. In a next article I will describe what the other message lines mean. A message will always start with a ‘/’ and end with a ‘!’.



The code below will show how you can read the message form the P1 port. The first method will use an infinite loop to continuously read the ports data. After a message was received, the code will pause a while before continuing reading the next message.

private static void ReadDataFromP1Port(SerialPort serialPort)
while (true)
if (serialPort.BytesToRead > 0)
var msg = ReadMessageFromSerialPort(serialPort);

if (msg != string.Empty)
// Wait a while before continuing

The next method will show how the message coming from the P1 port is processed and how the readable message is composed. Because the Netduino Plus 2 handles the serial port a bit different than a Netduino 2, it is necessary to remove the parity bit (see ‘& 127‘) from the incoming byte. If you do not remove the parity bit, your data will be garbage.

private static string ReadMessageFromSerialPort(SerialPort serialPort)
// Init
string msg = string.Empty;
int singleByte = 0;

// Read the message
while (serialPort.CanRead && singleByte != _StopChar && msg.Length < _ProtectAgainstOverflow)
// Read byte and remove parity bit
// Without removing the parity bit, the message will contain garbage on a Netduino Plus 2
singleByte = serialPort.ReadByte() & 127;

// Add character to message
msg += (char)singleByte;

// Flush the serial port

// If loop was exited without the last character being the stop character, the message was invalid, so return an emtpy message
if (singleByte != _StopChar)
return string.Empty;

// Return the message
return msg;

These are the used variables

private static int _StopChar = 33; // = !
private static int _TimeToWaitBeforePressingNextMessageInMilliSeconds = 8000;
private static int _ProtectAgainstOverflow = 600;