-->
Page 1 of 1

Control ESP8266 chip from Openhab via MQTT

PostPosted: Sun Apr 01, 2018 2:14 pm
by thomzendk
Hello boys and girls!

Im getting grey hairs all to soon! :)

-I have started looking into Smarthouse, and my first project is to be able to make everything wireless on/off controlled...
For that I have used a Raspberry PI3, installed Openhab2 with MQTT, and using ESP8266 (ESP12F Devkit V3), chip to control relay (and for now just a LED).

My state:
I have connected the ESP8266 to my Wifi, and im able to control the LED via http (the ESP's ip adress), or through commands in my MQTT.fx terminal, when I use the MQTT terminal I use this command:

Topic: kontor/cmnd/power
And message, is either ON or OFF.

The ESP will power on/off the led, and respond with:
Topic: kontor/RESULT
And the message is: {"POWER":"ON"}

My issue:
-So far so good, I have full control over the ESP, but my problem is when I try to make use of this through Openhab, as far I can see, I need to tell the broker adress in the "Items" file, and of course make a Switch in sitemap, but im out luck getting it to work, found some guide, and trying to copy, but I cant get it to work at all (Of coruse the goal is, when I open http://openhab: i can see the state, and change it, but first im trying to get on/off working (and then the initial state isnt as important, of it changes anything)....

Hope anyone has some good ideas! :)

Regards