Hue Binding: How do I get the brightness from the lamps state for a rule?

Hej there,

how can I get the state from my hue light bulb?
When I use “items.getItem(‘Name’).state” I get “,,” as a result.
How can I read out/get the value of brightness for a comparison in a if-statement?
Things like e.g. .getBrightness do not work…
What am I missing here???

Your get item state code seems to be wrong if it is returning an empty ‘,’ when it should have three comma separated numbers, which is an HSB coordinate, where the last of those three digits is the brightness.

Well, writing it the way:

var brightness = items.getItem('ITEM_NAME').state.split(',')[2]

works.

But this seems complicated…
In some examples I saw things like:

var brightness = items.getItem('ITEM_NAME').state.getBrightness()

Thank you for the hint of the wrong code… I used JS instead of DSL… Now it works…

1 Like