Echo binding - Need help with rule - Item changed from


I am currently trying to prevent my rule from triggering multiple times.

Here is an example (please not that the timer four minutes is just an example it could be anything else e.g. timer 2 hours, timer 30 seconds):

2019-11-22 16:57:36.870 [vent.ItemStateChangedEvent] - SalexesEchoDot_LastVoiceCommand changed from THISCOULDBEANYTHING to timer four minutes
2019-11-22 16:57:41.008 [vent.ItemStateChangedEvent] - SalexesEchoDot_LastVoiceCommand changed from timer four minutes to 
2019-11-22 16:57:41.029 [vent.ItemStateChangedEvent] - SalexesEchoDot_LastVoiceCommand changed from  to timer four minutes

Currently my rule is triggering twice be cause it changes 2 times to “timer four minutes”

How can I prevent the double trigger ?

This is an issue with the binding rather than your rule

If your problem is that it always changes to - what, empty string? space? We can’t tell from that - but you should be able to check in your rule if previousState was the blank/empty string and ignore it…

Anything I can do in the meantime till it is fixed ?

Will check if it always has an empty string or if it is a space and report back

If I try to get the previousState of the Item

val previousState = SalexesEchoDot_LastVoiceCommand.previousState.toString
logInfo("Test", "previousState " + previousState)

this is the output I get

2019-11-22 19:09:04.673 [INFO ] [arthome.model.script.Test] - previousState org.openhab.core.persistence.internal.QueryablePersistenceServiceDelegate$1@422483

2019-11-22 19:09:04.676 [INFO ] [arthome.model.script.Test] - previousState org.openhab.core.persistence.internal.QueryablePersistenceServiceDelegate$1@e06432

2019-11-22 19:09:04.681 [INFO ] [arthome.model.script.Test] - previousState org.openhab.core.persistence.internal.QueryablePersistenceServiceDelegate$1@18a7a54

2019-11-22 19:09:04.698 [INFO ] [arthome.model.script.Test] - previousState org.openhab.core.persistence.internal.QueryablePersistenceServiceDelegate$1@5478c8

Not sure how to check for that empty string/space when the previousState returns something like above.

previousState is a predefined implicit variable in rules DSL

It’s only available if your secret rule is triggered off changed, which seems to be your complaint.
I don’t know what happens when you overload it with some persistence based evaluation, nothing good I expect.

If you must use the persistence based version - beware, it takes time to record a new value so xxx.previousState may or may not give what you expect when triggered from an event that you also expect to record new values.

xxx.previousState returns an HistoricItem object, as your logging showed you. You’d be interestesd in the .state property of that

Remember this is all a workaround - four changes in 20mS is your underlying problem.
No-one else seems to see this? Should be looking at your Thing/channel config?