Deleting an Input node with no name

Hi have an interesting problem @TrystanLea - I have a node in my Input list that doesn’t have a name - so I can’t delete it.

Unfortunately, it has 36,000 (yes thirty six thousand) Inputs listed. How can I delete it?

The Get Inputs API doesn’t include it (presumably as it has no name).

Help!

How did I get here, well in testing the new ESPHome component, it was accidentally posting to the base emon topic the full JSON. This in turn then created a new Input for each sensor every time (I think), and I didn’t notice for a while…

After a bit of digging and CoPilot use, I fixed it. For posterity…

TAKE A BACKUP

SSH in, log into MariaDB

mysql -u emoncms -p emoncms
when asked - (password: emonpiemoncmsmysql2016)

Have a look at the input table where the nodeid is empty.

SELECT * FROM input WHERE nodeid = '';

If you are sure you have the right Inputs…

 DELETE FROM input WHERE nodeid = '';

For me the result was

MariaDB [emoncms]> DELETE FROM input WHERE nodeid = '';
Query OK, 36197 rows affected (0.350 sec)

One more thing to do, Navigate to Admin → System Info and scroll down to the REDIS section and click Flush.

Sanity should be returned. You may still have an empty device, but you can click on the cog and delete it.

1 Like

Almost the same procedure as a few years ago. Delete multiple input nodes (100s)

2 Likes

wow, that quite a number :sweat_smile: good solution!

1 Like