IoTaWatt cannot remove drivers

I installed iotawatt power monitor driver and the child power meter plus child voltage sensor drivers. It actually worked well i just don’t need it anymore. I removed all the devices for iotawatt, removed iotawatt driver all fine. When I go to remove the child drivers it says it can’t because they are in use.
Driver cannot be deleted, it is in use by the following devices: [ IotaWatt (Input_01),IotaWatt (Input_02),IotaWatt (Input_03),IotaWatt (Input_04),IotaWatt (Input_05),IotaWatt (Input_06),IotaWatt (Input_07),IotaWatt (Input_08),IotaWatt (Input_09),IotaWatt (Input_10),IotaWatt (Input_11),IotaWatt (Input_12),IotaWatt (Input_13),IotaWatt (Input_14)]

These devices don’t exist, i removed them without any errors. Any idea how to remove these drivers or these fantom devices? I reinstalled all the drivers and made the devices show up again then tried to remove and still same thing...confused. Pretty sure i did it in the correct order??

As much as I think rebooting a device is not a troubleshooting technique, in this case , try reboot the hub from the menu. I've seen child/parent confusion depending on who was removed first and a reboot actually fixed the phantom driver issue.

I tried rebooting, even did a restore and attempt to remove the drivers again after removing the devices. I just can’t see where the devices exist anywhere anymore to cause this error. I’m stumped on how to clear it

Something has a handle on them. Something that lives after a reboot. Rules or another App is likely. If the phantom has a device page, down near the bottom is a list of who or what is attached.

I’ve gone thru every app and every section on this hub. What I see is any app (like dashboards) that allow you to select which devices you are allowed to use show the iotawatt devices in the list still. I have made sure nothing has them selected, cannot remove drivers. I readded all of the iotawatt code again, added the iotawatt virt devices again and everything is there working. Again at this stage none of the devices show in use when you go to each device and look at the bottom. I even disabled debug logging so the logs don’t even report on them. Remove all not in use devices, same thing. Cannot remove the child drivers. I can remove the main iotawatt driver tho. None of these devices show up under the devices section, yet in the dashboards for instance i can select them all still. I can only assume this is a hubitat bug at this point on why they will not disappear yet still show in apps such as dashboards. I even just upgraded the hub again with last nights hubitat update.

Have you tried @BorrisTheCat's clean-up driver?

1 Like

My assumption on this driver is create a virt driver which gives you 3 buttons? The buttons do nothing, no logs, no errors, nothing so I still must be missing something I’m not up on groovy code

Have you asked Hubitat support for assistance, yet? I find it very odd that the child devices are left behind after the parent device was removed. When a parent device is removed, the Hubitat platform should automatically remove all corresponding child devices as well. Based on this feedback, I will update the Parent driver to explicitly remove its own children during the removal process as added insurance.

The two Child drivers used by the IoTaWatt Parent driver are simply HubDuino drivers that are also used for that integration. Do you have any HubDuino devices connected that might be using these two drivers?

1 Like

Yes.

Nope, no HubDuino at all. I am stumped that these devices do not show up in the devices section at all yet i can select them as a device to use in say the dashboards. Also odd that the iotawatt driver removed just fine yet those other two drivers think they are in use. I didn’t know if hubitat monitors this forum section at all

I have updated the Parent IoTaWatt driver to ensure all child devices are uninstalled when the parent device is uninstalled. The only way that I can think this could help you is if you restore an old backup prior to you ever removing the Parent IoTaWatt device. Then, update the Parent IoTaWatt driver to this latest version. Finally, remove the Parent Device from its Device Details page. This will cause it to remove its children as well (at least it should!)

Unfortunately, you will lose any changes you've made between now and the date of that backup file.

Here is the improved Parent IoTaWatt driver.

https://raw.githubusercontent.com/ogiewon/Hubitat/master/Drivers/iotawatt-parent.src/iotawatt-parent.groovy

No joy, with new driver i now have the new devices that show up in devices section, but when i look at say the dashboards i see the original ones and the new ones i just added. Remove devices and driver and they (new) are gone but the old ones still exist from dashboards. Also check the alexa app and it also sees these phantom devices. Got me, by the way your driver worked great. Only reason i’m cleaning it all up is because i’m trying to use influxdb to grafana for power monitoring and not using hubitat for that part. What you did works great. Also my backups now only cover since i’ve tried removing this driver so i now don’t have a state of before to restore too. See what hubitat says i guess.

Your best bet may be to email support@hubitat.com and have @bobbyD take a look at your hub. It is strange that these child devices are hanging around after the parent device was removed. Between @bobbyD and @chuck.schwer, I am sure they can get you fixed up. I just hate that something I wrote has led to this issue.

I’ve looked it over again to make sure i’ve done nothing stupid or i’m missing something obvious but i don’t think i am. I know what you mean, i’ve coded alot a few years ago but i’ve never messed with groovy at all. I was an IT guy for 30yrs now retired. Feel like i’ve lost alot now that I don’t do this stuff every day lol

1 Like

Well, I have some good news... I have reproduced the problem, and I now know how it occurred.

I will work on a solution to prevent it from happening in the future, and I will also work on a way to remove these pesky child devices whose parent has left them behind.

Stay tuned for more updates... :wink:

2 Likes

Great news, curious on how you reproduced it. Maybe it will reveal that I did something out of order, not sure tho. I’ll probably end up using the driver again, i’m just trying to get a dashboard/reporting how I want it so i’m trying grafana right now. As i said before, your driver worked great.

There is a race condition that can occur when removing the parent device. If an update of the child devices occurs at the same time as the parent is being removed, new child devices can be created and then the parent is deleted. It’s a multi threading type of issue.

I am still working with Hubitat engineering on a fix and hopefully way to clean up the orphaned child devices.

Interesting, i do recall (since I did try to reinstall/remove about 5x total) the first time i removed the drivers it took a very long time for it to come back and finish compared to the later attempts which was pretty immediate.