New device db consistency/ghost checker

Initial release a device/app i just created because occasionaly i have found erroneous entries in my overall device database that were not in the zwave radio database.

Only remedy was exclusion and re-inclusion.

This Device (not app so it can have attributes to trigger rules off of) loads the entire device, zwave table, and zigbee tables/databases when the compare command is executed.

It then checks for zwave devices in the device list that are NOT in the zwave radio table, and also zigbee devices in the device list that are NOT in the zigbee radio table.

It also checks for entries in the zwave radio table that are NOT in the device list (commonly known as ghosts).

It reports on all these in attributes and in the logs.

There is also an option to schedule runs in number of days (its cpu intensive so not recommending running all the time), and a specific time.

There are also timing attributes so you can see how long it takes to run, and a results attribute suitable for use in a dashboard.

Be carefull turning on full debugging if you have large device/zwave/zigbee database in can fill up the log rather quickly.

Not get in git hub.. will do that in a day or day..

here is example runs and rules i have set up to alert myself..

6 Likes

Should now be in hubitat package manager as soon of manifest update code runs!!

1 Like

I checked out this code the other day, I noticed it looks like you are hitting the /device/fullJson/$deviceid endpoint for every device on every run. I suspect that is where the heavy load is coming from. Have you considered caching the zwave/zigbee true/false info in a state variable? Then you only need to check the endpoint for new devices not already saved. The device ID could only ever be for one device and the Zwave / Zigbee check should never change so I think its safe to do that.

2 Likes

Ya good idea . I also coukd do insertion sort and speed uo the searching. But thought it was overkill.

1 Like

I think just reducing the endpoint hits will greatly improve it, since they are http calls. The searching for matches part should be pretty quick once most of the data is readily available.

1 Like

when i was writing it i was suprised at least half the time is just the one endpoint getting back all the device data since it returns such a large structure.. would be nice if the tag whether they are zigbee are zwave was in that structure.

also may hold off on any changes right now as i assume all the endpoints and data returned are changing at least the zwave part with the new zwavejs and willhave to rewrite anyway.

new version 1.3 in git hub.. thanks to jtp above
i now load the device details into a map and just use that .. it is only loaded when it is empty (on first run) or if you execute the new re-initialize function , or in the case you add a new device and it cannot find it in the table.

here are the times for the initial run and subsequent runs that uses the array in a state variable instead of loading every time and issueing an api http endpoint for each device..

2 Likes