MQTT Not updating on subscribe

HI, I am very much a noob to Openhab and MQTT. But certainly enjoying playing around with them.

I have a test sitemap setup, and a switch which is turning an LED on or off on an arduino board. This works fine. As part of the code on the arduino I am publishing back the value of the LED Status (1 or 0). I have a text item on the frame that is supposed to show the status of the led, however this does not update when the switch value changes. It does update of I refresh the page however. I have tested with MQTT.fx and the publish side of things is working fine, so the arduino code is not the issue.

Code is below.

// This is the test items file
Switch TestSwitch “Test Switch"
Switch LED_Test “LED Test” {mqtt=”>[broker:inTopic:command:ON:1],>[broker:inTopic:command:OFF:0]"}
Number LED_Status “LED Status” {mqtt="<[broker:LEDStatus:state:default]"}

sitemap test label=“Test Sitemap” {
Frame label=“Test” {
Switch item=TestSwitch
Switch item=LED_Test
Text item=LED_Status <---- this is the item that is not updating unless a page refresh is done

please use code fences (``` or one of the Icons on the right), makes it easier to read.

and then, please have a look in your events.log, from what you’re telling, the state update via mqtt works. There should be entries, if you changed the LEDs.
There might be some poblems with auto refresh with OH2.2 stable, (e.g. No autoupdate in basicui after sitemap update).

Thanks for the reply Thomas. Forgive me for such a simple question but where would I find the events.log (is this the tail log in openhab?). Sorry, very much a noob

If new to openHAB, a good starting point are the docs :rofl:

as sihui already pointed you to the docs, one word for better understanding: openHAB is primarily a backend system, combining different home automation related systems together, so you can automate within and between different systems.
The UI(s) are only a means to show something happening in the backend. That being said: don’t rely on the UI, look at the logs or the console if you’re experiencing issues. :wink:

and to add to sihui’s hint, if completely new to openHAB, there’s a ton of documentation already in place:

just keep digging through! It’s a bit of a steep learning curve, but worth it - and you can always come to the forum for help, if you’re stuck.

1 Like

Thanks suhui. Much appreciated. I do use the documentation quite a bit. Its how I have got things working so far. And now I also have the log working, so cheers for that.

1 Like

Steep learning curve, thats true (for a windows developer its a whole new world), but great fun. Thanks for the help so far.