Hi, I made recently a board with an analog sensor which reads the temperature of a water tank and sends it over mqtt. This is the raw value, so the conversion must be done on hass.
I tried with value_template like this but it doesn’t work because it seems like it can read the actual value of the sensor.
- name: SolarTemp analog
platform: mqtt
state_topic: home/solar/analog
friendly_name: "Water Temp"
unit_of_measurement: "°C"
value_template: "{{ ((states.sensor.solartemp_analog.state | float * -0.136709) + 113.362 ) }}"
If the value_template is left only with the state, it shows a wrong value too (always shows 0)
value_template: "{{ states.sensor.solartemp_analog.state | float }}"
The weird part is that if I remove the value_template the analog value is shown correctly on hass and if I put it on the template debugger it shows the correct temperature, so it looks like the template is ok.
{{ ((states.sensor.solartemp_analog.state | float * -0.136709) + 113.362 ) }}