Reworked numericMenuItem to be able to display a different conten in the sublabel than jus a number.

This commit is contained in:
thmichel
2025-10-25 21:26:44 +02:00
parent 264b160fdf
commit 2cd171637c
4 changed files with 78 additions and 13 deletions

View File

@@ -629,6 +629,10 @@ class HomeAssistantApp extends Application.AppBase {
if (item instanceof HomeAssistantToggleMenuItem) {
(item as HomeAssistantToggleMenuItem).updateToggleState(data[i.toString() + "t"]);
}
if (item instanceof HomeAssistantNumericMenuItem) {
// (item as HomeAssistantNumericMenuItem).updateNumericState("22");
(item as HomeAssistantNumericMenuItem).updateNumericState(data[i.toString() + "n"].toString());
}
}
if (Settings.getMenuCheck() && Settings.getCacheConfig() && !mIsCacheChecked) {
// We are caching the menu configuration, so let's fetch it and check if its been updated.
@@ -723,6 +727,11 @@ class HomeAssistantApp extends Application.AppBase {
"template" => (item as HomeAssistantToggleMenuItem).getToggleTemplate()
});
}
if (item instanceof HomeAssistantNumericMenuItem) {
mTemplates.put(i.toString() + "n", {
"template" => (item as HomeAssistantNumericMenuItem).getNumericTemplate()
});
}
}
}
// https://developers.home-assistant.io/docs/api/native-app-integration/sending-data/#render-templates