Hi!
I am trying to scrape the values of my power inverter (SofarSolar 8.8KTL-X), as the addon I found is not maintained any more.
I can acess a status page via html: http://192.168.1.120/status.html
Using a basicauth username and password I can get an html page with javascript variables:
<script type="text/javascript">
var webdata_sn = "SF4ES008XXXXXX ";
var webdata_msvn = "V250";
var webdata_ssvn = "";
var webdata_pv_type = "SF4ES008";
var webdata_rate_p = "";
var webdata_now_p = "3640";
var webdata_today_e = "35.82";
var webdata_total_e = "376.0";
var webdata_alarm = "";
var webdata_utime = "0";
var cover_mid = "1747221067";
var cover_ver = "LSW3_14_FFFF_1.0.47";
var cover_wmode = "APSTA";
var cover_ap_ssid = "AP_1747221067";
var cover_ap_ip = "10.10.100.254";
var cover_ap_mac = "30:EA:E7:34:XXXX";
var cover_sta_ssid = "FRITZ!Box 6490 Cable";
var cover_sta_rssi = "70%";
var cover_sta_ip = "192.168.1.120";
var cover_sta_mac = "34:EA:E7:34:XXXX";
var status_a = "1";
var status_b = "0";
var status_c = "0";
Using scrape I can fetch the first values and throw away unneeded parts.
sensor:
- platform: scrape
resource: http://192.168.1.120/status.html
name: wechselrichter_today
authentication: basic
username: XXX
password: XXX
select: "script"
index: 1
value_template: '{{ (( value.split(";")[6] ) | replace ("var webdata_today_e = ","")) }}'
Delivers:
Only thing i am now struggeling with is removing the " from the values
Tested:
value_template: '{{ (( value.split(";")[6] ) | replace ("var webdata_today_e = ","")) | replace (""", "") }}'
does of course not workâŚ
I tried to change " and â
value_template: "{{ (( value.split(';')[6] ) | replace ('var webdata_today_e = ','')) | replace ('"', '') }}"
but his gives a bad configurationâŚ
can anyone help how to remove the " ?