Hello everyone.
I have a simple rule to getting RollerShutters down at an specific sun elevation if there is no heavy wind conditions.
Here the items:
Number Sun_Elevation “Sun Elevation” { channel=“astro:sun:home:position#elevation” }
Number Wind_Speed “Viento [%.2f km/h]” { weather=“locationId=Home, type=wind, property=speed” }
Number Temperature “Temperature [%.2f °C]” { weather=“locationId=Home, type=temperature, property=current” }
// Setpoits
Switch RS_Automation "Automatizar" <clock> (Casa)
Number Wind_Threshole "Limite por viento" <wind> (Casa)
Number Up_Shutter_Threshole "Subir toldos a:" <sunset> (Casa)
Number Down_Shutter_Threshole "Bajar todos a:" <sunrise> (Casa)
And here is the rule that is failing:
var int RS_Cycle = 0
rule "Autoshading RollerShutter"
when
Item Sun_Elevation changed
then
if (RS_Automation.state == ON)
{
var int WindSpeed = (Wind_Speed.state as DecimalType).intValue
var int elevation = (Sun_Elevation.state as DecimalType).intValue
var int WindThreshole = (Wind_Threshole.state as DecimalType).intValue
var int UpShutterThreshole = (Up_Shutter_Threshole.state as DecimalType).intValue
var int DownShutterThreshole =(Down_Shutter_Threshole.state as DecimalType).intValue
if (elevation > DownShutterThreshole && RS_Cycle == 0 && WindSpeed < WindThreshole) {
Shutters?.members.forEach(r | sendCommand(r, DOWN))
logInfo( "RS_Autoshading RollerShutter", "Amaneciendo, toldos abajo." )
RS_Cycle = 1
}
}
end
Thresholes are changed through UI and are in sitemap defined like this:
Frame label="Configuracion"
{
Setpoint item=Wind_Threshole minValue=0 maxValue=100 step=2
Switch item=RS_Automation
Setpoint item=Down_Shutter_Threshole minValue=0 maxValue=100 step=1 visibility=[RS_Automation==ON]
Setpoint item=Up_Shutter_Threshole minValue=0 maxValue=100 step=1 visibility=[RS_Automation==ON]
}
The error I am getting is:
14:00:55.478 [INFO ] [marthome.event.ItemStateChangedEvent] - Sun_Elevation changed from 62.04 to 61.74
14:00:55.498 [ERROR] [.script.engine.ScriptExecutionThread] - Error during the execution of rule ‘Autoshading RollerShutter’: org.eclipse.smarthome.core.library.types.DecimalType
And I can’t find the way to solve it.
Could you pkease give a hand with it.
Thanks. Regards.
Gonzalo