Not really, but we have no idea what you’ve already tried or looked at, so you will get advice for stuff that you’ve perhaps already seen and done.
I can’t think that is so.
If you were expecting this rule to run at all, then as it is triggered by command to Garage_Gate
that command should be in your events.log
If you were expecting this rule to block the action because there was a recent change in Outside_Gate
- then there will be an events.log
for that recent event too.
Remember we can’t see what you are doing, when you are doing it, or what happens about it.
Don’t care really, something has gone wrong.
What I was looking for a specific answer for was, what is your system’s default persistence service set to today? Because your changedSince()
relies totally on that setting to select where to get the data from. You want it pointing at mysql.
You can’t do that using REST API. This was simply to verify that you had recorded the event you expected to have recorded. You’d just see records with timestamps, but crucially this is openHABs view of the data.
The easiest way is to install misleadingly named “REST API DOCS” which is actually an interactive tool, and use its persistence options.
But at the moment, you don’t even seem to have the event.
Alright, so we learned nothing so far - let’s try a different approach.
rule "Actions with garage gate"
when
Item Garage_Gate received command ON
then
logInfo("test", "Gate rule triggered")
logInfo("test", "Gate state now " + Outside_Gate.state.toString)
var precord = Outside_Gate.previousState(true)
logInfo("test", "Gate change default service " + precord.state.toString)
logInfo("test", "Gate change stamped " + precord.getTimestamp.toString)
var mrecord = Outside_Gate.previousState(true. "mysql")
logInfo("test", "Gate change mysql service " + mrecord.state.toString)
logInfo("test", "Gate change stamped " + mrecord.getTimestamp.toString)
var trecord = Outside_Gate.historicState(now.minusSeconds(60))
logInfo("test", "Gate -1min default service " + trecord.state.toString)
logInfo("test", "Gate -1min stamped " + trecord.getTimestamp.toString)
if (Outside_Gate.changedSince(now.minusSeconds(60)) == false) {
sendCommand(Outside_Gate, ON)
}
end
Unconnected with all this, you might want to review persisting every Item, it’s making stress you may not want in many cases.