Hi to all.
I’ve made an ESP8266 based thermostat with mqtt capability but I don’t know how to interface with openHab2.
My thing need to publish 5 items and receive 3 commands, in detail:
[CMD] RH: exhaust fan, in the form of ON or OFF
[CMD/OUT] SP: setpoint, value from 0 to 255 (integer, transformed to float xx.x by openHab)
[CMD/OUT] ST: state, value from 0 to 5
[OUT] TE: temperature, float value xx.x
[OUT] UM: humidity, float value xx.x
[OUT] RT: thermostat, in the form of ON or OFF
For now in the ESP firmware there is the creation of 5 output topics (es. Matrimoniale/O_RH/) and 3 input topics (es. Matrimoniale/I_SP/) each with the pubblication of the relative parameter.
How can I do for insert my thermostat in openHab2?
I’m very new to OH2, I’ve just installe it yesterday…
Hi Diego, welcome to openHAB.
From the top of my head, you need to:
- install MQTT binding
- setup MQTT broker
- setup a thing for your device
- setup the items of your device
This blog post is a good explanation of how MQTT now works in openHAB.
Step 1 should be no problem for you (using HABmin or PaperUI).
Step 2 can also be done from one of the UIs, there is an explanation in the blog post linked above.
Step 3 and step 4 may be done by .thing and .item files. The syntax is also explained in the blog. This discussion also gives some example.
As Martin has stated, you will need to set up mqtt in OpenHAB. Here are a whole bunch of threads Rich linked to in another thread to help someone else also needing to set up mqtt. The second one from the bottom is a thread I started to learn from scratch
I think to switch from separate commands/values to a json string… seems to be a bit easy and need only 1 command topic and 1 publish topic.
I’m gonna go to study it now…