Hey folks, I have figured it out a way how to extract the relevant device info from the massive json file and output these data in csv format for further analysis.
Let’s say the massive json file is stored in DEVICE_DATE:
I used the following to extract my relevant device info from DEVICE_DATA and output it to an external file in csv format.
echo "Time,Total Power Generation(W),Total Grid Power(W),Total Consumption Power(W),Battery Power(W),SoC(%)" > "${RELEVANT_DEVICE_DATA_FILE}"
echo "${DEVICE_DATA}" | jq -r '
.paramDataList[].dataList | reduce .[] as $item ({};
if $item.name == "System Time" then . + {SystemTime: $item.value}
elif $item.name == "Total Power Generation" then . + {TotalPowerGeneration: $item.value}
elif $item.name == "Total Grid Power" then . + {TotalGridPower: $item.value}
elif $item.name == "Total Consumption Power" then . + {TotalConsumptionPower: $item.value}
elif $item.name == "Battery Power" then . + {BatteryPower: $item.value}
elif $item.name == "SoC" then . + {SOC: $item.value}
else . end)
| [.SystemTime, .TotalPowerGeneration,.TotalGridPower,.TotalConsumptionPower,.BatteryPower,.SOC]
| @csv | gsub("\""; "")' >> "${RELEVANT_DEVICE_DATA_FILE}"
This works brilliantly for me.
The name of each item may be different for your inverter. So check that out from the dataList in the massive json file. You could list all the item’s names using the following command:
I have the app token from step 3 but can’t see where I’m going wrong
Edit:: I’ve resolved the API issue so looks to be working, however the next part is getting it integrated to Energy Dashboard, I’m stuck at this part now.
I’m up to step 7 in post number 1 I can’t see my sensor I created following the steps provided, what am I doing wrong?
I can see on the json path finder the item I want which is Cumulative Production (Active) which is line 91, should the value template in the Home assistant config file show the following?
think you might be missing the actual dataList/json_attributes in your sensor…so everything is working as you have it set up but you are not actually bringing in the dataList anywhere…
add this to your template and you should be up and running
(add it in line with headers and payload:)
No, that’s just a single value you are showing in the sensor…if you want to bring back all of the data from the API you’d either need multiple sensors or to capture it into the attributes of this sensor (and then split out the values you want to see using more template sensors)…that’s what’s working for me anyway
Today I tried again using this method to collect sensors from my solarman installation after getting a not available error. This happens always after a couple of months.
This method did work for years for me.
But today step 2 is giving a timeout and not giving result.
Beside this step 1 is creating constantly a different bearer
Someone experencing the same?
Is there a solution?