What fundamental knowledge am i missing that I seem unable to write a simple rule?
/* ----- 160816 MaxG: added to prevent shutter commands every minute
var boolean ShutterHouseLivingWestClosed = false
/* ----- 160815 -- check azimuth and shut roller shutter on western window ----- */
rule "Autoshading Roller Shutter Living West"
when
Item Sun_Azimuth changed
then
var int azimuth = (Sun_Azimuth.state as DecimalType).intValue
logInfo("Shutter0.rule", "Shutter_House_Living_West " + azimuth)
// if sun shines into west window and it is not cloudy, shut the roller shutter
// if (azimuth > 295 && azimuth < 333) {
//if (azimuth > 295 && azimuth < 333 && Weather_Cloudy.state != OFF && ShutterHouseLivingWestClosed=false) {
//if (azimuth > 295 && azimuth < 333 && Weather_Cloudy.state != OFF && !ShutterHouseLivingWestClosed) {
if (azimuth > 295 && azimuth < 333 && Weather_Cloudy.state != OFF) {
logInfo("Shutter1.rule", "Shutter_House_Living_West is DOWN (command)")
sendCommand(Shutter_House_Living_West, DOWN)
ShutterHouseLivingWestClosed = true
}
//else if (azimuth > 293 && azimuth < 295 && ShutterHouseLivingWestClosed=true) {
//else if (azimuth > 293 && azimuth < 295 && ShutterHouseLivingWestClosed) {
else if (azimuth > 293 && azimuth < 295) {
logInfo("Shutter2.rule", "Shutter_House_Living_West is UP (command)")
sendCommand(Shutter_House_Living_West, UP)
ShutterHouseLivingWestClosed = false
}
end
The error I am getting is either:
or
The rule works if I leave out any references to ShutterHouseLivingWestClosed.
Are there some samples somewhere, how variables need to be defined, updated, and executed?