Closed n9yty closed 1 week ago
Ah, I don't have a Fronius Smart Meter, so the Meter Data is coming back empty. Perhaps this needs to be accounted for in the code? It doesn't seem there is a configuration option that would handle this.
The inverter data looks like this:
{
"Body" : {
"Data" : {
"DAY_ENERGY" : {
"Unit" : "Wh",
"Values" : {
"1" : 32820
}
},
"PAC" : {
"Unit" : "W",
"Values" : {
"1" : 5324
}
},
"TOTAL_ENERGY" : {
"Unit" : "Wh",
"Values" : {
"1" : 49680
}
},
"YEAR_ENERGY" : {
"Unit" : "Wh",
"Values" : {
"1" : 49680
}
}
}
},
"Head" : {
"RequestArguments" : {
"DeviceClass" : "Inverter",
"Scope" : "System"
},
"Status" : {
"Code" : 0,
"Reason" : "",
"UserMessage" : ""
},
"Timestamp" : "2024-08-29T16:14:13-05:00"
}
}
Yes, this was it. I just cut out that section and hardcoded them to zeroes, but probably something better could be done?
Changes in backend/devices/Fronius.py:
# Meter data
- str_total_consumed_from_grid_wh = meter_data["Body"]["Data"]["0"]["EnergyReal_WAC_Plus_Absolute"]
- total_consumed_from_grid_kwh = float(
- str_total_consumed_from_grid_wh) * 0.001
- str_total_fed_in_wh = meter_data["Body"]["Data"]["0"]["EnergyReal_WAC_Minus_Absolute"]
- total_fed_in_kwh = float(str_total_fed_in_wh) * 0.001
+ if ( len(meter_data["Body"]["Data"]) > 0 ):
+ str_total_consumed_from_grid_wh = meter_data["Body"]["Data"]["0"]["EnergyReal_WAC_Plus_Absolute"]
+ total_consumed_from_grid_kwh = float(
+ str_total_consumed_from_grid_wh) * 0.001
+ str_total_fed_in_wh = meter_data["Body"]["Data"]["0"]["EnergyReal_WAC_Minus_Absolute"]
+ total_fed_in_kwh = float(str_total_fed_in_wh) * 0.001
+ else:
+ str_total_consumed_from_grid_wh = 0
+ total_consumed_from_grid_kwh = 0
+ str_total_fed_in_wh = 0
+ total_fed_in_kwh = 0
and I ran into one more error solved by this in the same file:
- str_grid_power_w = inverter_data["Body"]["Data"]["Site"]["P_Grid"]
+ str_grid_power_w = inverter_data["Body"]["Data"]["Site"]["P_Grid"] or 0
Now it is running and capturing the data. Yes, it is only half the picture, but it is all of the picture that I have. :)
Hi, when I designed this project, I had my own setup consisting of a Fronius inverter + smart meter in mind. But you're right: it would be nice to disable the smart meter part with a simple config switch, in case only an inverter is present.
I'll add that to my todo list, but of course a pull request would be welcome as well ;-)
I would also love to see that currently pending pull request accepted, as I do have an Emporia monitor that could perhaps provide at least total usage to help see the difference between consumption and usage. Being able to define multiple devices as that patch allows would be great. In fact, then it might even be worth defining the Fronius device as two devices, the inverter and the meter and then a user would configure based on what they have.
I was excited to find this. Trying it out with my new Fronius Primo inverter:
This is similar to what I saw when I tried the fronius-json-tools python script I found.
I noticed it also had:
If I hit the URL directly I get this:
Is the data in a different format? Is something not set up right in the Fronius to return the data properly? I'd love to work through this and help get it supported if possible.