HABPanel: Custom Widget with Items

Hi there,

I’m pretty new to programming custom widgets for HABPanel. To get more familiar with custom widgets, I’m working on a very simple example. The only thing I want to do is to show the temperature from a sensor which is linked to openhab via the jeelink binding.

After installing the sensor with the binding, the right value is shown in my paper UI under “controls”. So the sensor and the binding seem to work.

To create the custom widget I use the very simple code:

The temperature is {{itemValue(‘Cur_Temp’)}}

In this code I have a reference to the item ‘Cur_Temp’ which inputs the temperature value from the sensor. To initialize that item, I have created a txt-file with the name temp.items in the folder \OPENHABIANPI\openHAB-conf\items with the following code:

Number Cur_Temp “Temperature [%.2f °C]” {channel=“jeelink:lacrosse:30:temperature”}

And that is where my problems begin. No matter what I do, the ouput auf my widget is:

The temperature is N/A

For some reason the item does not work and I don’t know how to solve the problem. I have deleted the cache of my browser, restarted my raspberry pi (=openhab server) and so on… the result is always the same.

Can anybody help me with that problem? Thank you very much in advance!

Did you configure your item in the paperUI or the items file or both?
On habpanel, create a dummy widget linked to Cur_Temp, what’s the value?

Hey Vincent!

thank you very much for your help. You gave me the right hint to solve my problem. I had to turn off the “simple mode” for my items in the Paper UI. Now it works!

You can define an item through the paperUI OR item file but not both!!
For consistency try to use only one method
I use files as it’s more powerful and flexible
Also some items can only be defined through files

Hi Vincent!

When I use the Paper UI to configure my items the widget works as expected.
However, creating a text file with the items and saving it to \OPENHABIANPI\openHAB-conf\items with the ending *.items doesn’t work. I don’t understand that. Do you know the reason? Is it a configuration issue? I can’t find anything in the documentation.

the *.items files go to /etc/openhab/items