Hello,
I have a Philips hue motion and light sensor that I use via the hue binding in OpenHAB 4.0.
In OpenHAB 2, I could write a rule that depended on the light delivered by the sensor very simply, e.g. using a condition like
I_OG_Deckensensor_Helligkeit.state < 2
However, in OpenHAB 4 this does not work anymore, cause the Item now contains a value that consists of the number and the appended “lx” for “lux”, e.g. “0 lx”. This somehow cannot be handled by me in an OpenHAB rule anymore because everything I try leads to exceptions, e.g.
val int helligkeit = Integer::parseInt(I_OG_Fl_Deckensensor_Helligkeit.state)
results in
[ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule failed: For input string: “0 lx” in lights
There seems to be no way to extract the number from that number + string concatenation delivered by the sensor to perform comparisons on that. I also tried simple castings, usage of .toString and more, it just does not work. Any ideas how to proceed?
Thanks, Torsten