Hello All
I noticed a problem with conversion string to float.
I’m scraping data from the inverter site:
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:
Probably the values 18.01 to 18.09 are converting to 18.1 to 18.9.
What I am doing wrong?