This PR is a spin-off of other PRs and a result of my testing of the integration while working on those other PRs. Testing involved adding and removing the integration a few times, which goes through the config flow. I noticed that the config flow web UI was not displaying authentication errors when the user entered an incorrect Octopus account number or API key. After this PR, “Invalid Authentication” is displayed in red on the form as shown in the following screenshot:
It’s a terse two-word error message, but it takes advantage of Home Assistant’s standard error message localisation in multiple languages. Anyway, I just made it work the way I understood it was supposed to. :-)
While working on PR #38, I noticed that the body of OctopusIntelligentSystem.start() was copy-and-paste-kind-of-similar to the try_connection() function in config_flow.py, and had the same bugs. So I refactored them to call a common function (in a new graphql_util.py file) and fixed some issues there.
This PR is a spin-off of other PRs and a result of my testing of the integration while working on those other PRs. Testing involved adding and removing the integration a few times, which goes through the config flow. I noticed that the config flow web UI was not displaying authentication errors when the user entered an incorrect Octopus account number or API key. After this PR, “Invalid Authentication” is displayed in red on the form as shown in the following screenshot:
It’s a terse two-word error message, but it takes advantage of Home Assistant’s standard error message localisation in multiple languages. Anyway, I just made it work the way I understood it was supposed to. :-)
While working on PR #38, I noticed that the body of
OctopusIntelligentSystem.start()
was copy-and-paste-kind-of-similar to thetry_connection()
function inconfig_flow.py
, and had the same bugs. So I refactored them to call a common function (in a newgraphql_util.py
file) and fixed some issues there.See more details in other comments.