diff --git a/README.md b/README.md index 8be6c682..075040bc 100644 --- a/README.md +++ b/README.md @@ -384,7 +384,8 @@ key | optional | type | default | description `locale` | True | string | `en_US` | Used by babel to determinante Date format on screensaver, also used for localization. `dateFormatBabel` | True | string | `full` | formatting options on https://babel.pocoo.org/en/latest/dates.html?highlight=name%20of%20day#date-fields `timeFormat` | True | string | `%H:%M` | Time Format on screensaver. Substring after `?` is displayed in a seperate smaller textbox. Useful for 12h time format with AM/PM
`"%I:%M ?%p"`-`dateAdditonalTemplate` | True | string | `" - {{ states('sun.sun') }}"` | Addional Text dispayed after Date, can contain a Homeassistant Template, text after `~` will be moved to an addional line between time and date +`dateAdditonalTemplate` | True | string | `""` | Addional Text dispayed after Date, can contain a Homeassistant Template Example `" - {{ states('sun.sun') }}"` +`timeAdditonalTemplate` | True | string | `""` | Addional Text dispayed below Time, can contain a Homeassistant Template `dateFormat` | True | string | `%A, %d. %B %Y` | date format used if babel is not installed `cards` | False | complex | | configuration for cards that are displayed on panel `screensaver` | True | complex | | configuration for screensaver diff --git a/apps/nspanel-lovelace-ui/luibackend/config.py b/apps/nspanel-lovelace-ui/luibackend/config.py index 546bc3e7..9ef9bfcd 100644 --- a/apps/nspanel-lovelace-ui/luibackend/config.py +++ b/apps/nspanel-lovelace-ui/luibackend/config.py @@ -81,6 +81,7 @@ class LuiBackendConfig(object): 'timeFormat': "%H:%M", 'dateFormatBabel': "full", 'dateAdditonalTemplate': "", + 'timeAdditonalTemplate': "", 'dateFormat': "%A, %d. %B %Y", 'cards': [{ 'type': 'cardEntities', diff --git a/apps/nspanel-lovelace-ui/luibackend/pages.py b/apps/nspanel-lovelace-ui/luibackend/pages.py index 6c3eabe4..1e93c66a 100644 --- a/apps/nspanel-lovelace-ui/luibackend/pages.py +++ b/apps/nspanel-lovelace-ui/luibackend/pages.py @@ -42,7 +42,9 @@ class LuiPagesGen(object): def update_time(self, kwargs): time = datetime.datetime.now().strftime(self._config.get("timeFormat")) - self._send_mqtt_msg(f"time~{time}") + addTemplate = self._config.get("timeAdditonalTemplate") + addTimeText = self._ha_api.render_template(addTemplate) + self._send_mqtt_msg(f"time~{time}~{addTimeText}") def update_date(self, kwargs): global babel_spec