Now i want to send the temperature via a automation, that is triggered when i change a input_number slider (only 0.5 steps), that number is going through a helper sensor template wich looks like this:
name: “Input temperatur Regler Wohnzimmer”
state: >
{% set tempFloat = (states(‘input_number.temperaturregler’)) | float %}
{% set tempInt = (tempFloat*2) | int %}
{% set tempHex = ‘%0x’ % tempInt %}
{{ tempHex }}
When i look at my entity now it shows me the correct hex number 2d, but my thermostat change his
temp to 103.0 degr.
When i go to the developer tools and try it with the service call:
My thought was that when i send it in the developer service call it is an int? and when it
is send through the template it changes its value string? etc… ?
If I understand you right template sensor and rest command work fine but automation doesn’t.
So it would be helpful to see yaml-code of your automation, too. (Please use blockquote to post the code.)
the data is: adress of the device: 6BE31201 + 11 for setTemp + Temp in HEX
It works totally fine if i send it via the Browser or i test it in the dev service and temp in hex as a example
21 degres = 2A(HEX) (they calculate 21*2 = 42 = 0x2A)
so the url looks like: http:…data=6BE31201112A
And if i change my slider to 21 deg my helper sensor change his value correctly to 2a
but my thermostat get something else so i think the error is somewhere in the formatting
of this “variable”? and how it is send to this string?
Also, please format code correctly using the </> button. There are a few “smart quotes” in the provided code which will not work in templates — check that these are actually “normal” quotes:
Here’s a nice way to get the hex value for twice the input value:
{% set input = 22.5 %}
{% set in2 = (input*2)|int(0) %}
{% set h = "0123456789ABCDEF" %}
{% set hex = h[in2//16]~h[in2%16] %}
{{ hex }}