This is probably a really dumb question, but I just cant figure it out myself…
I am playing around with widgets and the expressions which can be used in these widgets using the “Widgets Expression Tester” in the sidebar.
I have two Number item:
Number:Temperature OWM_Current_Temperature "OWM - Temperatur [%.1f %unit%]" <temperature> (gWeatherOWM, gWeatherValues, gSemWeatherDataOWM) ["Measurement", "Temperature"] { channel="openweathermap:onecall:api:local:current#temperature" }
Number:Dimensionless Dryer_State "State Dryer [%d]" (gStateItems, gLaundry)
Booth items are defined, when logging them in a rule like
log.info("State: {} {}".format(items['Dryer_State'], type(items['Dryer_State']) ) )
log.info("Temp: {} {}".format(items['OWM_Current_Temperature'], type(items['OWM_Current_Temperature']) ) )
this results in
State: 10.0 <type 'org.openhab.core.library.types.QuantityType'>
Temp: 10.9 °C <type 'org.openhab.core.library.types.QuantityType'>
But when using these items in the expression Tester, only for the temperature item a valid state is displayed:
=items.OWM_Current_Temperature
results in
{ "state": "10.9 °C", "displayState": "10,9 °C" }
This looks goof for me, even if I am wondering why a display state is shown when I have not defined it.
whereas
=items.Dryer_State
results in
{ "state": "-" }
This happens with other items I have tested too.
And I really can’t figure out why…
And while I am at it:
In the widgets here in the forum a see two different expressions for accessing the item state in a widget, like above items.ItemName.state and items[].state. I assume, that these are interchangeable, is this correct?
Thanks for your help!