Find all pistons with messed up devices

another q....is there a way for easily find all pistons with messed up devices

image

I don't recall one but it might be something I could write a small app to do. I'll poke around a little this morning and see if I come up with a usable pattern.

3 Likes

If you can do that, would it be possible to get an inventory of all devices and their “gone away code” while they are still connected?
You could use this to rebuild the whole system if reuired. When I moved WC from smartthings to hubitat, I had to screenshot every piston as its not always easy to remember which device is i use when you move.

While there are lots of pro features missing the UI is probably the best I could have imagined for a free interface from a brilliant developer.
There is no easy way for a lot of things for documentation/changes.
For missing devices issues I always use global vars when writing code.
That way if something goes missing you just have to edit any piston, scroll down to the variable and see the longint that used to be the device. Edit the var, pick the missig device and save.
All fixed in every piston that uses the global.

1 Like

@Paul1964 I've found a pattern and method I can use to identify Pistons that have missing devices. Should be able to get back to this Monday or Tuesday and start fleshing out an app.

3 Likes

Thanks, that sounds good. I have a strong suspicion that any piston with an orphaned device does not run at all, so identifying them would be useful.
When does the integer name get allocated, is it when the device is orphaned or is it always there? What would be really useful would be a report similar to this for al devices/pistons ;-

Device Numeric Piston
front_door_contact 1234567890 leave_house
arrive_home
hall_motion_sensor 1234567891 hall_lights

This would be invaluable if setting up/replacing a faulty hub etc

Try this code:

https://raw.githubusercontent.com/thebearmay/hubitat/main/apps/wcDevAudit.groovy

Still a little rough, but does identify the piston and the devices that are missing. Number gets assigned when the device is associated to the piston, so it's always on the status page.

2 Likes

Thanks, assume I install this as an HE app?

When you say the number is allocated when the device is added to the piston, if the device is added to another piston, would it be the same number as assigned in the first piston?

Install as a user app.

At a quick glance the numbers don’t appear to be the same across pistons, but they could be as it’s a hashed value that may have the same inputs - haven’t dug into the code yet.

1 Like

image

this is what I got when i installed.. i looked in logs but didnt see anything...
I put the code in the apps group and then installed user app

If you got an empty list then all the devices in the pistons should be defined in the core webCoRE app. (Need to clean that screen up a little.)

From my dev server where I purposely removed a device after using it in a piston:

Clicking on the link in the message:

1 Like

ahhh so that really meant NO errors ...cool! Thanks so much....I would have no idea how to do what you did!

1 Like

i setup a device in a piston and deleted it ....but still get the same msg as above

here is the piston
image

Hmmm… May have missed a pattern. What does the staus page of that Piston and the webCoRE parent look like?

Different status page, if you go to the apps list and click on the cog wheel next to the piston and webCoRE parent.

I have noticed you get log error as well on the errant pistons if you do a backup.

sorry for delay...was out


No worries. Found my error, typical rookie developer mistake - didn’t check to make sure the loop was picking up multiple pistons correctly.

V0.0.1

1 Like

Thanks! I tried the new version and it did find a piston with a missing device... it however still did not find this one
image