Seems to be an error with timers. I have been able to get around it by altering the order in which things run. Cheers
@Christopher_Hemmings
Hey Chris,
Could you please share your up-to-date sitemap,items and rules for this?
Cheers,
Greg
Iāll do so tomorrow Greg. Send me a message to remind me in about 10 hours
Sitemap
Frame label="Irrigation"
{
Text item=gIrrigation
{
Text item=Irrigation_Zone1 label="Zone 1 Front Grass [%s]" valuecolor=[Irrigation_Zone1!="Inactive"="green",Irrigation_Zone1=="Inactive"="grey"] icon="faucet"
{
Switch item=SprinklerSystemZone1
Slider item=onHours1 label="Zone 1 Timer?" icon="time" sendFrequency=1
Setpoint item=onHours1 label=" [%d]" icon="none" step=1 minValue=1 maxValue=100
Text item=Irrigation_StartTime1 valuecolor=["green"] icon="rain"
Text item=FrontGrassMoistureTime valuecolor=["green"] icon="time"
Text item=FrontGrassMoisture label="Moisture Level [%d %%]" valuecolor=[>=50="blue", >=30="green", 0="grey", <15="red"] icon="rain"
}
Text item=Irrigation_Zone2 label="Zone 2 Front Garden [%s]" valuecolor=[Irrigation_Zone2!="Inactive"="green",Irrigation_Zone2=="Inactive"="grey"] icon="faucet"
{
Switch item=SprinklerSystemZone2
Slider item=onHours2 label="Zone 2 Timer?" icon="time" sendFrequency=1
Setpoint item=onHours2 label=" [%d]" icon="none" step=1 minValue=1 maxValue=100
Text item=Irrigation_StartTime2 valuecolor=["green"] icon="rain"
}
Text item=Irrigation_Zone3 label="Zone 3 Back Grass [%s]" valuecolor=[Irrigation_Zone3!="Inactive"="green",Irrigation_Zone3=="Inactive"="grey"] icon="faucet"
{
Switch item=SprinklerSystemZone3
Slider item=onHours3 label="Zone 3 Timer?" icon="time" sendFrequency=1
Setpoint item=onHours3 label=" [%d]" icon="none" step=1 minValue=1 maxValue=100
Text item=Irrigation_StartTime3 valuecolor=["green"] icon="rain"
}
Text item=Irrigation_Zone4 label="Zone 4 Back Garden [%s]" valuecolor=[Irrigation_Zone4!="Inactive"="green",Irrigation_Zone4=="Inactive"="grey"] icon="faucet"
{
Switch item=SprinklerSystemZone4
Slider item=onHours4 label="Zone 4 Timer?" icon="time" sendFrequency=1
Setpoint item=onHours4 label=" [%d]" icon="none" step=1 minValue=1 maxValue=100
Text item=Irrigation_StartTime4 valuecolor=["green"] icon="rain"
}
}
}
Items
//*********************************
//Sprinkler System
//***********
String Irrigation_Zone1 (gIrrigationTimes)
String Irrigation_Zone2 (gIrrigationTimes)
String Irrigation_Zone3 (gIrrigationTimes)
String Irrigation_Zone4 (gIrrigationTimes)
Switch SprinklerSystemZone1 "Front Grass Sprinklers" (gIrrigation) [ "Switchable" ] { mqtt=">[broker:SprinklerSystem:command:ON:Z1ON],>[broker:SprinklerSystem:command:OFF:Z1OFF]" }
Switch SprinklerSystemZone2 "Front Garden Sprinklers" (gIrrigation) [ "Switchable" ] { mqtt=">[broker:SprinklerSystem:command:ON:Z2ON],>[broker:SprinklerSystem:command:OFF:Z2OFF]" }
Switch SprinklerSystemZone3 "Back Grass Sprinklers" (gIrrigation) [ "Switchable" ] { mqtt=">[broker:SprinklerSystem:command:ON:Z3ON],>[broker:SprinklerSystem:command:OFF:Z3OFF]" }
Switch SprinklerSystemZone4 "Back Garden Sprinklers" (gIrrigation) [ "Switchable" ] { mqtt=">[broker:SprinklerSystem:command:ON:Z4ON],>[broker:SprinklerSystem:command:OFF:Z4OFF]" }
Number Countdown_Zone1 "Minutes Remaining [%d]" (gIrrigationTimes)
Number Countdown_Zone2 "Minutes Remaining [%d]" (gIrrigationTimes)
Number Countdown_Zone3 "Minutes Remaining [%d]" (gIrrigationTimes)
Number Countdown_Zone4 "Minutes Remaining [%d]" (gIrrigationTimes)
Switch SprinklerSystemSchedule "Schedule Active" (gIrrigationTimes)
DateTime Irrigation_StartTime1 "Zone 1 Last Watered [%1$ta %1$tR]" (gIrrigationTimes)
DateTime Irrigation_StartTime2 "Zone 2 Last Watered [%1$ta %1$tR]" (gIrrigationTimes)
DateTime Irrigation_StartTime3 "Zone 3 Last Watered [%1$ta %1$tR]" (gIrrigationTimes)
DateTime Irrigation_StartTime4 "Zone 4 Last Watered [%1$ta %1$tR]" (gIrrigationTimes)
Number onHours1 "Front Grass Sprinkler Minutes" (gIrrigationTimes)
Number onHours2 "Front Garden Sprinkler Minutes" (gIrrigationTimes)
Number onHours3 "Back Grass Sprinkler Minutes" (gIrrigationTimes)
Number onHours4 "Back Garden Sprinkler Minutes" (gIrrigationTimes)
String IFTTString "If this then that string" (All)
rules
//**************************************************************************************
rule "Zone 1 Inactive"
when
Item SprinklerSystemZone1 received command OFF
then
Countdown_Zone1.postUpdate(0)
Irrigation_Zone1.postUpdate("Inactive")
if (timer1 !== null)
{
timer1.cancel
timer1 = null
}
end
//**************************************************************************************
rule "Zone 2 Inactive"
when
Item SprinklerSystemZone2 received command OFF
then
Countdown_Zone2.postUpdate(0)
Irrigation_Zone2.postUpdate("Inactive")
if (timer2 !== null)
{
timer2.cancel
timer2 = null
}
end
//**************************************************************************************
rule "Zone 3 Inactive"
when
Item SprinklerSystemZone3 received command OFF
then
Countdown_Zone3.postUpdate(0)
Irrigation_Zone3.postUpdate("Inactive")
if (timer3 !== null)
{
timer3.cancel
timer3 = null
}
end
//**************************************************************************************
rule "Zone 4 Inactive"
when
Item SprinklerSystemZone4 received command OFF
then
Countdown_Zone4.postUpdate(0)
Irrigation_Zone4.postUpdate("Inactive")
if (timer4 !== null)
{
timer4.cancel
timer4 = null
}
end
//**************************************************************************************
//Zone 1 Watering
rule "Zone 1 Watering"
when
Item SprinklerSystemZone1 changed to ON
then
if (onHours1.state !== NULL)
{
var Number timeout = onHours1.state as DecimalType
var int lawnTime = (timeout).intValue
postUpdate(Irrigation_StartTime1, new DateTimeType())
Irrigation_Zone1.postUpdate("Active")
if (lawnTime > 0)
{
sendBroadcastNotification("Watering Zone 1 for " + timeout.toString + " minutes")
Irrigation_Zone1.postUpdate("Active " + timeout.toString + " minutes remaining")
Countdown_Zone1.postUpdate(lawnTime)
}
}
else
{
SprinklerSystemZone1.sendCommand(OFF)
onHours1.postUpdate(30)
sendBroadcastNotification("Zone 1 does not have a timer set, this zone has been set to 30 minutes, please try again")
}
end
//**************************************************************************************
//Zone 2 Watering
rule "Zone 2 Watering"
when
Item SprinklerSystemZone2 changed to ON
then
if (onHours2.state !== NULL)
{
var Number timeout = onHours2.state as DecimalType
var int lawnTime = (timeout).intValue
postUpdate(Irrigation_StartTime2, new DateTimeType())
Irrigation_Zone2.postUpdate("Active")
if (lawnTime > 0)
{
sendBroadcastNotification("Watering Zone 2 for " + timeout.toString + " minutes")
Irrigation_Zone2.postUpdate("Active " + timeout.toString + " minutes remaining")
Countdown_Zone2.postUpdate(lawnTime)
}
}
else
{
SprinklerSystemZone2.sendCommand(OFF)
onHours2.postUpdate(30)
sendBroadcastNotification("Zone 2 does not have a timer set, this zone has been set to 30 minutes, please try again")
}
end
//**************************************************************************************
//Zone 3 Watering
rule "Zone 3 Watering"
when
Item SprinklerSystemZone3 changed to ON
then
if (onHours3.state !== NULL)
{
var Number timeout = onHours3.state as DecimalType
var int lawnTime = (timeout).intValue
postUpdate(Irrigation_StartTime3, new DateTimeType())
Irrigation_Zone3.postUpdate("Active")
if (lawnTime > 0)
{
sendBroadcastNotification("Watering Zone 3 for " + timeout.toString + " minutes")
Countdown_Zone3.postUpdate(lawnTime)
}
}
else
{
SprinklerSystemZone3.sendCommand(OFF)
onHours3.postUpdate(30)
sendBroadcastNotification("Zone 3 does not have a timer set, this zone has been set to 30 minutes, please try again")
}
end
//**************************************************************************************
//Zone 4 Watering
rule "Zone 4 Watering"
when
Item SprinklerSystemZone4 changed to ON
then
if (onHours4.state !== NULL)
{
var Number timeout = onHours4.state as DecimalType
var int lawnTime = (timeout).intValue
postUpdate(Irrigation_StartTime4, new DateTimeType())
Irrigation_Zone4.postUpdate("Active")
if (lawnTime > 0)
{
sendBroadcastNotification("Watering Zone 4 for " + timeout.toString + " minutes")
Irrigation_Zone4.postUpdate("Active " + timeout.toString + " minutes remaining")
Countdown_Zone4.postUpdate(lawnTime)
}
}
else
{
SprinklerSystemZone4.sendCommand(OFF)
onHours4.postUpdate(30)
sendBroadcastNotification("Zone 4 does not have a timer set, this zone has been set to 30 minutes, please try again")
}
end
//***************************************************************************
rule "Countdown Zone 1 Timer"
when
Item Countdown_Zone1 received update
then
if (Countdown_Zone1.state as DecimalType >= 1 && SprinklerSystemZone1.state == ON)
{
Irrigation_Zone1.postUpdate("Active " + (Countdown_Zone1.state as DecimalType) + " minutes remaining")
timer1 = createTimer(now.plusMinutes(1)) [|
Countdown_Zone1.postUpdate(Countdown_Zone1.state as DecimalType - 1)
]
}
if (Countdown_Zone1.state as DecimalType == 0 && SprinklerSystemZone1.state == ON)
{
SprinklerSystemZone1.sendCommand(OFF)
sendBroadcastNotification("Finished Watering Zone 1")
}
end
//***************************************************************************
rule "Countdown Zone 2 Timer"
when
Item Countdown_Zone2 received update
then
if (Countdown_Zone2.state as DecimalType >= 1 && SprinklerSystemZone2.state == ON)
{
Irrigation_Zone2.postUpdate("Active " + (Countdown_Zone2.state as DecimalType) + " minutes remaining")
timer2 = createTimer(now.plusMinutes(1)) [|
Countdown_Zone2.postUpdate(Countdown_Zone2.state as DecimalType - 1)
]
}
if (Countdown_Zone2.state as DecimalType == 0 && SprinklerSystemZone2.state == ON)
{
SprinklerSystemZone2.sendCommand(OFF)
sendBroadcastNotification("Finished Watering Zone 2")
}
end
//***************************************************************************
rule "Countdown Zone 3 Timer"
when
Item Countdown_Zone3 received update
then
if (Countdown_Zone3.state as DecimalType >= 1 && SprinklerSystemZone3.state == ON)
{
Irrigation_Zone3.postUpdate("Active " + (Countdown_Zone3.state as DecimalType) + " minutes remaining")
timer3 = createTimer(now.plusMinutes(1)) [|
Countdown_Zone3.postUpdate(Countdown_Zone3.state as DecimalType - 1)
]
}
if (Countdown_Zone3.state as DecimalType == 0 && SprinklerSystemZone3.state == ON)
{
SprinklerSystemZone3.sendCommand(OFF)
sendBroadcastNotification("Finished Watering Zone 3")
}
end
//***************************************************************************
rule "Countdown Zone 4 Timer"
when
Item Countdown_Zone4 received update
then
if (Countdown_Zone4.state as DecimalType >= 1 && SprinklerSystemZone4.state == ON)
{
Irrigation_Zone4.postUpdate("Active " + (Countdown_Zone4.state as DecimalType) + " minutes remaining")
timer4 = createTimer(now.plusMinutes(1)) [|
Countdown_Zone4.postUpdate(Countdown_Zone4.state as DecimalType - 1)
]
}
if (Countdown_Zone4.state as DecimalType == 0 && SprinklerSystemZone4.state == ON)
{
SprinklerSystemZone4.sendCommand(OFF)
sendBroadcastNotification("Finished Watering Zone 4")
}
end
//***************************************************************************
rule "IFTT rule"
when
Item IFTTString received update
then
var item=IFTTString.state.toString.split(";").get(0)
val time = Integer::parseInt(IFTTString.state.toString.split(";").get(1))
if (item.contains("back garden"))
{
postUpdate(onHours4, time)
SprinklerSystemZone4.sendCommand(ON)
}
if (item.contains("back grass"))
{
postUpdate(onHours3, time)
SprinklerSystemZone3.sendCommand(ON)
}
if (item.contains("front garden"))
{
postUpdate(onHours2, time)
SprinklerSystemZone2.sendCommand(ON)
}
if (item.contains("front grass"))
{
postUpdate(onHours1, time)
SprinklerSystemZone1.sendCommand(ON)
}
end
My rules are not condensed, I havenāt gotten around to it. But they work with zero issues. so for now, i havenāt changed them
Also, disregard the groups in my items.
They are not needed for any rules.
1 Like