My item is defined as:
Number:Angle Sun_Azimuth "Azimuth Sonne" <sun> (gStatus, gAstro, gSun) { channel="astro:sun:local:position#azimuth" }
My condition within my rule is like follows:
if (Sun_Azimuth.state > 100.0) {
...
Even Sun.Azimuth is far above 100 (if I send Sun_Azimuth.state to telegram I see for example 314.4855…°) the condition is not evaluated to true.
What is going wrong?
In example rules I saw a lot of type conversions but for Azimuth .state it should be possible to compare easily to a number like 100.0.
rossko57
(Rossko57)
May 3, 2020, 9:35pm
2
See -
Your Item has UoM, Units of Measurement. So it’s effectively 15 °C not just 15, and comparing with just 12 is apples-and-oranges.
This is one of the clumsier parts of UoM.
You can either extract just-the-number or compare with a temperature.
if( (localHourlyForecast12Temperature.state as QuantityType<Number>).intValue <= 12 )
if( localHourlyForecast12Temperature.state <= 12 | "°C" )
You’ve already worked that out though really, you just need to give units to your 100
if (Sun_Azimuth.state > 100.0 | "°" ) {
or radians or whatever
It works! Thanks a lot.
I didn’t saw this notation before. I look in so many examples.
Is there any source there this is documented? I’ve frequently problems with type conversions and type in general.
Thanks a lot for your endavour!
rossko57
(Rossko57)
May 3, 2020, 10:31pm
4
Thank you!
I know the Wiki, but this I overlooked apaprently.
system
(system)
Closed
June 15, 2020, 12:18pm
6
This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.