OpenHab and MQTT

Well, the first part of that was easier than I was expecting..

I installed OpenHab on my PC – told it about my MQTT broker…  which I’m calling “petebroker”

Added in these three lines from an example…

mqtt-eventbus:broker=petebroker
mqtt-eventbus:commandPublishTopic=home/openHAB/out/${item}/command
mqtt-eventbus:statePublishTopic=home/openHAB/state/${item}/state

I used the openhab demo as I’ve never used the package before…

If I use a separate mqtt client (MQTT-SPY) subscribed to

home/openHAB/out/Light_FF_Bath_Mirror/command

For example.. I can see the ON and OFF commands from OpenHab – so clearly the MQTT is working. All the commands in the demo are producing MQTT messages..

GREAT.

But – I haven’t the FOGGIEST idea of what topic and message to send BACK to Openhab to, say activate the little indicator  on the bathroom mirror icon. I’ve tried combinations such as

home/openHab/state/Light_FF_Bath_Mirror/state

and the message ON -  nothing – zilch. Can anyone put me out of my misery.

Oh just to prove it worked – I set my little ESP-12 up to subscribe to the bathroom mirror – and toggle GPIO2 accordingly – and it worked straight away!!! No problem – stick a relay on there and we’re in business (JUSt had delivery of a couple of solid state relays which claim to work from 3v upwards and control 2amps at 250v)  – but I really need to understand information in the other direction. Any Openhab wizards out there?

Advertisements

4 thoughts on “OpenHab and MQTT

  1. This happens to me a lot.

    Node-Red – that sounds interesting I thought – so off I went to Node-red.org to get it – simple enough – download a package to the desktop. Nope – no installer – so off I went to the web. It turns out you need node.js (as if everyone is familiar with that).. so I installed node.js. All done. It doesn’t actually say you have to open a dos box. More assumotions. I opened a DOS box – and ran “npm install”.

    I have no idea what “npm” is – but I ran that. It stopped immediately as it could not find a directory called c:\users\peter\appdata\roaming\npm. I went back on the web and someone suggested merely creating that manually – I did that and started again – this time piles of stuff came up – it all seemed to be going smoothly until a large block of red text appeared in the middle of a HORRENDOUS amount of command line guff- saying I needed to install visual studio 2010 tools. Of course by now I didn’t know if you had to start all over, wipe the existing installation or what. Mattered not as a search for “visual studio 2010 tools” didn’t produce any easy answers.

    I watched a video about node-red and I have to say – it does look fascinating – but I do wish people would pay more attention to detail when suggesting people go off and try things (I’m not referring to Doreas who did a fine thing bringing this to our attention – but the guys who make the websites with the installation materials). Our friend who made the Eclipse environment for us has done a CRACKING job – no doubt about it – every detail is there – except not – there’s an assumption that everyone has Python27 installed on their PC. Even then – once one ends up with a complete development environment that compiles the AT demo perfectly – we’ve now played with 4 Windows machines, trying to get the LUA implementation to compile – each machine has a separate reason why it won’t compile and only one of them will.

    Is anyone out there aware of a one-stop installation for node-red? Right now I’ve filled up more space on my hard drive and have no idea how to proceed further.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s