I have a delay in the role of closing window blinds. Occurs randomly and most often it is about 7 seconds. Other openhab functions work quickly. Please tell me where the error is in the code.
import org.joda.time.*
import org.openhab.model.script.actions.Timer
var timer0
var timer1
var timer2
var timer3
var timer4
var timer5
var timer6
var timer7
var timer8
var timer9
rule "Nbox_off"
when
Time cron "0 30 0 * * ?"
then
sendCommand(nbox, OFF)
postUpdate(nbox, OFF)
end
rule "Roleta all up"
when
Item roleta_all received command UP
then
sendCommand(roleta_salonOK, UP)
sendCommand(roleta_salonT, UP)
sendCommand(roleta_gosc, UP)
sendCommand(roleta_kuchnia, UP)
end
rule "Roleta all down"
when
Item roleta_all received command DOWN
then
sendCommand(roleta_salonOK, DOWN)
sendCommand(roleta_salonT, DOWN)
sendCommand(roleta_gosc, DOWN)
sendCommand(roleta_kuchnia, DOWN)
end
rule "Roleta salonOK up"
when
Item roleta_salonOK received command UP
then
sendCommand(roleta_salonOK_open_switch, ON)
timer0 = createTimer(now.plusSeconds(21), [|
sendCommand(roleta_salonOK_open_switch, OFF)
timer0 = null
])
end
rule "Roleta salonOK close"
when
Item roleta_salonOK received command DOWN
then
sendCommand(roleta_salonOK_close_switch, ON)
timer1 = createTimer(now.plusSeconds(21), [|
sendCommand(roleta_salonOK_close_switch, OFF)
timer1 = null
])
end
rule "Roleta salonOK stop"
when
Item roleta_salonOK received command STOP
then
sendCommand(roleta_salonOK_open_switch, OFF)
sendCommand(roleta_salonOK_close_switch, OFF)
{
timer0 = null
timer1 = null
}
end
rule "Roleta salonT up"
when
Item roleta_salonT received command UP
then
sendCommand(roleta_salonT_open_switch, ON)
timer2 = createTimer(now.plusSeconds(30), [|
sendCommand(roleta_salonT_open_switch, OFF)
timer2 = null
])
end
rule "Roleta salonT close"
when
Item roleta_salonT received command DOWN
then
sendCommand(roleta_salonT_close_switch, ON)
timer3 = createTimer(now.plusSeconds(23), [|
sendCommand(roleta_salonT_close_switch, OFF)
timer3 = null
])
end
rule "Roleta salonT stop"
when
Item roleta_salonT received command STOP
then
sendCommand(roleta_salonT_open_switch, OFF)
sendCommand(roleta_salonT_close_switch, OFF)
{
timer2 = null
timer3 = null
}
end
rule "Roleta gosc up"
when
Item roleta_gosc received command UP
then
sendCommand(roleta_gosc_open_switch, ON)
timer4 = createTimer(now.plusSeconds(21), [|
sendCommand(roleta_gosc_open_switch, OFF)
timer4 = null
])
end
rule "Roleta gosc down"
when
Item roleta_gosc received command DOWN
then
sendCommand(roleta_gosc_close_switch, ON)
timer5 = createTimer(now.plusSeconds(21), [|
sendCommand(roleta_gosc_close_switch, OFF)
timer5 = null
])
end
rule "Roleta gosc stop"
when
Item roleta_gosc received command STOP
then
sendCommand(roleta_gosc_open_switch, OFF)
sendCommand(roleta_gosc_close_switch, OFF)
{
timer4 = null
timer5 = null
}
end
rule "Roleta kuchnia up"
when
Item roleta_kuchnia received command UP
then
sendCommand(roleta_kuchnia_open_switch, ON)
timer6 = createTimer(now.plusSeconds(21), [|
sendCommand(roleta_kuchnia_open_switch, OFF)
timer6 = null
])
end
rule "Roleta kuchnia close"
when
Item roleta_kuchnia received command DOWN
then
sendCommand(roleta_kuchnia_close_switch, ON)
timer7 = createTimer(now.plusSeconds(21), [|
sendCommand(roleta_kuchnia_close_switch, OFF)
timer7 = null
])
end
rule "Roleta kuchnia stop"
when
Item roleta_kuchnia received command STOP
then
sendCommand(roleta_kuchnia_open_switch, OFF)
sendCommand(roleta_kuchnia_close_switch, OFF)
{
timer6 = null
timer7 = null
}
end
rule "Roleta wykusz up"
when
Item roleta_wykusz received command UP
then
sendCommand(roleta_wykusz_open_switch, ON)
timer8 = createTimer(now.plusSeconds(21), [|
sendCommand(roleta_wykusz_open_switch, OFF)
timer8 = null
])
end
rule "Roleta wykusz close"
when
Item roleta_wykusz received command DOWN
then
sendCommand(roleta_wykusz_close_switch, ON)
timer9 = createTimer(now.plusSeconds(21), [|
sendCommand(roleta_wykusz_close_switch, OFF)
timer9 = null
])
end
rule "Roleta wykusz stop"
when
Item roleta_wykusz received command STOP
then
roleta_wykusz_open_switch.sendCommand(OFF)
sendCommand(roleta_wykusz_close_switch, OFF)
{
timer8 = null
timer9 = null
}
end
// this assumes you also have the wake on lan binding configured.
rule "Power on TV via Wake on LAN"
when
Item LG_TV0_Power received command ON
then
sendCommand( LG_TV0_WOL, ON)
end
// for relative volume changes
rule "VolumeUpDown"
when Item LG_TV0_VolDummy received command
then
switch receivedCommand{
case 0: LG_TV0_Volume.sendCommand(DECREASE)
case 1: LG_TV0_Volume.sendCommand(INCREASE)
}
end
// for relative channel changes
rule "ChannelUpDown"
when Item LG_TV0_ChannelDummy received command
then
var currentChannel = LG_TV0_ChannelNo.state as DecimalType
switch receivedCommand{
case 0: LG_TV0_ChannelNo.sendCommand(currentChannel - 1)
case 1: LG_TV0_ChannelNo.sendCommand(currentChannel + 1)
}
end
// wywylanie tekstu
rule "Komunikat"
when
Item vTVMessage changed
then
actions.showToast("Hello World")
actions.showToast("http://192.168.1.50:8080/icon/energy?format=png","Hello World")
end