I’ve been experimenting with OpenHAB, MQTT Binding and Mosquitto on my Raspberry Pi 2, and mqtt-spy on my Windows laptop. I’ve have succeeded in doing the following:
- Creating a custom sitemap to display via basicui in a web browser, with some items on it.
- Sending a message from mqtt-spy to change a number on the UI, which updates live in my web browser
- Using both a slider and a switch in the browser to send MQTT messages, which I can see using mqtt-spy.
However, what I can’t do is use an MQTT message from mqtt-spy to modify the position of the switch or slider remotely. I’ve tried enough combinations of configuration options to doubt whether it’s even possible. I can post my config files if necessary but for now I’d like to know if this something that can be achieved at all?
After sending the message (with a number, I presume) to the item that is represented by a slider on your sitemap, have you tried to refresh the web page? I have noticed that some of my sitemap elements (that are connected to MQTT; although I don’t think that is the cause) are not being refreshed automatically in the BasicUI (it does in the Android app, though).
Yes, I’ve tried refreshing the browser and the switch position doesn’t change. I haven’t tried any Android/iPhone apps yet. I know my MQTT message is getting through, because the item responds with another MQTT message, the same one I get when I click the switch in the browser. But no change in the browser graphic.
My apologies, I see you were asking about the slider; I was describing the behaviour of the switch. In fact, the slider does behave as you suggest, moving to the correct value when I refresh the page. So this appears to be a shortcoming of OpenHAB. Still concerned that the switch isn’t behaving though.
Just an update for anyone interested, I’ve fixed the problem; the behaviour described in my original post is possible. The problem may have been as simple as not refreshing the browser between trying different options. Editing the .items file changes the behaviour without a refresh, but the effects of the change don’t propagate fully until you do.