Losing connection to devices and reading false states

I have to admit I'm quite annoyed. I just realised that I had lost connection to 2 of my contact sensors about a month ago and had no idea. So, when I ran the rule to check security (windows closed, etc.), it reported back as everything good. Meanwhile the sensor wasn't responding and happened to lose connection in the 'closed' state, so rule machine kept thinking all was closed. Doesn't also help that the check-in just shows a bunch of numbers (e.g. "lastCheckin : 1584527697589").
How can I show an actual date? Is it because of an issue with sensor type? Or because bad driver? Or cheap Xiaomi devices?
How can I prevent the system from picking up incorrect states of devices?
Any help would be appreciated.
Thanks
Alan

P.s. Got a similar question under rule machine around this

I have installed @bptworld's device watchdog to monitor devices that have dropped off the my system.
I monitor my battery levels using the same app.
image

Are you not seeing this for the Xiaomi contact sensors?
image

Here is the driver I'm using.
/**

  • Xiaomi "Original" Door/Window Sensor - model MCCGQ01LM
  • & Aqara Door/Window Sensor - model MCCGQ11LM
  • Device Driver for Hubitat Elevation hub
  • Version 0.7.2

What I get is the below:

And it's the same driver:
Xiaomi "Original" Door/Window Sensor - model MCCGQ01LM

  • & Aqara Door/Window Sensor - model MCCGQ11LM
  • Device tat Elevation hub
  • Version 0.7.2

I'll have a look into the device watchdog. Thanks!

Strange about the time not displaying correctly.
Not sure what's going on there.

Maybe try re-saving the driver code.
Change the type for the device, save it, change it back and re-save it and see what happens.
I'm not sure what else to suggest about the time stamp not being displayed correctly.

The way it displays for @AlanB is how it would display without modifying the driver. The change needed to show as @bobbles have the date is a very minor one.

Replace all occurrences of "now()" with "new Date().toLocaleString()".

2 Likes

I cannot remember altering the driver code though.
That's not to say I didn't amend the code.
I've had these for quite some time.

EDIT: Just checking my code and my code shows as @markus has suggested.
I must have changed it.

1 Like

In answer to the other question by the OP: To keep track of when a device last had activity, the generic way is to look at "Last Activity At" at the bottom of the driver page. It is that date and time that a device monitoring app would look at to know if the device is still working.
Xiaomi devices can be complicated to get right, but it can be done if planned right. There are whole threads dedicated to only this topic. I have more than 65 Xiaomi/Aqara devices and my mesh is 100% stable, I still have more to add in a drawer and more coming, I like these little devices. Maybe I should count them... Anyway, they work, and they work for many others, but it all comes down to choosing routing devices well (and probably having more of them than you think are needed), understanding how to build the mesh and installing the devices in a proper order.Not going to elaborate on this more since there's enough written about it by now, but I have 7 routing devices which I've put there for ONLY this purpose. Then there are more routing devices on top of that as well.

1 Like

Thanks for the help. My mission for tonight

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.