I’ve starting to use sitemaps now for my basicUI interface, but I won’t work the way I want.
I have a switch for a smart power outlet (with integrated meter), and I want to show the power consumption of the lamp under the switch.
Yes!
Your item is wrong, and missing the value code… This is all my items for the same device (hs110):
Switch MySmartPlug1SW "My Smart Plug1 on/off [%s]" <poweroutlet_eu> [ "Outlet" ] { channel="tplinksmarthome:hs110:82E954:switch" }
Switch MySmartPlug1SWLed "My Smart Plug1 Switch Led [%s]" <switch> { channel="tplinksmarthome:hs110:82E954:led" }
Number MySmartPlug1Signal "My Smart Plug1 Signal [%d dBm]" <cu_wifi> { channel="tplinksmarthome:hs110:82E954:rssi" }
Number MySmartPlug1Power "My Smart Plug1 Power [%d W]" <Energy> { channel="tplinksmarthome:hs110:82E954:power" }
Number MySmartPlug1Energy "My Smart Plug1 Energy Usage [%.1f kWh]" <Energy> { channel="tplinksmarthome:hs110:82E954:energyUsage" }
Number MySmartPlug1Current "My Smart Plug1 Current Power [%.1f A]" <Energy> { channel="tplinksmarthome:hs110:82E954:current" }
Number MySmartPlug1Voltage "My Smart Plug1 voltage [%.1f V]" <Energy> { channel="tplinksmarthome:hs110:82E954:voltage" }
As Kim says, the part of the label in square brackets [ ] describes how to display the Item state value. No [ ], no display.
Note that specifying the label in the sitemap overrides the default label in the Item definition, so in this case you’d need to edit the sitemap label (or omit it so that it defaults to the Item version)
EDIT - ive just read that I’m wrong here; sitemap label=“text” should retain the [format] from an Item definition. label=“text []” would supress it.
There is, but I cant remember where it´s documented…
There is something here: https://www.openhab.org/docs/configuration/items.html#label
Actually, you should perhaps read most of the items docs through. It will give you a major overview of how to create items. You seem to be missing some very basic part of it.
I think I recall there is a full list somewhere showing all syntaxs. It´s some java-stuff as far as I recall. I normally search the community when I have problems, otherweise I use what I remember.
EDIT… While I remember…
You should look at your logfile as well. I believe openhab should have showed an error for your item due to the missing " " in the channel definition.
Look in events.log or PaperUI to find out what the state of your Item actually is. a display “-” usually means it is NULL or UNDEF.
When you edit an xxx.items file the reload causes states to go NULL until the next update comes along.
What is the secret format that you actually used? [%s] is useful for temporary diagnostics.
I dont use labels in sitemaps, unless I have a very specific reason to… I define the labels in my items insted as you can see from my items, and in sitemap I just enter:
sitemap R207 label=“R207”
{
Switch item=MySmartPlug1SW
Text item=MySmartPlug1SWLed
Text item=MySmartPlug1Signal
Text item=MySmartPlug1Power
Text item=MySmartPlug1Energy
Text item=MySmartPlug1Current
Text item=MySmartPlug1Voltage
}
There is no reason to do anything else, unless you want a specific methode/look in BasicUI.
It will happen if the items hasn´t updated yet or if the item definition is wrong somehow…
Look at your logfile, it may show something, cause it will show if the item isn´t defined correctly.
If it´s the same item which shows 155W in paperUI, the item do update, and it should show value in sitemap as well, if you have the item defined correctly in your sitemap. (look out for mispelling/typos etc).