Bulk delete SmartThings (or any brand) devices from Alexa
September 22, 2020
I recently received an email from Amazon regarding the deprecation of the Alexa SmartThings Classic skill in favor of the “new” one. Like everything else in this transition, it broke all of my device integrations.
In order to fix it, I needed to go through the following steps:
- Disable both skills (classic and new)
- Remove all SmartThings devices
- Re-enable the new skill (which will re-discover all devices)
Step two is a pain if you have a ton of devices, so I wrote a quick script you can run in your browser’s console at https://alexa.amazon.com/spa/index.html#appliances to bulk delete all devices that have SmartThings in their “sub-text” name.
$x('//div[contains(text(), "SmartThings")]')
.map((innerDiv) => innerDiv.parentNode.parentNode)
.map((parentDiv) => parentDiv.getElementsByTagName("button")[0])
.forEach((button) => {
fetch(
`https://alexa.amazon.com/api/phoenix/appliance/${button.getAttribute(
"appliance-id"
)}`,
{
method: "DELETE",
}
);
});
Obviously, this script could easily be modified to delete any other brand.