Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var Timer timer
- rule "Taend vindmølle"
- when
- //Time cron "0 0/1 * * * ?" // every minute
- Item Voltage received update
- //Item VoltageTime changed
- then
- logInfo("voltage.rules", "Timestate: " + VoltageTime.state)
- logInfo("voltage.rules", "on off mode: ", WindRelayControl.state)
- logInfo("voltage.rules", "Voltage changed" )
- if (WindRelayControl.state.toString == "2"){
- if (Voltage.state <= 56.5){
- sendCommand(WindRelay, ON)
- if(timer!=null) {
- timer.cancel
- timer = null
- }
- timer = createTimer(now.plusSeconds(70)) [|
- //{
- {sendCommand(WindRelay, OFF)}
- //logInfo("voltage.rules", "Relay turned off due to timeout")
- //}
- ]
- }else{
- sendCommand(WindRelay, OFF)
- }
- }else if (WindRelayControl.state.toString == "1") {
- sendCommand(WindRelay, ON)
- }else if (WindRelayControl.state.toString == "0") {
- sendCommand(WindRelay, OFF)
- }
- end
Advertisement
Add Comment
Please, Sign In to add comment