Conversion to float problem in scraping method

Hello All
I noticed a problem with conversion string to float.
I’m scraping data from the inverter site:
image
My code:

scrape:
  - resource: http://192.168.1.2/status.html
    authentication: basic
    username: admin
    password: ----
    scan_interval: 30
    sensor:
    - name: totalenergy
      select: "script"
      index: 1
      value_template: "{{ (( value.split(';')[7] ) | replace ('var webdata_total_e = ','') | replace(';', '') | replace('\"', '')|float) }}"
      unit_of_measurement: "kWh"
    - name: currentpower
      select: "script"
      index: 1
      value_template: "{{ (( value.split(';')[5] ) | replace ('var webdata_now_p = ','' ) | replace(';', '') | replace('\"', '') |float) }}"
      unit_of_measurement: "W"
    - name: todayenergy
      select: "script"
      index: 1
      value_template: "{{ (( value.split(';')[6] ) | replace ('var webdata_today_e = ','') | replace(';', '') | replace('\"', '')|float)}}"
      unit_of_measurement: "kWh"

On the chart it looks strange:
image
Probably the values 18.01 to 18.09 are converting to 18.1 to 18.9.

What I am doing wrong?

It’s hard to believe we have this kind of error on the float conversion, as this is use everywhere… And it is quite easy to test your hypothesis in Developer Tools. Which I’ve tested and the results looks good:

Why you think this is not from the data dor e? Are you able to plot a similar graph or find historical data on that system to compare with what you see in HA?

Thank you. I see the conversion is ok. So, probably the problem is with input data ot scraping method. Tomorrow I will check the string on the inverter site when the value will be x.0x and also I will check the conversion using C#. I hope it will be sunny day :slight_smile:

I have checked the data from the power converter and I noticed that the data are wrong. For example after 11,97 the next value is 12,2 then 12,13.
So I need some trick to add 0 after coma in case when only one digit is after coma. Is it possible to do?