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