nielstron / pyfronius

Automated JSON API based communication with Fronius Symo
MIT License
27 stars 8 forks source link

New Fronius API #6

Open jmtatsch opened 2 years ago

jmtatsch commented 2 years ago

As discovered here there seems to be a new api under http:///components/readable where the GEN24 web interface gets it data from which seems quite extensive, maybe all we ever dreamed of :)

For example it has very interesting lifetime stats for BYD battery storages:

                                        "BAT_CAPACITY_ESTIMATION_MAX_F64" : 21897.0,
                    "BAT_CAPACITY_ESTIMATION_REMAINING_F64" : 16247.0,
                    "BAT_CURRENT_DC_F64" : -4.9048422066971815,
                    "BAT_CURRENT_DC_INTERNAL_F64" : -4.8977628097185475,
                    "BAT_ENERGYACTIVE_LIFETIME_CHARGED_F64" : 2152417.0,
                    "BAT_ENERGYACTIVE_LIFETIME_DISCHARGED_F64" : 1856524.0,
                    "BAT_MODE_CELL_STATE_U16" : 3.0,
                    "BAT_MODE_HYBRID_OPERATING_STATE_U16" : 1.0,
                    "BAT_MODE_LAST_FAULT_PARAMETER_U16" : 0.0,
                    "BAT_MODE_STATE_U16" : 64.0,
                    "BAT_MODE_U16" : 2.0,
                    "BAT_MODE_WAKE_ENABLE_STATUS_U16" : 1.0,
                    "BAT_TEMPERATURE_CELL_F64" : 8.5,
                    "BAT_TEMPERATURE_CELL_MAX_F64" : 9.0,
                    "BAT_TEMPERATURE_CELL_MIN_F64" : 8.0,
                    "BAT_VALUE_STATE_OF_CHARGE_RELATIVE_U16" : 74.200000000000003,
                    "BAT_VALUE_STATE_OF_HEALTH_RELATIVE_U16" : 99.0,
                    "BAT_VALUE_WARNING_CODE_U16" : 46.0,
                    "BAT_VOLTAGE_DC_INTERNAL_F64" : 415.69999999999999,
                    "COMPONENTS_MODE_ENABLE_U16" : 1.0,
                    "COMPONENTS_MODE_VISIBLE_U16" : 1.0,
                    "COMPONENTS_TIME_STAMP_U64" : 1646425005.0,
                    "DCLINK_POWERACTIVE_LIMIT_DISCHARGE_F64" : 16628.0,
                    "DCLINK_POWERACTIVE_MAX_F32" : 16748.0,
                    "DCLINK_VOLTAGE_MEAN_F32" : 415.10000000000002,
                    "DEVICE_TEMPERATURE_AMBIENTEMEAN_F32" : 10.0

@farmio How could this treasure of data best be integrated in pyfronius and then home assistant?

jmtatsch commented 2 years ago

It even has the long missing lifetime energy produced counter PV_ENERGYACTIVE_ACTIVE_SUM_01_U64 measured in watt seconds

farmio commented 2 years ago

Well,

"Note" : "this internal API may be changed any time",

doesn't look that promising to me. Given the inconsistency of the previous models in SolarAPI I guess this would need some major code-housekeeping when new firmware versions are released. I guess they could add these values to specified API endpoints as well in a future update.

As far as I know, Gen24 inverters already expose a lifetime energy counter in SolarAPI since 1.13 or 1.14 https://github.com/home-assistant/core/blob/c5f7e7d1b07d3a017eff521986f8bfa4fac8e151/tests/components/fronius/fixtures/gen24/GetInverterRealtimeData_Device_1.json#L41

jmtatsch commented 2 years ago

True that it's an internal api that might change. However, if you know how lost the Fronius dev team is to even fix their major bugs in the firmware I highly doubt that they will break a lot of the api they use for their working web frontend which they would need to rewrite then. I also doubt that this stuff will make it in the official apis soon with that speed of development. Other third parties such as Hardy Barth Wallboxes seem to already use that private api. I will try to do a pull request for using this alternative api when I find the time.

farmio commented 2 years ago

Ah nice, my "Fronius Symo 5.0-3-M" (Datalogger 3.20.6) provides this endpoint too. But I have no battery, so not really anything interesting there I couldn't get from the official API.

jmtatsch commented 2 years ago

Well, there is only one solution to it then, you need a battery 😂

Javiaris commented 1 day ago

Sadly that is not an option with the Fronius Symo x.x.3-M variant as it is not a hybrid system. So the only Battery that can be used is an AC Battery which might not be the greatest. I have a Fronius Symo 3.7-3-M and trust me my Heart bleeds for DC Battery Backup ;(