Absolutely certain. I have spent the last 3 hours troubleshooting.
changedsince is looking for the last time the value actually changed in the value column. Even though there are new timestamps, the last time the value actually CHANGED was at midnight when the date changed… therefore the rule is working as expected… the database binding is not.
If you look at the debug of jdbc during the rule execution it returns 5 rows from the filter but since the values don’t change, it ignores them:
2017-12-16 08:05:30.011 [DEBUG] [jdbc.internal.JdbcPersistenceService] - JDBC::query: item is FirstFloorThermostatLastPollSuccess
2017-12-16 08:05:30.013 [DEBUG] [persistence.jdbc.internal.JdbcMapper] - JDBC::getHistItemFilterQuery filter='true' numberDecimalcount='3' table='Item16' item='FirstFloorThermostatLastPollSuccess (Type=DateTimeItem, State=2017-12-16T08:00:23)' itemName='FirstFloorThermostatLastPollSuccess'
2017-12-16 08:05:30.014 [DEBUG] [nhab.persistence.jdbc.db.JdbcBaseDAO] - JDBC::getHistItemFilterQueryProvider filter = org.openhab.core.persistence.FilterCriteria@2c8c955e, numberDecimalcount = 3, table = Item16, simpleName = FirstFloorThermostatLastPollSuccess
2017-12-16 08:05:30.015 [DEBUG] [nhab.persistence.jdbc.db.JdbcBaseDAO] - JDBC::query queryString = SELECT time, value FROM Item16 WHERE TIME>'2017-12-16 07:05:30' ORDER BY time ASC
2017-12-16 08:05:30.016 [DEBUG] [nhab.persistence.jdbc.db.JdbcBaseDAO] - JDBC::doGetHistItemFilterQuery sql=SELECT time, value FROM Item16 WHERE TIME>'2017-12-16 07:05:30' ORDER BY time ASC
2017-12-16 08:05:30.025 [DEBUG] [nhab.persistence.jdbc.db.JdbcBaseDAO] - JDBC::ItemResultHandler::handleResult getState value = '2017-12-16 00:00:00.0', getClass = 'class java.sql.Timestamp', clazz = 'Timestamp'
2017-12-16 08:05:30.026 [DEBUG] [nhab.persistence.jdbc.db.JdbcBaseDAO] - JDBC::ItemResultHandler::handleResult getState value = '2017-12-16 00:00:00.0', getClass = 'class java.sql.Timestamp', clazz = 'Timestamp'
2017-12-16 08:05:30.028 [DEBUG] [nhab.persistence.jdbc.db.JdbcBaseDAO] - JDBC::ItemResultHandler::handleResult getState value = '2017-12-16 00:00:00.0', getClass = 'class java.sql.Timestamp', clazz = 'Timestamp'
2017-12-16 08:05:30.029 [DEBUG] [nhab.persistence.jdbc.db.JdbcBaseDAO] - JDBC::ItemResultHandler::handleResult getState value = '2017-12-16 00:00:00.0', getClass = 'class java.sql.Timestamp', clazz = 'Timestamp'
2017-12-16 08:05:30.030 [DEBUG] [nhab.persistence.jdbc.db.JdbcBaseDAO] - JDBC::ItemResultHandler::handleResult getState value = '2017-12-16 00:00:00.0', getClass = 'class java.sql.Timestamp', clazz = 'Timestamp'
2017-12-16 08:05:30.032 [DEBUG] [jdbc.internal.JdbcPersistenceService] - JDBC::query: query for FirstFloorThermostatLastPollSuccess returned 5 rows in 19 ms
2017-12-16 08:05:30.033 [DEBUG] [jdbc.internal.JdbcPersistenceService] - JDBC::query: item is FirstFloorThermostatLastPollSuccess
2017-12-16 08:05:30.035 [DEBUG] [persistence.jdbc.internal.JdbcMapper] - JDBC::getHistItemFilterQuery filter='true' numberDecimalcount='3' table='Item16' item='FirstFloorThermostatLastPollSuccess (Type=DateTimeItem, State=2017-12-16T08:00:23)' itemName='FirstFloorThermostatLastPollSuccess'
2017-12-16 08:05:30.036 [DEBUG] [nhab.persistence.jdbc.db.JdbcBaseDAO] - JDBC::getHistItemFilterQueryProvider filter = org.openhab.core.persistence.FilterCriteria@76e51354, numberDecimalcount = 3, table = Item16, simpleName = FirstFloorThermostatLastPollSuccess
2017-12-16 08:05:30.037 [DEBUG] [nhab.persistence.jdbc.db.JdbcBaseDAO] - JDBC::query queryString = SELECT time, value FROM Item16 WHERE TIME<'2017-12-16 07:05:30' ORDER BY time DESC LIMIT 0,1
2017-12-16 08:05:30.039 [DEBUG] [nhab.persistence.jdbc.db.JdbcBaseDAO] - JDBC::doGetHistItemFilterQuery sql=SELECT time, value FROM Item16 WHERE TIME<'2017-12-16 07:05:30' ORDER BY time DESC LIMIT 0,1
2017-12-16 08:05:30.047 [DEBUG] [nhab.persistence.jdbc.db.JdbcBaseDAO] - JDBC::ItemResultHandler::handleResult getState value = '2017-12-16 00:00:00.0', getClass = 'class java.sql.Timestamp', clazz = 'Timestamp'
2017-12-16 08:05:30.049 [DEBUG] [jdbc.internal.JdbcPersistenceService] - JDBC::query: query for FirstFloorThermostatLastPollSuccess returned 1 rows in 15 ms
2017-12-16 08:05:30.051 [INFO ] [ome.model.script.Monitor Thermostats] - FirstFloor Thermostat hasn't changed in more than 60 minutes
Oh and here are the rows from the mariadb:
“2017-12-16 07:09:53.818”;“2017-12-16 00:00:00.000”
“2017-12-16 07:22:24.256”;“2017-12-16 00:00:00.000”
“2017-12-16 07:34:54.439”;“2017-12-16 00:00:00.000”
“2017-12-16 07:47:54.376”;“2017-12-16 00:00:00.000”
“2017-12-16 08:00:23.850”;“2017-12-16 00:00:00.000”
And here is the event.log showing that they should have changed:
2017-12-16 07:09:53.818 [vent.ItemStateChangedEvent] - FirstFloorThermostatLastPollSuccess changed from 2017-12-16T06:57:13.000-0500 to 2017-12-16T07:09:53.000-0500
2017-12-16 07:22:24.257 [vent.ItemStateChangedEvent] - FirstFloorThermostatLastPollSuccess changed from 2017-12-16T07:09:53.000-0500 to 2017-12-16T07:22:24.000-0500
2017-12-16 07:34:54.440 [vent.ItemStateChangedEvent] - FirstFloorThermostatLastPollSuccess changed from 2017-12-16T07:22:24.000-0500 to 2017-12-16T07:34:54.000-0500
2017-12-16 07:47:54.376 [vent.ItemStateChangedEvent] - FirstFloorThermostatLastPollSuccess changed from 2017-12-16T07:34:54.000-0500 to 2017-12-16T07:47:54.000-0500
2017-12-16 08:00:23.852 [vent.ItemStateChangedEvent] - FirstFloorThermostatLastPollSuccess changed from 2017-12-16T07:47:54.000-0500 to 2017-12-16T08:00:23.000-0500