Fix Home Assistant catalog QML compatibility

This commit is contained in:
Gabriel Brown
2026-08-17 16:06:05 -04:00
parent ff67387c42
commit 65a8197419
2 changed files with 11 additions and 1 deletions
@@ -42,7 +42,11 @@ Singleton {
}
if (result.ok === true) {
root.entities = Array.isArray(result.entities) ? result.entities : [];
root.entities = Array.isArray(result.entities)
? result.entities.map(entity => Object.assign({}, entity, {
name: entity.sourceName, domain: "light"
}))
: [];
root.phase = "ready";
root.stale = false;
root.lastError = "";
@@ -255,6 +255,12 @@ class HomeAssistantBridgeTest(unittest.TestCase):
def test_qml_refreshes_through_the_catalog_command(self) -> None:
self.assertIn('command: [root.helperPath, "catalog"]', QML_SERVICE.read_text())
def test_qml_adapts_catalog_entities_for_legacy_consumers(self) -> None:
source = QML_SERVICE.read_text()
self.assertIn("result.entities.map(entity => Object.assign({}, entity, {", source)
self.assertIn('name: entity.sourceName, domain: "light"', source)
def test_authentication_error_is_redacted(self) -> None:
self.assertEqual(
bridge.public_http_error(401, "sensitive response"),