got it
the device should look something like that
{
"id": "energymeter",
"name": "Skippers Energy Meter",
"class": "LogWatcher",
"file": "/home/pi/meter.log",
"attributes": [
{
"name": "consumed",
"type": "number",
"unit": "kW"
},
],
"lines": [
{
"match": "<reading\\s*id=\"p_consumed\"\\s*unit=\"kW\">([0-9]+\\.[0-9]+)<\\/reading>",
"consumed": "$1"
}
]
},
logfile meter.log is your above example
<update>
<detected>true</detected>
<reading id="e_consumed_1" unit="kWh">583.782000</reading>
<reading id="e_consumed_2" unit="kWh">668.518000</reading>
<reading id="e_produced_1" unit="kWh">274.548000</reading>
<reading id="e_produced_2" unit="kWh">622.283000</reading>
<reading id="p_consumed" unit="kW">0.251000</reading>
<reading id="p_produced" unit="kW">0.000000</reading>
<text id="e_switch">out</text>
</update>
i guess from here you can set up the other devices or an array for yourself, don’t you?
you just need to get the reading into a logfile. you can try and use the above curl command and try if logreader will parse when all data is in one row.
maybe alter the curl somehow like that to get linefeeds. i’m no curl specialist, so i hope this will work!
curl http://<ipadres>:1000/cgi/electricityMeter/update --data-binary "/home/pi/meter.log"
the --data-binary option will forward the data as is without any change.
usually curl removes linebreaks. just try a little bit, i’m sure it won’t shipwreck now! you will make it!!