Hi Forum.
I have a solar inverter that displays data in an HTML table, which I’d like to transfer to a sensor and monitor. What’s the correct method for this? Is it through scraping, using REST, or something entirely different?
I’ve managed to create a Python script that converts the HTML data into JSON, but I’m struggling to display it as a value in a sensor.
How should I proceed?
Here is an example of the data and the sensor I’ve tried without succes.
sensor:
- platform: file
name: 'Power L1'
file_path: custom_components/solutronic/solutronic.py
value_template: "{{ value_json | selectattr('ID', 'equalto', '001') | map(attribute='Value') | first }}"
unit_of_measurement: 'kW'
scan_interval: 5
and the json data:
{
"ID": "005",
"Label": "PAC",
"Description": "Leistung AC",
"Value": "394"
},
{
"ID": "001",
"Label": "PACL1",
"Description": "power L1",
"Value": "130"
},
{
"ID": "002",
"Label": "PACL2",
"Description": "power L2",
"Value": "136"
},
{
"ID": "003",
"Label": "PACL3",
"Description": "power L3",
"Value": "128"
},
Looking forward hearing from you.
Cheers, Rasmus