Help needed with changedSince(now.minusDays(14))

Hi,
I’ve a rule which should flush my heating valves, when they aren’t used for 14 days.

rule "Ventilspülung"
    when
        Time cron "0 0 4 * * ?"
    then
    // Ventilspülung, wenn ein Ventil in den letzten 2 Wochen nicht bewegt wurde
    	if (!StatusHeizenBad.changedSince(now.minusDays(14)) ||
    		!StatusHeizenGaestezimmer.changedSince(now.minusDays(14)) ||
    		!StatusHeizenSchlafzimmer.changedSince(now.minusDays(14)) ||
    		!StatusHeizenWohnzimmer.changedSince(now.minusDays(14))
    	) {
    		sendCommand(Ventilspuelung, ON)
                    logInfo("Debug", "Ventilspülung: Bad: " + StatusHeizenBad.changedSince(now.minusDays(14)) + " GZ:  " + StatusHeizenGaestezimmer.changedSince(now.minusDays(14)) + " SZ:  " + StatusHeizenSchlafzimmer.changedSince(now.minusDays(14)) + " WZ: " + StatusHeizenWohnzimmer.changedSince(now.minusDays(14)))

          }  	    		

end

This rule fires every night at 4 o’clock and flushes my valves although they should if one valve hasen’t used in the last 14 days. Especially in winter time this rule shouldn’t match at all, but it does.
I see in the events.log, that all four items/valves changed last night and the night before and so on and I also see this in my influxdb, which is the persistence service.

Although all items change every night my debug log line show something like this (the true and false are inverted, which means every item should show true, as the item changed in the last 14 days):

# grep Ventil openhab.log
2017-03-17 04:00:16.806 [INFO ] [g.eclipse.smarthome.model.script.RSS] - Wohnungsstatus: Ventilspuelung ON
2017-03-17 04:00:27.268 [INFO ] [eclipse.smarthome.model.script.Debug] - Ventilspülung: Bad: true GZ:  true SZ:  false WZ: true
2017-03-18 04:00:01.965 [INFO ] [g.eclipse.smarthome.model.script.RSS] - Wohnungsstatus: Ventilspuelung ON
2017-03-18 04:00:05.240 [INFO ] [eclipse.smarthome.model.script.Debug] - Ventilspülung: Bad: true GZ:  false SZ:  false WZ: true
2017-03-19 04:00:02.132 [INFO ] [g.eclipse.smarthome.model.script.RSS] - Wohnungsstatus: Ventilspuelung ON
2017-03-19 04:00:05.092 [INFO ] [eclipse.smarthome.model.script.Debug] - Ventilspülung: Bad: true GZ:  false SZ:  false WZ: true
2017-03-20 04:00:24.325 [INFO ] [g.eclipse.smarthome.model.script.RSS] - Wohnungsstatus: Ventilspuelung ON
2017-03-20 04:00:31.951 [INFO ] [eclipse.smarthome.model.script.Debug] - Ventilspülung: Bad: true GZ:  false SZ:  false WZ: true

What’s going wrong here? I’ve no idea, what I’m doing wrong.
Please can you help me?

first question: is there a valve that does not close at all (so the state would not change)?

No, every valves opena and close, so their state definately changes.
Meanwhile I think there must be a bug, as every valve changes within these 14 days, but just two valves behave correct.
A look at my influxdb data shows, that every valce changes its state in the last 14 days (ON/OFF), but just Bad and WZ (Wohnzimmer) show a true (which means they have changed within the last 14 days).

Might be worth to mention: with OH1 this rule worked correct.

Can you show your items and your persistence settings?

My items definition:

Switch  StatusHeizenWohnzimmer  "Status Ventil WZ [MAP(ventil.map):%s]"  <heater>  (gWohnzimmer,gHKL,gHeizung,gInfluxDB)  { knx="<3/4/102" }
Switch  StatusHeizenGaestezimmer  "Status Ventil GZ [MAP(ventil.map):%s]"  <heater>  (gGaestezimmer,gHKL,gHeizung,gInfluxDB1)  { knx="<3/4/103" }
Switch  StatusHeizenSchlafzimmer  "Status Ventil SZ [MAP(ventil.map):%s]"  <heater>  (gSchlafzimmer,gHKL,gHeizung,gInfluxDB1)  { knx="<3/4/104" }
Switch  StatusHeizenBad  "Status Ventil Bad [MAP(ventil.map):%s]"  <heater>  (gBad,gHKL,gHeizung,gInfluxDB1)  { knx="<3/4/105" }

The influx.persist file looks like:

Strategies {
        everyMinute : "0 * * * * ?"
        everyHour : "0 0 * * * ?"
        everyDay  : "0 0 0 * * ?"
        default = everyChange
}

Items {
               
        gInfluxDB*			: strategy = everyMinute, everyChange, everyDay, restoreOnStartup
        gInfluxDB1*			: strategy = everyMinute, everyChange, everyDay               
}

The influxdb content looks good, so I assume everything works fine with the persistent service.

I’ve made some influx queries, which show, that every valve had some OFFs and ONs in the last 2 days:

> select count(value) from StatusHeizenGaestezimmer where time > now() - 2d and value=1
name: StatusHeizenGaestezimmer
time                           count
----                           -----
2017-03-19T08:34:51.606993156Z 11

> select count(value) from StatusHeizenGaestezimmer where time > now() - 2d and value=0
name: StatusHeizenGaestezimmer
time                           count
----                           -----
2017-03-19T08:34:57.313266312Z 2873

> select count(value) from StatusHeizenWohnzimmer where time > now() - 2d and value=0
name: StatusHeizenWohnzimmer
time                           count
----                           -----
2017-03-19T08:35:12.169142395Z 2873

> select count(value) from StatusHeizenWohnzimmer where time > now() - 2d and value=1
name: StatusHeizenWohnzimmer
time                           count
----                           -----
2017-03-19T08:35:15.287698896Z 11

> select count(value) from StatusHeizenSchlafzimmer where time > now() - 2d and value=1
name: StatusHeizenSchlafzimmer
time                           count
----                           -----
2017-03-19T08:35:29.165601842Z 11

> select count(value) from StatusHeizenSchlafzimmer where time > now() - 2d and value=0
name: StatusHeizenSchlafzimmer
time                          count
----                          -----
2017-03-19T08:35:32.84251568Z 2873

> select count(value) from StatusHeizenBad where time > now() - 2d and value=0
name: StatusHeizenBad
time                           count
----                           -----
2017-03-19T08:35:48.614349985Z 2567

> select count(value) from StatusHeizenBad where time > now() - 2d and value=1
name: StatusHeizenBad
time                           count
----                           -----
2017-03-19T08:35:56.338781531Z 448

I cannot understand this behaviour.

Did you find the root cause of your issue.
I also struggle with changedsince even though the events.log shows that the item changed recently.