Changed since does not work anymore?

Hi,

my auto-light-switchoff-rule does not work anymore.

gLightAutoSwitchOff.members.forEach[ rs, i |
		if ((rs.state > 0)||(rs.state == ON) ) {
			logInfo("licht.rules", "Licht an: " + rs.name)
			if ((!(rs.getGroupNames.contains('EG_Arbeitszimmer') && Home_Office_AZ.state == ON)) && (!(rs.getGroupNames.contains('EG_Guestroom') && Home_Office_GZ.state == ON))) {
				logInfo("licht.rules", "Nicht Homeoffice: " + rs.name + "; State: " + rs.state + "; changed since " + time_limit + " Min: " + rs.changedSince(ZonedDateTime.now.minusMinutes(time_limit),"influxdb"))
				logInfo("licht.rules", "Nicht Homeoffice: " + rs.name + "; State: " + rs.state + "; Now minus " + ZonedDateTime.now.minusMinutes(time_limit) + " Last update: " + rs.lastUpdate())
				if (rs.changedSince(now.minusMinutes(time_limit),"influxdb") == false) {
					if (rs.type.toString == "Dimmer") {
						rs.sendCommand(0)
					} else if (rs.type.toString == "Switch") {
						rs.sendCommand(OFF)
					}
					logInfo("licht.rules", "Zu lange an")
				}
			}
			
		}
		
	]

This is the log output:


Lichter nach 30 Minuten abschalten
2021-03-06 12:54:21.538 [INFO ] [penhab.core.model.script.licht.rules] - Licht an: OG1_Bad_Licht
2021-03-06 12:54:21.552 [INFO ] [penhab.core.model.script.licht.rules] - Nicht Homeoffice: OG1_Bad_Licht; State: ON; changed since 30 Min: false
2021-03-06 12:54:21.561 [INFO ] [penhab.core.model.script.licht.rules] - Nicht Homeoffice: OG1_Bad_Licht; State: ON; Now minus 2021-03-06T12:24:21.553492+01:00[Europe/Berlin] Last update: 2021-03-06T12:54:11.616+01:00[Europe/Berlin]
2021-03-06 12:54:21.573 [INFO ] [penhab.core.model.script.licht.rules] - Zu lange an

As you can see, OH3 sees that the last change has just been seconds ago, however “changedSince” returns false anyway.

Daniel

There are issues around recording Switch types in influxdb.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.