I have a strange issue with currentValue(...) not updating. I have an app that reads multiple contact sensors and pass on the information to a "master" contact sensor. The master contact sensor I use as an indication on my dashboard to tell me if any of the contact sensors are in "open" state. However, I see quite often that the master says "open" even though all contact are closed. I have tried to debug this issue now for quite some time, and I see the following strange behavior: if I read the currentValue("contact", true) I receive "open", however if I read the latest event on the device the event is closed. See code below:
Thanks for the reply. The skip cached value was my first attempt at fixing this, so no. Skipping the cache seemd to reduce the number of times this happend, however this could just be a coincident.
The place where this is a bit more critical is in the Rule Machine. I have a button next to my main entrance which enables arm away when pressed with the door open, and arm home when door closed. This sometimes fails and put the house in the wrong mode.
I have an update on this one. I managed to find a (nasty) workaround that almost eliminated the issue. I.e. it reduced this from happening every second day to happen perhaps once a week. What I did was that I modified the contact sensor driver code to send the "closed" event twice, no fancy logic or anything, just simply sending the event twice:
However, I have seen the issue on a Smartthings multisensor (with the default driver) as well.
I have one aqara sensor on my desk where it is easy to recreate the issue by simply waving the magnet in front of the sensor a couple of times. I haven't removed any of the smartthings sensors, so there it is a bit more difficult to recreate the issue as I have to open and close the door in rapid succession.
The failure mode is always the same, the dashboard and event log is correct, while the currentValue() is incorrect, which in turn affects my app and Rules engine.
I can confirm that the issue is completely resolved. I have tried opening and closing doors over the weekend and I have seen no issues what so ever. Thanks again @aaiyar!