Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Render template seems to have problems with special characters #1863

Open
afarago opened this issue Nov 19, 2023 · 0 comments
Open

Render template seems to have problems with special characters #1863

afarago opened this issue Nov 19, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@afarago
Copy link

afarago commented Nov 19, 2023

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

@afarago afarago added the bug Something isn't working label Nov 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant