home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.37k stars 29.9k forks source link

Fronius integration not presenting values after firmware upgrade #54206

Closed ornago closed 3 years ago

ornago commented 3 years ago

The problem

After upgrading the firmware of Fronius DataManager from 3.17.3-1 to 3.18.7-1 Home Assistant loses track of the fronius-related entities (they disappear from the whole system) and I observe the log entries provided in this issue.

My last working configuration (in config/sensors.yaml) is also provided

I can see that the _solarapi is actually providing meaningful output, as I can query http://192.168.0.181/solar_api/v1/GetMeterRealtimeData.cgi?Scope=Device&DeviceId=0 and it gives me JSON with all sorts of data I'd love to see reappearing in Home Assistant:

{
   "Body" : {
      "Data" : {
         "Current_AC_Phase_1" : 16.59,
         "Current_AC_Phase_2" : 7.4400000000000004,
         "Current_AC_Phase_3" : 2.4300000000000002,
         "Details" : {
            "Manufacturer" : "Fronius",
            "Model" : "Smart Meter 50kA-3",
            "Serial" : "17312718"
         },
         "Enable" : 1,
         "EnergyReactive_VArAC_Sum_Consumed" : 390,
...

With the 3.17 firmware version everything was working as expected, the changelog of fronius' firmware update does not really give insights what has changed that could have broken the integration. I am a bit out of ideas here and would appreciate any kind of help! :)

What is version of Home Assistant Core has the issue?

core-2021.8.3

What was the last working version of Home Assistant Core?

core-2021.8.3

What type of installation are you running?

Home Assistant OS

Integration causing the issue

fronius

Link to integration documentation on our website

https://www.home-assistant.io/integrations/fronius/

Example YAML snippet

- platform: fronius
    resource: http://192.168.0.181/
    monitored_conditions:
    - sensor_type: meter
      device: 0
    - sensor_type: inverter
      device: 4
    - sensor_type: power_flow

Anything in the logs that might be useful for us?

Logger: pyfronius
Source: /usr/local/lib/python3.9/site-packages/pyfronius/__init__.py:157
First occurred: 12:43:20 (2 occurrences)
Last logged: 12:43:20

API version API_VERSION.V0 does not support request of current meter data
API version API_VERSION.V0 does not support request of current power flow data

Additional information

No response

probot-home-assistant[bot] commented 3 years ago

fronius documentation fronius source (message by IssueLinks)

probot-home-assistant[bot] commented 3 years ago

Hey there @nielstron, mind taking a look at this issue as it has been labeled with an integration (fronius) you are listed as a code owner for? Thanks! (message by CodeOwnersMention)

ornago commented 3 years ago

Hey! I found the underlying issue. With the firmware update on the fronius device their API got less tolerant about a trailing / in the configured resource option.

After I changed my config to look like this ...

- platform: fronius
    resource: http://192.168.0.181
    monitored_conditions:
    - sensor_type: meter
      device: 0
    - sensor_type: inverter
      device: 4
    - sensor_type: power_flow

... (mind the now gone trailing slash in the URL!) it worked fine. The fronius API after the firmware upgrade now being more strict about trailing slashes breaks the pyfronius module used by the fronius integration here. Hence, I want to say that this is definitely not an issue with Home Assistant Core, so I am closing this issue for now. I have been sitting together with a friend, providing a PR (https://github.com/nielstron/pyfronius/pull/28) to pyfronius to be less strict about trailing slashes in the given device URL.