I have an mqtt sensor which returns something like 1.762;ok
And i want to extract the number value.
{{ states.sensor.ebusd_mqtt_waterpressure.state.split(’;’)[0] }} gives me a correct number value
But as soon as i add the the replace statement - i get a list. How can this be fixed?
{{ states.sensor.ebusd_mqtt_waterpressure.state.split(’;’)[0] | replace(’.’, ‘,’) }}
petro
(Petro)
January 14, 2022, 12:18pm
2
comma’s are going to enforce a list return for templates. If you want the comma as the decimal separator, change your numerical display for your user and keep the value with the period.
That’s what i already have for the user set
But in this case i get a decimal point. Even although i have a float conversion in the end
“{{ value.split(’;’)[0] | float }}”
i still cannot get proper display of the graphs.
petro
(Petro)
January 14, 2022, 12:34pm
4
graph display will only happen if you have a unit_of_measurement