My experiences so far

To follow up on my introduction: We have our HestiaPi Touch up and running in the makerspace! I 3D printed the (old) case, but since the temperature sensor was too close to the board, this sensor is hanging outside the case. I changed the wiring of the relays to switch a central heating system.

At the moment, the only functionality we use is the web interface (via a VPN) to turn the heating on and off from remote. And the touch screen itself, of course.

Since the basic functionality seems to work, I would like to add some extra features. The first feature would be to send remote messages to the system to change the set temperature. I think this should be possible with MQTT, but I have no idea what to configure for that, or what is already implemented in HestiaPi for this. Is there any documentation available for this?

I looked in /etc/mosquitto, but that directory is (almost) empty. Does that mean that MQTT is not yet functional?

MQTT is already available and fully functional. Check v7 and v8 here:
https://community.hestiapi.com/c/new-releases

So, i’ve got a basic MQTT client running on my laptop:

$ mosquitto_sub -h 192.168.45.61 -d -t hestia/#
Client mosqsub/14062-flying sending CONNECT
Client mosqsub/14062-flying received CONNACK
Client mosqsub/14062-flying sending SUBSCRIBE (Mid: 1, Topic: hestia/#, QoS: 0)
Client mosqsub/14062-flying received SUBACK
Subscribed (mid: 1): 0
Client mosqsub/14062-flying received PUBLISH (d0, q0, r0, m0, 'hestia/local/temperature', ... (4 bytes))
18.8
Client mosqsub/14062-flying received PUBLISH (d0, q0, r0, m0, 'hestia/local/humidity', ... (4 bytes))
59.2

When I change the temperature, I see:

Client mosqsub/14113-flying received PUBLISH (d0, q0, r0, m0, 'hestia/local/tempsetpoint', ... (4 bytes))
18.5

My assumption would be that I can change the temperature with

mosquitto_pub -h 192.168.45.61 -d -t "hestia/local/tempsetpoint" -m 21

This results in:

Client mosqsub/14113-flying received PUBLISH (d0, q0, r0, m0, 'hestia/local/tempsetpoint', ... (2 bytes))
21

on the mosquitto_sub output line, but the temperature is not changed in the web interface. It seems MQTT does not send it’s received values back to OpenHAB? Any hints on how to get it working in two directions?

OK, a bit of background reading first :wink:
In file

/etc/openhab2/items/default.items

line 11

Number TempSetpoint "Temperature Setpoint[%.1f °C]" { mqtt=">[mosquitto:hestia/local/tempsetpoint:state:*:default]" }

defines the variable “TempSetpoint”.
Part of this definition are the MQTT settings. The “>” character explains that the topic following (hestia/local/tempsetpoint) is for outgoing messages. No other definitions are included and this means that the TempSetpoint is not accepting any incoming MQTT commands. Notice the difference with the Raspi12 variable that publishes on 2 different topics and listens to 1 topic.

Switch Raspi12 "Hot Water" { gpio="pin:12", mqtt=">[mosquitto:hestia/local/hotwaterstate:command:ON:1],>[mosquitto:hestia/local/hotwaterstate:command:OFF:0],<[mosquitto:hestia/local/hotwaterstate:state:MAP(binary.map)]" }

I assume a slight modification on the line 11 will allow MQTT commands to set the TempSetpoint too. I don’t have access right now to test but I will do it asap and let you know. I the meantime feel free to let us know if you find the correct syntax :wink:

Here it is

Number TempSetpoint "Temperature Setpoint[%.1f °C]" { mqtt=">[mosquitto:hestia/local/tempsetpoint:state:*:default],<[mosquitto:hestia/local/settempsetpoint:state:default]"}

notice the slightly different topic used (settempsetpoint) for publishing to avoid infinite loops. If you would use the same topic both for subscribing and publishing it would be like holding a phone’s mic next to its speaker and making a noise to trigger something that will never end.
Use the same command you used before. It also accepts decimal points (floats) like 21.5 like that

mosquitto_pub -h 192.168.45.61 -d -t "hestia/local/settempsetpoint" -m 21.5

Let us know here if it worked. Next release will make all parameters two-way via dual MQTT.
Pull requests on Github are always welcome :wink:

Changing temperature through mosquitto works!

First I messed up my mqtt.conf file trying to get it to work, but it turns out that no changes are necessary. Even though /etc/openhab2/services/mqtt.cfg says

mosquitto.url=tcp://localhost:1883

mosquitto is still listening on the external IP of the HestiaPi (should we consider this a bug or feature?). Somehow my other changes prevented your solution from working. After re-installing HestiaPi and changing just this one line in default.items, I can change the Temperature Setpoint via mqtt.

That’ll be the MQTT client - the server would be configured under /etc/mosquitto I would expect (I don’t have a Touch so I’m guessing :P)