Move MQTT discovery information into devices.json.

We inject some "magic" overrides when `devices.json` is created, rather
than at runtime; this means that users can update the discovery
information directly in their `devices.json` configuration rather than
in the code. This way, they can change existing or add new discovery
information without needing a code change.
This commit is contained in:
James Muscat
2024-08-11 14:48:56 +01:00
parent d9196ad5bf
commit 5a2611967b
2 changed files with 25 additions and 11 deletions

View File

@@ -17,6 +17,7 @@ from Crypto.Hash import SHA256
from Crypto.Random import get_random_bytes
from HCxml2json import xml2json
from HADiscovery import augment_device_features
# These two lines enable debugging at httplib level (requests->urllib3->http.client)
# You will see the REQUEST, including HEADERS and DATA, and RESPONSE with HEADERS but without DATA.
@@ -310,6 +311,6 @@ for app in account["data"]["homeAppliances"]:
machine = xml2json(features, description)
config["description"] = machine["description"]
config["features"] = machine["features"]
config["features"] = augment_device_features(machine["features"])
print(json.dumps(configs, indent=4))