Hm, did it as proposed but the blind still moves based on calculated time when it receives the 0% or 100% command. Why the hell the rule doesn’t skip the calculation step in these two cases? Obviously there is still something wrong… Here’s the new rule again. Can someone find the “bug” in it?
val Number WZ_Rollo_01_100 = 30
var Number RolloTime_01
var Number RolloDifference = null
var String RolloDirection = null
var Timer timer = nullrule “WZ_Rollo_01_Alexa”
when
Item WZ_Rollo_01_Alexa received command
thenif (receivedCommand > WZ_Rollo_01_Pos.state) { RolloDifference = ((receivedCommand as DecimalType).intValue-(WZ_Rollo_01_Pos.state as DecimalType).intValue) RolloDirection = "DOWN"
}
if (receivedCommand < WZ_Rollo_01_Pos.state) { RolloDifference = ((WZ_Rollo_01_Pos.state as DecimalType).intValue-(receivedCommand as DecimalType).intValue) RolloDirection = "UP"
}
if ((receivedCommand as DecimalType).intValue == 100) { RolloDirection = "DOWN" RolloTime_01 = null
}
if ((receivedCommand as DecimalType).intValue == 0) { RolloDirection = "UP" RolloTime_01 = null
}
if (RolloDirection !== null) { RolloTime_01 = (RolloDifference/100) * WZ_Rollo_01_100 WZ_Rollo_01.sendCommand(RolloDirection) if (RolloTime_01 !== null) { if (timer === null) { timer = createTimer(now.plusSeconds(RolloTime_01.intValue), [| WZ_Rollo_01.sendCommand(STOP) timer = null ]) } } WZ_Rollo_01_Pos.sendCommand(receivedCommand)
}
end