So Many Things to Do Video

Please note – this blog is WELL out of date and all of my blog items and much, much more have now been moved to

I’ve been meaning to update the blog – and I just keep getting sidetracked with the many interesting possibilities of Node-Red….  so – I put a short video together here. Should be something of interest in it.


Node-Red on The Raspberry Pi


This is fun – it’s a diversion but it’s fun – no… REALLY. Last night I was having a play with OpenHab.  I have all my own home control code and several working installations – but it never hurts to have a look and see what others are up to – especially having now pretty much decided to go down the MQTT route thanks purely to the fact that it works so well – and with passwords, in the ESP8266 hence solving a long standing security worry for me. I’m usually fairly good at spotting trends and as long as sending and retrieving MQTT OpenHabmessages in the ESP8266 nodes can be made rock-solid reliable – I cannot see any reason NOT to use the protocol – no worries about networks etc, just have the board respond to incoming topics and send out to reply topics as and when needed.   I can see someone coming up with a Windows interface for this (setting upt the router, setting up incoming topics etc  – and becoming a really popular person.

Anyway, I’ve been trying to get to grips with Openhab – trust me – if you’re new to it – you are going to need LOTS and LOTS of coffee.

The upshot is – it is possible despite the many many interfaces that OpenHab supports, to put 3 lines of code in there and have it send all it’s stuff to MQTTand respond accordingly.  So looking at the screen above, I can turn on the bathroom mirror (that’s the demo almost unaltered – I didn’t write this) and that will send an MQTT message out.  I have my little board responding to that. I can even have the board send a response BACK to say what the status of the mirror is (ON or OFF)  (I have no idea how to make that response happen on request – i.e. when the web page first opens).

ANYWAY, my little ESP8266 board can make the yellow bulb turn on and off but the blue switch sadly toggles regardless of any feedback – making you feel you’ve done something when in fact your little board could be in flames….. hopefully someone will help me there PLEASE. I turned off the yellow bulb automatic update but I can’t stop the blue button toggling yet.

SO – I got up early this morning and was waiting for someone to help me with my little Openhab issue when a fellow wrote in to suggest I have a look at CODE-RED. Well, what a fiasco – there’s a lot of LINUX-ASSUMPTION in the setup – just install it – no problem they say!  Well also install NODE which to be fair is also easy… but when the installation cran.. I ended up with a TON of guff coming up and telling me I needed to install VISUAL STUDIO…. I was THAT far off scrapping the idea but I thought I’d give it a go and despite the warnings it seem to work.

So what’s NODE-RED – I have NO idea if it is of any use but I CAN tell you it’s a HELL of a lot of fun – I mean – you HAVE to try this.

node-redSo if you’re bored and want some fun…  go here and get node.js -  installation on Windows is a breeze.  NOW having done that,  go off and get the NODE-RED installation..  -  I just dumped the directory on my desktop.  Open a DOS BOX (they don’t tell you that) and navigate to the new node-redxxxx directory in your dos box.  Now type npm install –production

Ok now in the same DOS BOX – type node red.js and this still start up red.js – it will also likely complain that it has failed to register 9 node types – I have NO IDEA why a fresh installation would do this – and at that point I was ready to throw in the towel  -but it works anyway!!! If anyone has a kiddies guide to fixing this please do write in.

So – you will get to see something like this…

C:\Users\Peter\Desktop\node-red-0.9.1>node red.js

Welcome to Node-RED

9 Jan 07:05:17 – [red] Version: 0.9.1
9 Jan 07:05:17 – [red] Loading palette nodes
9 Jan 07:05:17 – ——————————————
9 Jan 07:05:17 – [red] Failed to register 9 node types
9 Jan 07:05:17 – [red] Run with -v for details
9 Jan 07:05:17 – ——————————————
9 Jan 07:05:17 – [red] Server now running at
9 Jan 07:05:17 – [red] Loading flows : flows_Monster.json
9 Jan 07:05:17 – [red] Starting flows

It might now look exactly like above….

I left the DOS box open – and pulled up my (Chrome) browser and ran the address and port provided.

A VERY pretty screen came up..


Actually if you don’t get this far, go back, to a little reading – I might’ve missed something – it really is worth getting this far..

You back? Right – see those buttons on the left – which kind of make you feel this could be tantalisingly easy? Well, it IS. AT this point I have to make some assumptions – you have access to an MQTT server somewhere – and you have a Google email address – and a Twitter account or some of that.

So here’s what I did – I dropped an MQTT input and a DEBUG output on screen – drag and drop. I drew a line connecting them.


I double-clicked the MQTT input (see it has the speaker-thing on the left as against the right) – and filled in the name of a subscription.. and my MQTT broker details.  I pressed DEPLOY.

Excited yet?


Using MQTT-SPY I sent a message to /test/ and …


By this point my toes were tingling… I wonder if I can have it send a message back as well?


Yup… but.. but… but… how about having tweets come in and go to the debug AND my /testreply/ topic? I eagerly dropped the TWITTER box in and authorised it (double-click – absolute doddle) – I put in some hashtags (without the tags it seems)…



and drew a couple of lines – hit deploy and…

twitter mqtt

Unbelievably, tweets started coming into the debug window – AND going out to my /testreply/ – no problem.

Let’s try an email I thought – could it send me an email as well – and what about the contents of a test button going to all 3!!


Sure enough… I pressed the test button – the debug showed the message – my MQTT /testreply monitor saw the same thing and an email came into my inbox.

That’s it – I’m going to leave the rest to you… the visual interface (browser) does not need to be running for this to work (well apart from the test button) – and I’m not sure what kind of kit you need to run to keep it going either – or how it would respond to power loss etc, but at least ON THE SURFACE OF IT this as something special! I messed around for DAYS  trying to get a crappy Arduino to send Tweets only to discover most of the code out there is for BEFORE Twitter changed the API – and here – I can have a £2 ESP-01 send tweets AND emails without any effort at all!!!

Back to my Openhab work for an hour then I have some real work to do.

Incidentally, I have a SYNOLOGY disk-station and thanks to helpful people in here I now have that running MOSQUITTO for the MQTT server and thanks to the incredible help from the fellow who put together MQTT-SPY and made loads of changes for me – I can keep a test rig open to test my MQTT. I’ve even sent 1000 messages a second to the broker and had them come back in within a second – so there is no doubt in my mind that this is the correct route … it’s looking more and more like there are a ton of useful toys like OpenHab and Node-red which will help make this a very satisfying project. It looks like I could put Openhab into the Diskstation as well (in case you don’t know the Synology Diskstation is one of these black boxes with 2 disks for storing your media – because they use RAID they are almost immune to failure (one disk fails the other takes over) and unlike the READYNAS before them – they have some power).  IDEAL tool for running stuff like this as they’re on all the time anyway.