Hi there, I have an existing KNX setup and just now want to switch from a different visualization to home assistant. So far, great. I am using lovelace and floorplan.
Here, I have an element which, when clicked, should increase the desired temperature by 0.5. The current status of the desired temperature can be obtained from the KNX bus, so in knx.yaml I have
This results in an error when I click on the element: “Could not serialize DPTTemperature” with my formula. Just for checking, if I enter a literal number under payload, everything works fine. What can I do? Thanks in advance for any hint/help.
It would help if you also provided the error from the logs.
My best guess: states("sensor.solltemp_status") returns a string, so you’d have to states("sensor.solltemp_status") | float(0) it before you can add a number.
I have tried your suggestion. Same error.
Am I trying to do this in the wrong way?
Even a simple formula ‘{{ 15.5 + 1.5 }}’ works, just the above one does not. Is something broken in the states() function, or am I using it in a way I should not?
Edit: I found the error changes when I use ‘${…}’ instead of ‘{{…}}’ Now I get the error
<ConversionError description="Could not serialize DPTTemperature" value="{{ (sensor.schlafzimmer_solltemp_status.state + 0.5) }}"/>
This means it can’t make a number from the string "{{ (sensor.schlafzimmer_solltemp_status.state + 0.5) }}"
I have no idea where “sensor.schlafzimmer_solltemp_status.state” comes from and why it is not evaluated correctly. Try to test it beforehand in “Developer Tools → Templates”.
This looks like the template isn’t evaluated at all. It is passed as whole as string.
Afaik it works that way in automations. You seem to use it somewhere else, so maybe templates aren’t supposed to work there?
Ok, just for reference, I have resolved the issue using an automation. (Not very elegant but the best I could do).
So basically this is like my template idea above, only because Lovelace does not support templates, the template is pushed into an automation.
So in the Lovelace dashboard, under view, there is a YAML snippet like