I’m trying to migrate my old OH1 rules and face some strange issues.
Here is my rule
rule "OG R1 Beschattung"
when
Item OG_R1_Beschattungsautomatik received update or
Item OGR1GlastasterBEGT2Tx01_Temperatur received update or
Item OGR1_BeschattungMinTemp received update or
Item OGR1_BeschattungDeadband received update or
Item BeschattungLamellenPosition received update or
Item OGR1Beschattungssteuerung received update
then
val currentRoomTemp = OGR1GlastasterBEGT2Tx01_Temperatur.state as Number
val tempLimit = OGR1_BeschattungMinTemp.state as Number
val tempDeadBand = OGR1_BeschattungDeadband.state as Number
val automatic = transform("MAP","beschatttungscontrol.map",KGR2GlastasterBEGT2Tx01_OGR1Beschattungssteuerung.state.toString)
logInfo("openhab", " ******** OG R1 automatic = {}", automatic ) // shows transform doesnt work
if ( automatic == "2" ) return; //"OFF" ) return ;
// exectue Beschattung
logInfo("openhab", " ******** OG R1 check automatic == FORCED or too hot {} {} {} {} {}" , currentRoomTemp > tempLimit + tempDeadBand, currentRoomTemp , tempLimit , tempDeadBand , tempLimit + tempDeadBand )
if ( currentRoomTemp > tempLimit + tempDeadBand || automatic == "3" ){ //"FORCED" ) {
if ( OGJalousienJAL080102_KanalgRaffstore.state < 95) {
logInfo("openhab", " ******** lowering rollershutter OG R1" )
OGJalousienJAL080102_KanalgRaffstore.sendCommand(100)
}
logInfo("openhab", " ******** update Lamelle OG R1 {}", BeschattungLamellenPosition )
OGJalousienJAL080102_KanalGLamelle.sendCommand(BeschattungLamellenPosition.state as Number)
return ;
}
logInfo("openhab", " ******** OG R1 check automatic != FORCED or too cold")
if ( currentRoomTemp < tempLimit && automatic != "3" ) { //"FORCED") {
if ( OGJalousienJAL080102_KanalgRaffstore.state > 10) {
logInfo("openhab", " ******** rising rollershutter OG R1" )
OGJalousienJAL080102_KanalgRaffstore.sendCommand(0)
}
OGJalousienJAL080102_KanalGLamelle.sendCommand(0)
return ;
}
end
here is the openhab.log content:
2021-02-28 13:29:27.331 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'Beschattung.rules'
2021-02-28 13:29:32.188 [INFO ] [rg.openhab.core.model.script.openhab] - ******** OG R1 automatic = 3
2021-02-28 13:29:32.190 [INFO ] [rg.openhab.core.model.script.openhab] - ******** OG R1 check automatic == FORCED or too hot false 25.2 °C 22.0 °C 0.5 °C 568.80
2021-02-28 13:29:32.192 [INFO ] [rg.openhab.core.model.script.openhab] - ******** update Lamelle OG R1 BeschattungLamellenPosition (Type=NumberItem, State=72.20571383, Label=Lamellen Position, Category=null)
Strange is especially the math 22.0 + 0.5 = 568.80. There must be something I missed in math
also, the transform obviously does not work as expected… the beschattungscontrol.map looks like
1=AUTO
2=OFF
3=FORCED
any help welcome