I am getting unused variable warning when I create timer based rules. Is there a better way of doing this? The rules seem to work, but I’m not entirely certain I’m not creating other problems. It seems like the insteon.rules file may be refreshed at least three times…
Here’s the code:
// This rule implements the “going out two hours” command to turn on and off various lights based on a timer
rule "TwoHourOut"
when
Item TwoHourOut received command ON
then
sendCommand(fronthall, ON);
sendCommand(frontporch, ON);
var Timer timer_lightoff = createTimer(now.plusMinutes(5)) [|
sendCommand(frontporch, OFF);
sendCommand(fronthall, OFF);
logInfo( "rules", "Timer - front porch going off.[{}]", frontporch.state );
]
var Timer timer_lighton = createTimer(now.plusMinutes(120)) [|
sendCommand(frontporch, ON);
sendCommand(fronthall, ON);
logInfo( "rules", "Timer - front porch going back on. [{}]", X10Remote3.state );
]
end
Here’s the log file:
2018-01-07 13:12:17.359 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'insteon.rules’
2018-01-07 13:12:27.915 [INFO ] [el.core.internal.ModelRepositoryImpl] - Validation issues found in configuration model ‘insteon.rules’, using it anyway:
The value of the local variable timer is not used
The value of the local variable timer_lightoff is not used
The value of the local variable timer_lightoff is not used
The value of the local variable timer_lighton is not used
2018-01-07 13:12:28.018 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model ‘insteon.rules’
- Platform information:
- Hardware: Raspberry Pi B+
- OS: raspbian
- Java Runtime Environment: which java platform is used and what version
- openHAB version:
- Issue of the topic: please be detailed explaining your issue
- Please post configurations (if applicable):
- Items configuration related to the issue
- Sitemap configuration related to the issue
- Rules code related to the issue
- Services configuration related to the issue
- If logs where generated please post these here using code fences: