Climate: Unable to update from sensor: could not convert string to float: '18,8'

I have a template temperature sensor which retrieves values from a json generated by weewx, and these values are in italian decimal format, that is with a ‘,’ not ‘.’
The temperature sensor works fine in my Home Assistant (I can graph its values), except for the climate component which give me this error and doesn’t show any temperature :

ERROR (MainThread) [homeassistant.components.generic_thermostat.climate] Unable to update from sensor: could not convert string to float: '18,7'

I suspected a localization problem so I started hass with locale environment variables, but with no luck:

LC_ALL=it_IT
LANG=it_IT
LANGUAGE=it_IT
LC_NUMERIC=it_IT

This is the configuration:
HA Version: 117.4
Python 3.7.3

sensor:
  - platform: rest
    name: Temperatura Camera Letto
    resource: http://10.20.30.40/weewx.json
    value_template: "{{ value_json.stats.ha.extraTemp1 }}"
    device_class: "temperature"
    unit_of_measurement: '°C'
    scan_interval: 300

climate:
  - platform: generic_thermostat
    name: Termostato
    heater: input_boolean.caldaia
    target_sensor: sensor.temperatura_camera_letto
    ac_mode: false
    target_temp: 20

What can I do to let HA understand the comma as decimal separator?

Try changing the value template sensor to this:

"{{ value_json.stats.ha.extraTemp1 | replace(',','.') | float }}"
1 Like

Thanks Burningstone for the suggestion, it’s the only way.
Unfortunately I realized that HA is not friendly with localization standards (L10N), it completely ignores LC_ environment variables :frowning: