appdaemon
appdaemon copied to clipboard
Render template seems to have problems with special characters
What happened?
When render_template is called it fails with special characters and changes them to a strange 0xff characters.
Adding any of this to the render engine should yield to 21.8 °C
{{states('sensor.nspanel_diningroom_temperature', rounded=True, with_unit=True)}}
{{states('sensor.nspanel_diningroom_temperature', rounded=True)}} {{'%c'|format(176)}}C
{{states('sensor.nspanel_diningroom_temperature', rounded=True)}} °C
Instead it renders as 21.8���C
Relevant code lines -- see addTimeText:
def update_time(self, kwargs):
time = datetime.datetime.now().strftime(self._config.get("timeFormat"))
addTemplate = self._config.get("timeAdditionalTemplate")
addTimeText = apis.ha_api.render_template(addTemplate)
self._send_mqtt_msg(f"time~{time}~{addTimeText}")
Application is nspanel ui, latest release (4.3.3) https://github.com/joBr99/nspanel-lovelace-ui
Version
4.4.2
Installation type
Home Assistant add-on
Relevant log output
-----------------------------------------------------------
Add-on: AppDaemon
Python Apps and Dashboard using AppDaemon 4.x for Home Assistant
-----------------------------------------------------------
Add-on version: 0.15.2
You are running the latest version of this add-on.
System: Home Assistant OS 11.1 (aarch64 / raspberrypi3-64)
Home Assistant Core: 2023.11.2
Home Assistant Supervisor: 2023.11.3
Relevant code in the app or config file that caused the issue
def update_time(self, kwargs):
time = datetime.datetime.now().strftime(self._config.get("timeFormat"))
addTemplate = self._config.get("timeAdditionalTemplate")
addTimeText = apis.ha_api.render_template(addTemplate)
self._send_mqtt_msg(f"time~{time}~{addTimeText}")
Anything else?
No response