OH2 - Item - Sitemap

Hi

I have created an item:
String AlarmStatus “Alarm Status” { channel=“verisure:VerisureAlarm:50646270:alarmstatus”}

If I query the REST API - http://localhost:8080/rest/items/AlarmStatus

I get:

{
“link”: “http://localhost:8080/rest/items/AlarmStatus”,
“state”: “unarmed”,
“stateDescription”: {
“readOnly”: true,
“options”: []
},
“type”: “StringItem”,
“name”: “AlarmStatus”,
“label”: “Alarm Status”,
“tags”: [],
“groupNames”: []
}

On my sitemap I have:
Text item=AlarmStatus

Yet it does not display the state. Just the label changes to “Alarm Status”. Am I missing something fundamental here?

Ok. It does in fact work. I just have to wait until the scheduler in the binding refreshes the data then it appears in the basic UI… How can I make it work instantly?

I built the JAR and installed in the latest snapshot of oh2. Getting the same behaviour where the basic UI gets the value only as the refresh is run in the plugin and the method below is called… The classic ui doesnt display a value at all.

updateState(new ChannelUID(getThing().getUID(), CHANNEL_ALARM_STATUS), getAlarmStatus());

Your label is missing a placeholder through which you can see the current state of the item. Try:

String AlarmStatus "Alarm Status [%s]" { channel="verisure:VerisureAlarm:50646270:alarmstatus"}

Thats it! Thanks! Stupid me tried to use %s in the sitemap file and not in the item file.

You could achieve the same output if you had the label in the sitemap only:

Text item=AlarmStatus label="Alarm Status [%s]"

I mustve forgotten the brackets. How can you control whats on the left and whats on the right side?