HomeAssistant with Vultr API
Posted on:
HomeAssistant is an amazing open source solution to automate the digital aspects of your life and living space. They have countless API integrations including one for Vultr which is a VPS provider that I use to host my website with.
I decided to toss in the Vultr API into my HomeAssistant configuration which allows me to start/stop my instance, see upcoming billing charges along with any bandwidth usage/overages.
Unfortunately it wasn't quite plug-and-play as I hoped, and the following information should help anyone who comes across the same issue since I didn't find much info while googling.
The Home Assistant documentation on the setup was pretty straight forward, toss in your API key and the "Subscription ID" of the Vultr instance you created into the configuration file. Once I did that, it continued to fail with a message similar to "Cannot find subscription ID #######################" even though I verified the subscription ID was correct.
A little investigating the commit source code of the integration looks like it is using the outdated version 1.0 of the API instead of the current 2.0 release. So subscription IDs have completely changed from an integer to a what looks like a "universally unique identifier" (UUID) string.
I was able to get the v1 subscription ID by looking up the documentation for the deprecated v1 API instead of v2 and going to https://api.vultr.com/v1/server/list?api_key=$API_KEY and using the "SUBID" value instead of the the new UUID subscription ID found in the Vultr dashboard URL.