New behavior since the last update to OpenHab 2.5.5-1. I use some flag to trigger event on my rollershutter based on sun position. The new problem is about some flag. I use a rule to set the flag in the morning and reset it at the night. During the day, without any apparent reason, the flag is set to OFF by itself. It could happen 1 hour or more after my rule set the flag to ON.
There is the rule not triggered anymore because of the flag “FlagStoreLivingOpeningRequested” setting to OFF by itself:
rule "Store opening with sun position"
when
Item Azimuth received update
then
if (FlagStoreLivingOpeningRequested.state == ON) {
if (Azimuth.state >= 105 && FlagStoreLiving1Opened.state == OFF) {
Thread::sleep(500) //Force a delay if RF command was sent just before. Fix timing issue.
sendCommand( RolShut_FF_living1, "UP" )
FlagStoreLiving1Opened.sendCommand(ON)
logInfo(logName, "Ouverture rideau motorise no1")
}
if (Azimuth.state >= 120 && FlagStoreLiving2Opened.state == OFF) {
Thread::sleep(500) //Force a delay if RF command was sent just before. Fix timing issue.
sendCommand( RolShut_FF_living2, "UP" )
FlagStoreLiving2Opened.sendCommand(ON)
logInfo(logName, "Ouverture rideau motorise no2")
}
if (Azimuth.state >= 140 && FlagStoreLiving3Opened.state == OFF) {
Thread::sleep(500) //Force a delay if RF command was sent just before. Fix timing issue.
sendCommand( RolShut_FF_living3, "UP" )
FlagStoreLiving3Opened.sendCommand(ON)
Thread::sleep(500)
sendCommand( RolShut_FF_living4, "UP" )
FlagStoreLiving4Opened.sendCommand(ON)
logInfo(logName, "Ouverture rideau motorise no3 et no4")
}
}
end
See below the log when I trigger the rule by myself and when the flag is set to off by itself later:
2020-06-04 04:54:03.647 [ome.event.ItemCommandEvent] - Item 'FlagStoreLivingOpeningRequested' received command ON
2020-06-04 04:54:03.654 [vent.ItemStateChangedEvent] - FlagStoreLivingOpeningRequested changed from OFF to ON
2020-06-04 06:09:52.507 [ome.event.ItemCommandEvent] - Item 'FlagStoreOpeningRequested' received command OFF
2020-06-04 06:09:52.512 [ome.event.ItemCommandEvent] - Item 'FlagStoreLateOpeningRequested' received command OFF
2020-06-04 06:09:52.518 [ome.event.ItemCommandEvent] - Item 'FlagStoreLivingOpeningRequested' received command OFF
2020-06-04 06:09:52.524 [ome.event.ItemCommandEvent] - Item 'FlagStoreLiving1Opened' received command OFF
2020-06-04 06:09:52.531 [ome.event.ItemCommandEvent] - Item 'FlagStoreLiving2Opened' received command OFF
2020-06-04 06:09:52.537 [ome.event.ItemCommandEvent] - Item 'FlagStoreLiving3Opened' received command OFF
2020-06-04 06:09:52.543 [ome.event.ItemCommandEvent] - Item 'FlagStoreLiving4Opened' received command OFF
2020-06-04 06:09:52.553 [ome.event.ItemCommandEvent] - Item 'vTimeOfDay' received command DAY
2020-06-04 06:09:52.556 [vent.ItemStateChangedEvent] - FlagStoreLivingOpeningRequested changed from ON to OFF
The only curious thing is about those flag changed by themselve exactly at the same time as vTimeOfDay change of status. However I don’t see the link with this rule. See below, based on “Design Pattern: Time of day” from @rlkoshak.
rule "Calculate time of day state"
when
// See configuration in paper UI for offset sunset et evening night
System started or
Channel 'astro:sun:local:rise#event' triggered START or
Channel 'astro:sun:local:set#event' triggered START or
Channel 'astro:sun:local:eveningNight#event' triggered START or
Time cron "0 1 0 * * ? *" or // one minute after midnight so give Astro time to calculate
the new day's times
Time cron "0 0 5 * * ? *" or
Time cron "0 0 22 * * ? *" or
Time cron "0 59 23 * * ? *"
then
//Thread::sleep(1000) // make sure we are a tad past midnight to give Astro a chance
to recalculate DateTimes for today
val morning_start = now.withTimeAtStartOfDay.plusDays(1).minusHours(19) // 5h00 AM
vMorning_Time.postUpdate(morning_start.toString)
val day_start = new DateTime(vSunrise_Time.state.toString)
val afternoon_start = new DateTime(vEvening_Time.state.toString)
val evening_start = new DateTime(vSunset_Time.state.toString)
val bed_start = now.withTimeAtStartOfDay.plusDays(1).minusHours(2) //22h00
vBed_Time.postUpdate(bed_start.toString)
val night_start = now.withTimeAtStartOfDay.plusDays(1).minusMinutes(1) //23h59
vNight_Time.postUpdate(night_start.toString)
var curr = "UNKNOWN"
switch now {
case now.isAfter(morning_start) && now.isBefore(day_start): curr = "MORNING"
case now.isAfter(day_start) && now.isBefore(afternoon_start): curr = "DAY"
case now.isAfter(afternoon_start) && now.isBefore(evening_start): curr = "AFTERNOON"
case now.isAfter(evening_start) && now.isBefore(bed_start): curr = "EVENING"
case now.isAfter(bed_start) && now.isBefore(night_start): curr = "BED"
case now.isAfter(night_start) || now.isBefore(morning_start): curr = "NIGHT"
}
logInfo(logName, "Current time of day is " + curr)
vTimeOfDay.sendCommand(curr)
end
The only rule triggering the flag to OFF is related to Time of Day with this rule:
rule "Evening time started"
when
Item vTimeOfDay changed to "EVENING"
then
logInfo(logName, "Il fait maintenant noir dehors. Ouverture des lumieres")
Toast_FF_living_LG_TV.sendCommand("Il fait maintenant noir dehors. Ouvertures des lumières extérieures")
sendCommand(SgSay, "Il fait maintenant noir dehors. J'ouvre les lumières extérieures")
logInfo(logName, SgSay.state.toString)
Thread::sleep(10000) // attente 10 sec - on veut entendre la voix avant l'action
sendCommand(gEveningLights, ON)
sendCommand( RolShut_FF_bed1, "DOWN" ) // Fermeture rideau motorisé chambre principale
//We close all roller shutter. Stop following sun position
FlagStoreLivingOpeningRequested.sendCommand(OFF)
FlagStoreLiving1Opened.sendCommand(OFF)
FlagStoreLiving2Opened.sendCommand(OFF)
FlagStoreLiving3Opened.sendCommand(OFF)
FlagStoreLiving4Opened.sendCommand(OFF)
sendCommand( RolShut_FF_livingAll, "DOWN" )
end
Is someone have an idea how I could troubleshoot this issue? By global research, I’m 100% sure I don’t have any other rule triggering the flag to OFF.