safepay / sensor.fronius

A Fronius Sensor for Home Assistant
MIT License
80 stars 31 forks source link

fronius gen24 & fronius symo always 0 #58

Closed RW-7 closed 3 years ago

RW-7 commented 3 years ago

Hello, I'm currently trying to integrate and display at least one Fronius.

I don't get any error messages in the log, but the display is 0 no matter where i have a fronius gen24 with 2 smart meters + 1x fronius symo in the same building. later I wanted to add a second symo with a smart meter that is external. But I can't even get one to run

I have now installed release 0.9.6 my config looks like this

sensor:
#  - platform: fronius_inverter
#    ip_address: http://192.168.4.96
  - platform: fronius_inverter
    name: Gen24Home
    ip_address: http://192.168.10.96
    powerflow: True
    power_units: kW
    smartmeter: True
utility_meter:
  # calculate daily energy consumed from grid (input must be in kWh)
  grid_consumed_energy_day:
    source: sensor.fronius_smartmeter_energy_ac_consumed
    cycle: daily
  # calculate daily energy sold to grid (input must be in kWh)
  grid_sold_energy_day:
    source: sensor.fronius_smartmeter_energy_ac_sold
    cycle: daily
  energy_solar_production_daily:
   name: "PV Generation (Daily)"
   source: sensor.energy_solar_production
   cycle: daily
  energy_grid_consumption_daily:
   name: "Grid Consumption (Daily)"
   source: sensor.energy_grid_consumption
   cycle: daily
  energy_grid_feedin_daily:
   name: "Grid Export (Daily)"
   source: sensor.energy_grid_feedin
   cycle: daily

 ## Not used in Energy Dashboard
  energy_house_consumption_daily:
   name: "Total Consumption (Daily)"
   source: sensor.energy_total_consumption
   cycle: daily
sensor:
- platform: template
  sensors:
    power_total_consumption:
      friendly_name: Total Consumption
      unit_of_measurement: "W"
      value_template: '{{ (states("sensor.fronius_house_load") | float * -1) | round | int }}'
- platform: template
  sensors:
    power_grid_consumption:
      friendly_name: Grid Consumption
      unit_of_measurement: "W"
      value_template: >-
        {% if states('sensor.fronius_grid_usage') | float > 0 %}
          {{ states('sensor.fronius_grid_usage') | round | int }}
        {% else %}
          0
        {% endif %}
- platform: integration
  source: sensor.power_total_consumption
  name: energy_total_consumption
  unit_prefix: k
  unit_time: h
  round: 2
  method: left
- platform: integration
  source: sensor.fronius_panel_status
  name: energy_solar_production
  unit_prefix: k
  unit_time: h
  round: 2
  method: left
- platform: integration
  source: sensor.power_grid_consumption
  name: energy_grid_consumption
  unit_prefix: k
  unit_time: h
  round: 2
  method: left
- platform: integration
  source: sensor.power_grid_feedin
  name: energy_grid_feedin
  unit_prefix: k
  unit_time: h
  round: 2
  method: left
- platform: template
  sensors:
    power_grid_feedin:
      friendly_name: Grid Feed-in
      unit_of_measurement: "W"
      value_template: >-
        {% if states('sensor.fronius_grid_usage') | float < 0 %}
          {{ (states('sensor.fronius_grid_usage') | float * -1) | round | int }}
        {% else %}
          0
        {% endif %}
- platform: template
  sensors:
     energy_consumption_cost_aud:
      icon_template: mdi:currency-usd
      value_template: >
        {{(states('input_number.grid_consumption_energy_cost')|float / 100)|round(4, 'ceil')}}
      unit_of_measurement: 'EUR/kWh'
     energy_generation_cost_aud:
      icon_template: mdi:currency-usd
      value_template: >
        {{(states('input_number.grid_generation_energy_cost')|float / 100)|round(4, 'ceil')}}
      unit_of_measurement: 'EUR/kWh'

input_number:
 # Grid Consumption Energy Cost (EUR/kWh)
   grid_consumption_energy_cost:
     name: 'Grid Consumption Energy Cost'
     mode: box
     min: 0
     max: 1000
     step: 0.001
     unit_of_measurement: "EUR (cents)/kWh"
     icon: mdi:currency-usd
 # Grid Generation Energy Cost (EUR/kWh)
   grid_generation_energy_cost:
     name: 'Grid Generation Energy Cost'
     mode: box
     min: 0
     max: 1000
     step: 0.001
     unit_of_measurement: "EUR (cents)/kWh"
     icon: mdi:currency-usd
colwilliamsnz commented 3 years ago

I don't have a Gen24 so can't comment directly on that but I notice you have http:// in the ipaddress field. It should just be the IP address ;) maybe that will work?

RW-7 commented 3 years ago

thanks for the hint, unfortunately remains at 0 everywhere, neither gen24 nor symo react with any values

colwilliamsnz commented 3 years ago

When you say no errors in the log, seems odd if you're getting nothing. It would be worth seeing at least what the component is up to (it logs steps as it collects data). Have you enabled logging for the component?

In configuration.yaml:

logger:
  default: critical
  logs:
    custom_components.fronius_inverter: debug

Additionally, do you get anything if you use your browser to go to the following URLs? http://192.168.10.96/solar_api/GetAPIVersion.cgi

http://192.168.10.96/solar_api/v1/GetInverterRealtimeData.cgi?Scope=Device&DeviceId=0&DataCollection=CommonInverterData

RW-7 commented 3 years ago

thank you for your advice, now a few values are displayed. all that is missing now is the entity in the energrie dashboard and the two smart meters on the gen24. the error was that I had in addition to the http 2x sensor: in it my code now looks like this.

sensor:
- platform: fronius_inverter
  ip_address: 192.168.4.96
  name: Symo Home
  power_units: kW
  smartmeter: false
- platform: fronius_inverter
  name: Gen24Home
  ip_address: 192.168.4.42
  powerflow: True
  power_units: kW
  smartmeter: True
- platform: fronius_inverter
  name: Symo Garten
  ip_address: 192.168.10.96
  powerflow: True
  power_units: kW
  smartmeter: True
- platform: template
  sensors:
    power_total_consumption:
      friendly_name: Total Consumption
      unit_of_measurement: "W"
      value_template: '{{ (states("sensor.fronius_house_load") | float * -1) | round | int }}'
- platform: template
  sensors:
    power_grid_consumption:
      friendly_name: Grid Consumption
      unit_of_measurement: "W"
      value_template: >-
        {% if states('sensor.fronius_grid_usage') | float > 0 %}
          {{ states('sensor.fronius_grid_usage') | round | int }}
        {% else %}
          0
        {% endif %}
- platform: integration
  source: sensor.power_total_consumption
  name: energy_total_consumption
  unit_prefix: k
  unit_time: h
  round: 2
  method: left
- platform: integration
  source: sensor.fronius_panel_status
  name: energy_solar_production
  unit_prefix: k
  unit_time: h
  round: 2
  method: left
- platform: integration
  source: sensor.power_grid_consumption
  name: energy_grid_consumption
  unit_prefix: k
  unit_time: h
  round: 2
  method: left
- platform: integration
  source: sensor.power_grid_feedin
  name: energy_grid_feedin
  unit_prefix: k
  unit_time: h
  round: 2
  method: left
- platform: template
  sensors:
    power_grid_feedin:
      friendly_name: Grid Feed-in
      unit_of_measurement: "W"
      value_template: >-
        {% if states('sensor.fronius_grid_usage') | float < 0 %}
          {{ (states('sensor.fronius_grid_usage') | float * -1) | round | int }}
        {% else %}
          0
        {% endif %}
- platform: template
  sensors:
     energy_consumption_cost_aud:
      icon_template: mdi:currency-usd
      value_template: >
        {{(states('input_number.grid_consumption_energy_cost')|float / 100)|round(4, 'ceil')}}
      unit_of_measurement: 'EUR/kWh'
     energy_generation_cost_aud:
      icon_template: mdi:currency-usd
      value_template: >
        {{(states('input_number.grid_generation_energy_cost')|float / 100)|round(4, 'ceil')}}
      unit_of_measurement: 'EUR/kWh'
utility_meter:
  # calculate daily energy consumed from grid (input must be in kWh)
  grid_consumed_energy_day:
    source: sensor.fronius_smartmeter_energy_ac_consumed
    cycle: daily
  # calculate daily energy sold to grid (input must be in kWh)
  grid_sold_energy_day:
    source: sensor.fronius_smartmeter_energy_ac_sold
    cycle: daily
  energy_solar_production_daily:
   name: "PV Generation (Daily)"
   source: sensor.energy_solar_production
   cycle: daily
  energy_grid_consumption_daily:
   name: "Grid Consumption (Daily)"
   source: sensor.energy_grid_consumption
   cycle: daily
  energy_grid_feedin_daily:
   name: "Grid Export (Daily)"
   source: sensor.energy_grid_feedin
   cycle: daily

 ## Not used in Energy Dashboard
  energy_house_consumption_daily:
   name: "Total Consumption (Daily)"
   source: sensor.energy_total_consumption
   cycle: daily

input_number:
 # Grid Consumption Energy Cost (EUR/kWh)
   grid_consumption_energy_cost:
     name: 'Grid Consumption Energy Cost'
     mode: box
     min: 0
     max: 1000
     step: 0.001
     unit_of_measurement: "EUR (cents)/kWh"
     icon: mdi:currency-usd
 # Grid Generation Energy Cost (EUR/kWh)
   grid_generation_energy_cost:
     name: 'Grid Generation Energy Cost'
     mode: box
     min: 0
     max: 1000
     step: 0.001
     unit_of_measurement: "EUR (cents)/kWh"
     icon: mdi:currency-usd
colwilliamsnz commented 3 years ago

Good to hear. If you're running 0.9.6 then the Energy dashboard requires three of this components sensors as follows:

Solar production: total_energy Grid consumption: smartmeter_energy_ac_consumed Grid feed-in: smartmeter_energy_ac_sold

Note it initially takes 2 "cycles" of statistics roll up to appear in the dashboard...which occurs at 12 minutes past the hour.

nilrog commented 3 years ago

Unfortunately Fronius seems to have made some changes to the API for Gen24. One, that is documented, is that some values are always 0 (see #42). So check if it is those values that you are missing on the Gen24.

The second, was that it seems that they changed the API, but didn't implement a new version of the API. So the same version API on Symo and Gen24 do not behave the same. I do think I recall seeing something that Fronius was going to fix the second issue with a FW update during summer. But as I do not have a Gen24 I never followed up on that.

nilrog commented 3 years ago

I should have looked around here again before posting. The second Gen24 issue is mentioned here in #52

@RW-7 What smartmeter do you have connected to your Gen24?

colwilliamsnz commented 3 years ago

If the Fronius API is incomplete, as a workaround I'd feed your power and grid values into appropriate integration and utility sensors (yearly reset best until 2021.9 comes out). This is what I did before getting to the bottom of the changes needed in 0.9.6. Worked fine.

RW-7 commented 3 years ago

i have a smartmeter with id 0 this is in the feed point and Modbus address: 1 and one in the consumption branch (only heating) with Modbus address: 2 and probably id1 sm2 sm1

{
   "Body" : {
      "Data" : {
         "ACBRIDGE_CURRENT_ACTIVE_MEAN_01_F32" : 2.3300000000000001,
         "ACBRIDGE_CURRENT_ACTIVE_MEAN_02_F32" : 2.1589999999999998,
         "ACBRIDGE_CURRENT_ACTIVE_MEAN_03_F32" : 1.913,
         "ACBRIDGE_VOLTAGE_MEAN_12_F32" : 413.19999999999999,
         "ACBRIDGE_VOLTAGE_MEAN_23_F32" : 414.89999999999998,
         "ACBRIDGE_VOLTAGE_MEAN_31_F32" : 414.80000000000001,
         "COMPONENTS_MODE_ENABLE_U16" : 1.0,
         "COMPONENTS_MODE_VISIBLE_U16" : 1.0,
         "COMPONENTS_TIME_STAMP_U64" : 1629972364.0,
         "Details" : {
            "Manufacturer" : "Fronius",
            "Model" : "Smart Meter 63A",
            "Serial" : "xxxxxxxxxx"
         },
         "GRID_FREQUENCY_MEAN_F32" : 50.0,
         "SMARTMETER_ENERGYACTIVE_ABSOLUT_MINUS_F64" : 7230490.0,
         "SMARTMETER_ENERGYACTIVE_ABSOLUT_PLUS_F64" : 18154959.0,
         "SMARTMETER_ENERGYACTIVE_CONSUMED_SUM_F64" : 18154959.0,
         "SMARTMETER_ENERGYACTIVE_PRODUCED_SUM_F64" : 7230490.0,
         "SMARTMETER_ENERGYREACTIVE_CONSUMED_SUM_F64" : 12869930.0,
         "SMARTMETER_ENERGYREACTIVE_PRODUCED_SUM_F64" : 63644030.0,
         "SMARTMETER_FACTOR_POWER_01_F64" : -0.98999999999999999,
         "SMARTMETER_FACTOR_POWER_02_F64" : -0.98999999999999999,
         "SMARTMETER_FACTOR_POWER_03_F64" : -0.90000000000000002,
         "SMARTMETER_FACTOR_POWER_SUM_F64" : -0.97999999999999998,
         "SMARTMETER_POWERACTIVE_01_F64" : -551.73000000000002,
         "SMARTMETER_POWERACTIVE_02_F64" : -496.67000000000002,
         "SMARTMETER_POWERACTIVE_03_F64" : -353.89999999999998,
         "SMARTMETER_POWERACTIVE_MEAN_01_F64" : -765.11339999999973,
         "SMARTMETER_POWERACTIVE_MEAN_02_F64" : -680.9428999999991,
         "SMARTMETER_POWERACTIVE_MEAN_03_F64" : -586.56789999999967,
         "SMARTMETER_POWERACTIVE_MEAN_SUM_F64" : -1402.3,
         "SMARTMETER_POWERAPPARENT_01_F64" : 555.70500000000004,
         "SMARTMETER_POWERAPPARENT_02_F64" : 515.13739999999996,
         "SMARTMETER_POWERAPPARENT_03_F64" : 460.07650000000001,
         "SMARTMETER_POWERAPPARENT_MEAN_01_F64" : 768.82716500000015,
         "SMARTMETER_POWERAPPARENT_MEAN_02_F64" : 743.51727833333246,
         "SMARTMETER_POWERAPPARENT_MEAN_03_F64" : 677.30690433333302,
         "SMARTMETER_POWERAPPARENT_MEAN_SUM_F64" : 1417.0,
         "SMARTMETER_POWERREACTIVE_01_F64" : -25.210000000000001,
         "SMARTMETER_POWERREACTIVE_02_F64" : -11.68,
         "SMARTMETER_POWERREACTIVE_03_F64" : -169.47,
         "SMARTMETER_POWERREACTIVE_MEAN_SUM_F64" : -206.36000000000001,
         "SMARTMETER_VALUE_LOCATION_U16" : 0.0,
         "SMARTMETER_VOLTAGE_01_F64" : 238.5,
         "SMARTMETER_VOLTAGE_02_F64" : 238.59999999999999,
         "SMARTMETER_VOLTAGE_03_F64" : 240.5,
         "SMARTMETER_VOLTAGE_MEAN_01_F64" : 238.38966666666684,
         "SMARTMETER_VOLTAGE_MEAN_02_F64" : 238.58166666666656,
         "SMARTMETER_VOLTAGE_MEAN_03_F64" : 239.96433333333334
      }
   },
   "Head" : {
      "RequestArguments" : {
         "DeviceClass" : "Meter",
         "DeviceId" : "0",
         "Scope" : "Device"
      },
      "Status" : {
         "Code" : 0,
         "Reason" : "",
         "UserMessage" : ""
      },
      "Timestamp" : "2021-08-26T10:06:04+00:00"
   }
}
nilrog commented 3 years ago

Yes, the Gen24 has completely different names for the different values compared to the Symo. I need to see if they have published any updated API documentation. But I think we need to add a separate config option for specifying if the inverter is Symo/Gen24 so we know what values to look for when creating the sensors for HA.

@RW-7 Could you check what FW version your Gen24 is running?

RW-7 commented 3 years ago

I think few have the 2nd smartmeter, i added the graphic of the missing sensor values sm4 sm3

nilrog commented 3 years ago

The problem is not the second smartmeter. The problem is that the API for the Gen24 is different to the Symo even though they both have the same version. The developers at Fronius really screwed this up. So with the current implementation some of the sensors from this integration will be unknown due to that.

RW-7 commented 3 years ago

that some values do not exist is correct, but the yellow marked ones could somehow be brought into the HA? sm5

nilrog commented 3 years ago

Yes, of course they could be brought into HA. But this is precisely the problem. The names of the values in Gen24 is completely different from Symo. Yet they did not change the API version. This integration does not map all values to sensors in HA. It maps specific values, and if those specific values have a different name, as they do in Gen24, then the sensor will be unknown in HA. Fronius should have created a v2 API based on what they implemented for Gen24 to keep this separate.

Which is why I wrote that we probably need to have inverter_type as a new config option since Gen24 does not have the same API as Symo and we need to map things differently.

But first we should clarify exactly what is different, and not working, in Gen24 compared to Symo. And since I do not have a Gen24 I cannot do anything unless someone, like you, posts the output of the API queries from Gen24.

For the smartmeter it is pretty clear now what is different thanks to your input. Is there anything else, apart from the known values that Gen24 always returns as zero?

RW-7 commented 3 years ago

Not that I don't know, you are welcome to send me API queries that I can give to both devices. have a symo gen24 10 plus (there is still the taro), 1x symo 3.7.3 and 1x symo 10.0

nilrog commented 3 years ago

These are the other queries that we depend on, the smartmeter you have already provided. And it is enough to query the Gen24 inverter. The Symo inverters we know how they behave since that is what the current version supports.

Note that there is a slight difference between the two first queries even if they look the same.

http://your_inverter_ip/solar_api/v1/GetInverterRealtimeData.cgi?Scope=System&DeviceId=id_of_your_inverter&DataCollection=CommonInverterData

http://your_inverter_ip/solar_api/v1/GetInverterRealtimeData.cgi?Scope=Device&DeviceId=id_of_your_inverter&DataCollection=CommonInverterData

http://your_inverter_ip/solar_api/v1/GetPowerFlowRealtimeData.fcgi

RW-7 commented 3 years ago

But no problem.

http://your_inverter_ip/solar_api/v1/GetInverterRealtimeData.cgi?Scope=System&DeviceId=id_of_your_inverter&DataCollection=CommonInverterData

{
   "Body" : {
      "Data" : {
         "PAC" : {
            "Unit" : "W",
            "Value" : {
               "1" : 111.89233016967773
            }
         }
      }
   },
   "Head" : {
      "RequestArguments" : {
         "DeviceClass" : "Inverter",
         "Scope" : "System"
      },
      "Status" : {
         "Code" : 0,
         "Reason" : "",
         "UserMessage" : ""
      },
      "Timestamp" : "2021-08-26T17:04:51+00:00"
   }
}

http://your_inverter_ip/solar_api/v1/GetInverterRealtimeData.cgi?Scope=Device&DeviceId=id_of_your_inverter&DataCollection=CommonInverterData

{
   "Body" : {
      "Data" : {
         "DeviceStatus" : {
            "InverterState" : "Running"
         },
         "FAC" : {
            "Unit" : "Hz",
            "Value" : 50.029457092285156
         },
         "IAC" : {
            "Unit" : "A",
            "Value" : 0.69477204978466034
         },
         "IAC_L1" : {
            "Unit" : "A",
            "Value" : 0.17105315625667572
         },
         "IAC_L2" : {
            "Unit" : "A",
            "Value" : 0.17125365138053894
         },
         "IAC_L3" : {
            "Unit" : "A",
            "Value" : 0.17623262107372284
         },
         "IDC" : {
            "Unit" : "A",
            "Value" : 0.2064676433801651
         },
         "PAC" : {
            "Unit" : "W",
            "Value" : 121.71164703369141
         },
         "SAC" : {
            "Unit" : "VA",
            "Value" : 123.07513427734375
         },
         "UAC" : {
            "Unit" : "V",
            "Value" : 237.33687845865884
         },
         "UAC_L1" : {
            "Unit" : "V",
            "Value" : 238.3812255859375
         },
         "UAC_L2" : {
            "Unit" : "V",
            "Value" : 237.15208435058594
         },
         "UDC" : {
            "Unit" : "V",
            "Value" : 651.87066650390625
         }
      }
   },
   "Head" : {
      "RequestArguments" : {
         "DataCollection" : "CommonInverterData",
         "DeviceClass" : "Inverter",
         "Scope" : "Device"
      },
      "Status" : {
         "Code" : 0,
         "Reason" : "",
         "UserMessage" : ""
      },
      "Timestamp" : "2021-08-26T17:05:32+00:00"
   }
}

http://your_inverter_ip/solar_api/v1/GetPowerFlowRealtimeData.fcgi

{
   "Body" : {
      "Data" : {
         "Inverters" : {
            "1" : {
               "DT" : 1,
               "P" : 106
            }
         },
         "Site" : {
            "BatteryStandby" : false,
            "E_Day" : null,
            "E_Total" : null,
            "E_Year" : null,
            "Meter_Location" : "grid",
            "Mode" : "meter",
            "P_Akku" : null,
            "P_Grid" : 235.46000000000001,
            "P_Load" : -342.28863616943363,
            "P_PV" : 134.40208435058594,
            "rel_Autonomy" : 31.210103077028005,
            "rel_SelfConsumption" : 100.0
         },
         "Version" : "12"
      }
   },
   "Head" : {
      "RequestArguments" : {},
      "Status" : {
         "Code" : 0,
         "Reason" : "",
         "UserMessage" : ""
      },
      "Timestamp" : "2021-08-26T17:06:07+00:00"
   }
}
kwanm84 commented 3 years ago

Hi all.

Just got my inverter changed over today to the Gen 24 Symo 10kw, same as RW-7 as far as I can tell.

I have same issues that has already been identified, I am just going to hard code the values temporarily to grab from the api... but let me know if you need any logs or testing done from my side.

Just a random question:

Is the internal temperature of the inverter available anywhere? I just swapped over from a Goodwe, and it was constantly overheating and derating... while I have no doubt this Fronius won't have that issue with a active cooling solution, it would be nice to log the information if it was available.

nilrog commented 3 years ago

@RW-7 @kwanm84 I have made an attempt to add support for Gen24 in my fork and I think it works. But since I do not own a Gen24 I cannot fully verify that it works. I can only verify that the Gen24 sensors does not work against a Symo.

Can you grab sensor.py from this branch in my fork ad try it out? https://github.com/nilrog/sensor.fronius/tree/gen24

There is one new configuration option that you need to add in your fronius_inverter configuration before you restart HA: model: gen24

The new config is also listed in the README in my fork.

With this change all the smartmeter sensors should now report correct values also for Gen24. If you can confirm that it works I will prepare a pull-request to get this included and released.

nilrog commented 3 years ago

@kwanm84

Is the internal temperature of the inverter available anywhere?

I don't have the API document at hand. But if I remember correctly I think it is available in the "history" API (where you can also find the individual DC-readings for the two strings amongst some other things not available in the realtime API). But this API can only be queried at most every 5 mins so it does not really make sense to try to include it here.

kwanm84 commented 3 years ago

@RW-7 @kwanm84 I have made an attempt to add support for Gen24 in my fork and I think it works. But since I do not own a Gen24 I cannot fully verify that it works. I can only verify that the Gen24 sensors does not work against a Symo.

Can you grab sensor.py from this branch in my fork ad try it out? https://github.com/nilrog/sensor.fronius/tree/gen24

There is one new configuration option that you need to add in your fronius_inverter configuration before you restart HA: model: gen24

The new config is also listed in the README in my fork.

With this change all the smartmeter sensors should now report correct values also for Gen24. If you can confirm that it works I will prepare a pull-request to get this included and released.

@nilrog

I can confirm these changes work on my gen24... as you mentioned in other posts, DAY_ENERGY + YEAR_ENERGY according to the API return null, but also TOTAL_ENERGY returns null... as even though the API documents suggest its supported since 1.14, they still haven't been implemented (I am running firmware 1.12.5-0) and its the latest firmware listed.

https://imgur.com/pt8ecHV https://froniussestg24updweprod.blob.core.windows.net/firmware/changelog_Gen24_1.12.5.pdf?sv=2019-02-02&sr=b&sig=K6sdOjlTEHA7aTex5gUFfaEDrrwqcFRX8xBo2RbZw5A%3D&st=2021-04-06T12%3A49%3A38Z&se=9999-12-31T22%3A59%3A59Z&sp=r https://www.fronius.com/en/solar-energy/installers-partners/service-support/tech-support/software-and-updates/symo-gen24plus-update

Also looking through the API says temperature is available through history... but again, isn't working as documented and I can't access it... maybe with this missing firmware...

/GetPowerFlowRealtimeData.fcgi - returns

....
        "E_Day" : null,
        "E_Total" : null,
        "E_Year" : null,
....

Thanks for getting the other parts working, no doubt if/when Fronius fix up the API it will break again if they go back to a similar naming scheme.

edit:

Did get a couple of errors:

sensor.fronius_smartmeter_energy_ac_consumed has unknown unit MWh sensor.fronius_smartmeter_energy_ac_sold has unknown unit MWh

I'm not entirely sure what is getting reported, I've started tracking consumed and sold via home assistant as they aren't reporting a lot of stuff through the api. I can't be sure if those numbers are correct until its been running a while. (0.03 + 0.17) at the moment. Its possible its generated 170kw since Friday, but the inverter wasn't reporting to HA for 2 days, so I can't be sure if that.is accurate.

RW-7 commented 3 years ago

Thank you very much, works fine.

I still have a little question. How can I also read out the 2nd smart meter (heating consumption branch)?

nilrog commented 3 years ago

I can confirm these changes work on my gen24... as you mentioned in other posts, DAY_ENERGY + YEAR_ENERGY according to the API return null, but also TOTAL_ENERGY returns null... as even though the API documents suggest its supported since 1.14, they still haven't been implemented (I am running firmware 1.12.5-0) and its the latest firmware listed.

Good. Then I will prepare a pull-request.

Yes, it seems that Fronius really screwed up the API stuff on the Gen24. I was also surprised last week that the latest FW version was 1.12.5.

Did get a couple of errors:

sensor.fronius_smartmeter_energy_ac_consumed has unknown unit MWh sensor.fronius_smartmeter_energy_ac_sold has unknown unit MWh

Looks like you have this integration configured to report energy in MWh and something does not expect that.

nilrog commented 3 years ago

I still have a little question. How can I also read out the 2nd smart meter (heating consumption branch)?

This integration was not prepared for more than one inverter with additional smartmeter attached. So the only option I see is to add a second instance of this integration where you specify the device_id of the second smartmeter and specify what monitored conditions you want it to report.

RW-7 commented 3 years ago

can you send me a config example of how you envision this?

nilrog commented 3 years ago

I have not tested this but you should be able to configure a second instance like this:

  - platform: fronius_inverter
    name: Fronius_the_second
    ip_address: <ip of your inverter>
    smartmeter: true
    smartmeter_device_id: <the id of second smartmeter>
    monitored_conditions: smartmeter_current_ac_phase_one, smartmeter_current_ac_phase_two, smartmeter_current_ac_phase_three, smartmeter_voltage_ac_phase_one, smartmeter_voltage_ac_phase_two, smartmeter_voltage_ac_phase_three, smartmeter_energy_ac_consumed, smartmeter_energy_ac_sold

That should ignore all the other sensors for this second instance and only report the sensors for your second smartmeter.

RW-7 commented 2 years ago

Gen24 10 Plus FW 1.13.13-1 http://your_inverter_ip/solar_api/v1/GetPowerFlowRealtimeData.fcgi { "Body" : { "Data" : { "Inverters" : { "1" : { "Battery_Mode" : "disabled", "DT" : 1, "E_Day" : null, "E_Total" : 3084583.8405555557, "E_Year" : null, "P" : 0.0, "SOC" : 0.0 } }, "Site" : { "BackupMode" : false, "BatteryStandby" : false, "E_Day" : null, "E_Total" : 3084583.8405555557, "E_Year" : null, "Meter_Location" : "grid", "Mode" : "meter", "P_Akku" : null, "P_Grid" : 557.33000000000004, "P_Load" : -557.33000000000004, "P_PV" : 0.0, "rel_Autonomy" : 0.0, "rel_SelfConsumption" : null }, "Smartloads" : { "Ohmpilots" : {} }, "Version" : "12" } }, "Head" : { "RequestArguments" : {}, "Status" : { "Code" : 0, "Reason" : "", "UserMessage" : "" }, "Timestamp" : "2021-09-28T22:19:18+00:00" } } http://your_inverter_ip/solar_api/v1/GetInverterRealtimeData.cgi?Scope=System&DeviceId=id_of_your_inverter&DataCollection=CommonInverterData { "Body" : { "Data" : { "DAY_ENERGY" : { "Unit" : "Wh", "Values" : { "1" : null } }, "PAC" : { "Unit" : "W", "Values" : { "1" : 0.0 } }, "TOTAL_ENERGY" : { "Unit" : "Wh", "Values" : { "1" : 3084583.8405555557 } }, "YEAR_ENERGY" : { "Unit" : "Wh", "Values" : { "1" : null } } } }, "Head" : { "RequestArguments" : { "Scope" : "System" }, "Status" : { "Code" : 0, "Reason" : "", "UserMessage" : "" }, "Timestamp" : "2021-09-28T22:20:52+00:00" } } http://your_inverter_ip/solar_api/v1/GetInverterRealtimeData.cgi?Scope=Device&DeviceId=id_of_your_inverter&DataCollection=CommonInverterData { "Body" : { "Data" : { "DAY_ENERGY" : { "Unit" : "Wh", "Value" : null }, "DeviceStatus" : { "ErrorCode" : 1175, "InverterState" : "Sleeping", "StatusCode" : 13 }, "IAC" : { "Unit" : "A", "Value" : 0.0 }, "IDC" : { "Unit" : "A", "Value" : 0.0 }, "IDC_2" : { "Unit" : "A", "Value" : null }, "IDC_3" : { "Unit" : "A", "Value" : null }, "PAC" : { "Unit" : "W", "Value" : 0.0 }, "SAC" : { "Unit" : "VA", "Value" : 0.0 }, "TOTAL_ENERGY" : { "Unit" : "Wh", "Value" : 3084583.8405555557 }, "UAC" : { "Unit" : "V", "Value" : 238.89149475097656 }, "UDC" : { "Unit" : "V", "Value" : 39.087368011474609 }, "UDC_2" : { "Unit" : "V", "Value" : null }, "UDC_3" : { "Unit" : "V", "Value" : null }, "YEAR_ENERGY" : { "Unit" : "Wh", "Value" : null } } }, "Head" : { "RequestArguments" : { "DataCollection" : "CommonInverterData", "DeviceId" : "1", "Scope" : "Device" }, "Status" : { "Code" : 0, "Reason" : "", "UserMessage" : "" }, "Timestamp" : "2021-09-28T22:22:23+00:00" } }