add timeAdditonalTemplate

This commit is contained in:
joBr99
2022-06-06 19:57:03 +02:00
parent e18412fa1c
commit a37319a00d
3 changed files with 6 additions and 2 deletions

View File

@@ -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 <pre>`"%I:%M ?%p"`</pre>
`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

View File

@@ -81,6 +81,7 @@ class LuiBackendConfig(object):
'timeFormat': "%H:%M",
'dateFormatBabel': "full",
'dateAdditonalTemplate': "",
'timeAdditonalTemplate': "",
'dateFormat': "%A, %d. %B %Y",
'cards': [{
'type': 'cardEntities',

View File

@@ -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