Hi there,
I’m learning how to set up rules in Openhab. In other words I’m reading the docs and learning from the posts in the community…but most inportantly I’m trying out a few things with the only purpose to understand how it all works.
I have come to a result that I just don’t understand.
This is the code:
ITEMS
Group gDoors "DeurSensoren_group"
DateTime ZWaveNode006FGK101DoorOpeningSensor_DoorSensor_LastUpdate "Back Door Last Update [%1$tm/%1$td %1tH:%1tM]" <clock> (gDoors)
RULES
rule "Deur_open"
when
Member of gDoors changed
then
logInfo("rule.deuropen", "Member of gDoors:" + triggeringItem.label + " changed from " + previousState.toString + "to:" + triggeringItem.state.toString )
postUpdate(triggeringItem.name+"_LastUpdate", now.toString)
end
And this is the logresult :
LOG
2019-04-22 10:36:10.258 [INFO ] [smarthome.model.script.rule.deuropen] - Member of gDoors:Door Sensor changed from CLOSEDto:OPEN
2019-04-22 10:36:10.311 [INFO ] [smarthome.model.script.rule.deuropen] - Member of gDoors:Back Door Last Update changed from 2019-04-22T10:35:46.162+0200to:2019-04-22T10:36:10.267+0200
So when I open a door, (the node006 thing )that is a member of gDoors, I get two lines logged
The first I understand because it is the change of the state of the door(node006 thing) that was opened.
The second I don’t get.
1° I didn’t ask for it so why log the change of the associated item _lastupdate? Does the script loops again over the first(and only logline)?
How come that the script doesn’t go to the “end” statement when it executed the postUpdate statement?
If somebody can explain what is happening so that a dummy like me understands I would be gratefull!!
Grts,
Mario