From 800352f351762421e18f733cd08e61b34f0ac05e Mon Sep 17 00:00:00 2001 From: joBr99 <29555657+joBr99@users.noreply.github.com> Date: Sat, 21 May 2022 21:56:23 +0200 Subject: [PATCH] implemented #193 --- README.md | 6 +++--- apps/nspanel-lovelace-ui/luibackend/controller.py | 8 ++++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 94551375..288d2ce7 100644 --- a/README.md +++ b/README.md @@ -79,7 +79,7 @@ For more detailed Instructions see the following Sections: This section describes the Installation Steps for HomeAssistant, follow each step. -
1. Installing HomeAssiant Add-Ons +
1. Installing HomeAssistant Add-Ons

### Installing AppDaemon @@ -107,7 +107,7 @@ Install Studio Code Server from Home Assistant's Supervisor Add-on Store to easi

-
2. Installing HomeAssiant Community Store +
2. Installing HomeAssistant Community Store

### Installing HACS @@ -459,7 +459,7 @@ key | optional | type | default | description `weatherOverrideForecast4` | True | complex | `None` | sensor entity from home assistant here to override the forth weather forecast item on the screensaver `doubleTapToUnlock` | True | boolean | `False` | requires to tap screensaver two times `alternativeLayout` | True | boolean | `False` | alternative layout with humidity -`defaultCard` | True | string | `None` | default page after exiting screensaver; only works with top level cards defined in cards; needs to be a navigation item, see subpages (navigate.type_key) +`defaultCard` | True | string | `None` | default page after exiting screensaver; only works with top level cards defined in cards; needs to be a navigation item, see subpages (navigate.type_key) This config option will also be evaluated as a HomeAssistant Template. `key` | True | string | `None` | Used by navigate items Example for the weatherOverride config options: diff --git a/apps/nspanel-lovelace-ui/luibackend/controller.py b/apps/nspanel-lovelace-ui/luibackend/controller.py index 544f590a..37709ad5 100644 --- a/apps/nspanel-lovelace-ui/luibackend/controller.py +++ b/apps/nspanel-lovelace-ui/luibackend/controller.py @@ -136,8 +136,12 @@ class LuiController(object): # internal buttons if entity_id == "screensaver" and button_type == "bExit": # get default card if there is one - if self._config.get("screensaver.defaultCard") is not None: - dstCard = self._config.searchCard(self._config.get("screensaver.defaultCard")) + defaultCard = self._config.get("screensaver.defaultCard") + if defaultCard is not None: + defaultCard = self._ha_api.render_template(defaultCard) + self._ha_api.log(f"Searching for the following page as defaultPage: {defaultCard}") + dstCard = self._config.searchCard(defaultCard) + self._ha_api.log(f"Result for the following page as defaultPage: {dstCard}") if dstCard is not None: self._previous_cards = [] self._previous_cards.append(dstCard)