I created an item for the brightness of a light.
Number sLED_brightness "Brightness [%d]" <light> { mqtt="<[mosquitto:homie/5ccf7f15b638/light/brightness:state:default], >[mosquitto:homie/5ccf7f15b638/light/brightness/set:command:*:default]" }
The brightnes can range from 0 to 255.
The Slider goes from 0 to 100.
How can I scale/transform these automatically in openhab?
I guess a workaround would be to create a transformation file with 100 entries.
[0..3]=1
[4..6]=2
[7..9]=3
....
[253..255]=100
Hey Christoph!
There was a very similar question three days ago:
Quick Shot!
I got a weather station which reports in meters per second. But I want kilometers per hours.
I know the calculation is value * 3.6
Do I need to create a rule for this?
Or is it possible to do that inside of an item?
Your problem should be a perfect candidate for a javascript transformation. Looking at your example scale: I’d say it’s important to make sure that the transformation maps 0 to 0 and 255 to 100.
Good luck
1 Like
Thanks.
But I already modified my Arduino sketch to work with percentage (0-100).
This is easier for a person.
And Arduino has a simple map-function for this.
But its nice to see there is a good solution for such problems.
1 Like