Internet button, Domoticz and Microsoft Flow in Unison

For a few weeks now, I have my personal Domotics solution. I could have bought a complete solution but rather I was intrigued by Domoticz. It’s an open source Home Automation System and what’s really great, it interacts with all kinds of communication protocols.

Basically, you need a device which can run a web server and you need a local gateway for the transmission of the various signal.

This is how my rig looks like:

wp_20161224_11_53_14_rich_li2

Note: I still have to replace the antenna with a bi-polar 433MHz one.

I use a combination of a Raspberry Pi (running the Domotics web server) and an Arduino Mega with a special gateway hat. If you have a (Synology) Nas, you can use that one to run the website on.

When I ordered the hat three weeks ago, I received a gateway version 1.1.4 and did the soldering myself. the manual for v1.1.3 is still useful.

Here is a picture of the gateway:

wp_20161224_11_52_56_rich_li2

The Arduino Mega is running specific RFLink Gateway firmware. An executable (RFLinkLoader.exe) is provided to flash the latest firmware. The same tool is also very useful to check if the gateway is functioning correctly (I had to fix my soldering job twice when I checked the gateway, I just got no signal).

The mega is just attached with a USB cable to my Raspberry Pi. The Pi was configured using this manual.

I started with ‘Klik aan/Klik uit’ power plugs. These are great when you want to schedule lights etc. to power on or off. But I also got a door bell. What could I do with that?

But I also got an electric door bell. What could I do with that?

The Internet Button

I bought an electric door bell from a local Action shop:

wp_20161224_11_52_28_rich_li2

I managed to capture the signal of the button but I had some issues with the doorbell. Domoticz was unable to replicate the button signal. I could not trigger the doorbell sound using the website. At first, this was a little disillusion  But I found a better usage for the button.

Could the button trigger something else than the doorbell?

tldr; Yes, you can!

First, you have to learn Domoticz about the doorbell button:

my-doorbell

Right now, nothing will happen. You have to attach a notification.

domoticz-notifications

So, you first have to decide what will have to happen when you push the button. Domotics supports various solutions to send notifications.

  •  Prowl
  • Pushbullet
  • Pushover
  • Clickatell SMS
  • NMA
  • Pushsafer
  • Pushalot
  • Custom HTTP/Action

I have no experience with the various push notification providers. But I have experience with custom HTTP!

Introducing Microsoft Flow

In the past, I already blogged about the possibility to trigger a Microsoft Flow using an HTTP request. I decided to combine this with sending an SMS when the button is pressed.

If you want to send SMS messages in general,  Twilio is an interesting suggestion, they provide a free trial. You only have to request a free API key. And the good news is that Microsoft Flow supports Twilio!

So I created a simple SMS flow:

microsoftflow

The endpoint is created by Microsoft Flow. And I have defined the JSON that I want to receive:

{
"type": "object",
"properties": {
"device": {
"type": "string"
},
"action": {
"type": "string"
}
},
"required": [
"device"
]
}

And because I have defined these tho fields (device/actions), I can reuse the values of the fields to combine them into an SMS message.

Domoticz notifications

So now we can define a custom action in Domoticz for our Microsoft Flow endpoint:

domoticz-custom-http-action

I just copied the URL from Microsoft Flow into Domoticz. And I defined the ‘same’ JSON message in the POST data.

And when the notification is saved, we can attach it to our button:

doorbell-notifications

Note: in the JSON message of the custom HTTP action, I introduced the #MESSAGE. This is the Custom Message field, above.

Pushing the button

So finally it’s time to push the button.

And within just a few seconds, after I have pushed the button, I receive this message on my Lumia:

wp_ss_20161224_0001

So, there it is! The simple six euro doorbell button is now connected to the internet. Please leave a message in the comments. I love to hear what you do with the button yourself!

Advertenties