Open proggprod opened 2 years ago
Similar to https://github.com/openhab/openhab-core/issues/2000. I would argue the severity of this log message should be lowered to DEBUG maybe.
+1
I have the same issue, an oh-repeater that lists the different lights, some as switches, some with dimming channels, some with colortemp etc. They are strickly named so the widget checks for existence via naming conventions.
The problem
Can not check for NULL in widget yaml.
When creating dynamic / intelligent widgets that interact with a range of similar items it should be possible to check for NULL without throwing an error in the log. eg a light control widget that responds slightly differently depending on whether the light in question is a switch on/off only, dimmable, CCT, RGB, some with motion sensors, some with motion sensors and light sensors.
I have 13 lights, a combination of different types, and when I load the page with 13 widgets there is a significant delay while all these errors happen, then everything functions as normally, except for the dirty log.
I started a discussion on the forum about this https://community.openhab.org/t/widget-check-if-item-exists/134910/10
Your suggestion
It should be possible to check for a null by coding something like this in widget yaml
visible: '=(items[props.lightItem + "_Brightness"].state != null) ? true: false'
if the item Hall_Light is the light in question, it will look for Hall_Light_Brightness (to check if it is a dimmable light), if it doesn't exist, it should not throw an error to the log.
Your environment
Additional information