I’ve a problem, which I can’t solve: I check the status of my window contacts as follows:
var Things = Java.type('org.openhab.core.model.script.actions.Things');
var FK_Kueche=Things.getThingStatusInfo("avmfritz:HAN_FUN_CONTACT:192_168_178_1:113241013643_1").getStatus();
events.sendCommand("Status_FK_Kueche",FK_Kueche.toString());
I would like to achieve when the status OFFLINE is reported, this is displayed in red colour. I try following YAML code
I’ve considered this thread but, I didn’t understand it. Therefore my question here. I don’t know why there is a minus sign after the red OFFLINE symbol (on purpose).
There is a - after the label because you are still using an oh-label-item instead of a oh-list-item as that topic explains.
An oh-label-item and an oh-list-item are not the same thing. The list item is the baseline oh component for adding information to a list. All the other oh-[something]-item components are just the oh-list-item with an additional component already added in. So, in the case of the oh-label-item, that is a list item that already has a label and then you are adding a second label to it. The - is the built-in label’s default value because you haven’t given that label any other value.
The issue with your original question is that there is no direct access to the style of the built-in label on an oh-label-item. To easily control the style of the label then 1) don’t use the label item, use the list item, 2) add the label yourself, and then 3) add the style object to that label. You have done steps 2 and 3, but not step 1.