mirror of
https://github.com/joBr99/nspanel-lovelace-ui.git
synced 2025-12-27 18:04:24 +01:00
add timeAdditonalTemplate
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -81,6 +81,7 @@ class LuiBackendConfig(object):
|
||||
'timeFormat': "%H:%M",
|
||||
'dateFormatBabel': "full",
|
||||
'dateAdditonalTemplate': "",
|
||||
'timeAdditonalTemplate': "",
|
||||
'dateFormat': "%A, %d. %B %Y",
|
||||
'cards': [{
|
||||
'type': 'cardEntities',
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user