diff --git a/config/dot/quickshell/services/HomeAssistant.qml b/config/dot/quickshell/services/HomeAssistant.qml index f73f77e..8beceab 100644 --- a/config/dot/quickshell/services/HomeAssistant.qml +++ b/config/dot/quickshell/services/HomeAssistant.qml @@ -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 = ""; diff --git a/tests/quickshell/home_assistant_bridge_test.py b/tests/quickshell/home_assistant_bridge_test.py index b1e1fb6..6a1b329 100644 --- a/tests/quickshell/home_assistant_bridge_test.py +++ b/tests/quickshell/home_assistant_bridge_test.py @@ -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"),