Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating to HA 2202.2 breaks Apple TV Integration #1641

Closed
apfelflo89 opened this issue Feb 3, 2022 · 10 comments
Closed

Updating to HA 2202.2 breaks Apple TV Integration #1641

apfelflo89 opened this issue Feb 3, 2022 · 10 comments
Labels
3rd party Used for issues dealing applications using pyatv bug

Comments

@apfelflo89
Copy link

Describe the bug

Ive tried all possibilities now, I was on atv-beta and wanted to switch to the official integration now.
after some reboots the integration stop working . Is there something I can do to preserve my working config?

Error log

Logger: homeassistant.config_entries
Source: config_entries.py:735 
First occurred: 14:44:38 (198 occurrences) 
Last logged: 14:49:26

Error occurred loading configuration flow for integration apple_tv: Exception importing custom_components.apple_tv.config_flow



Logger: homeassistant.loader
Source: components/apple_tv/__init__.py:6 
First occurred: 14:53:55 (39 occurrences) 
Last logged: 14:54:49

Unexpected exception importing component homeassistant.components.apple_tv
Unexpected exception importing platform homeassistant.components.apple_tv.config_flow
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/loader.py", line 547, in get_component
    cache[self.domain] = importlib.import_module(self.pkg_path)
  File "/usr/local/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/usr/src/homeassistant/homeassistant/components/apple_tv/__init__.py", line 6, in <module>
    from pyatv import connect, exceptions, scan
  File "/usr/local/lib/python3.9/site-packages/pyatv/__init__.py", line 24, in <module>
    from pyatv.protocols import PROTOCOLS
  File "/usr/local/lib/python3.9/site-packages/pyatv/protocols/__init__.py", line 10, in <module>
    from pyatv.protocols import airplay as airplay_proto
  File "/usr/local/lib/python3.9/site-packages/pyatv/protocols/airplay/__init__.py", line 28, in <module>
    from pyatv.protocols import mrp
  File "/usr/local/lib/python3.9/site-packages/pyatv/protocols/mrp/__init__.py", line 56, in <module>
    from pyatv.protocols.mrp import messages, protobuf
  File "/usr/local/lib/python3.9/site-packages/pyatv/protocols/mrp/messages.py", line 8, in <module>
    from pyatv.protocols.mrp import protobuf
  File "/usr/local/lib/python3.9/site-packages/pyatv/protocols/mrp/protobuf/__init__.py", line 6, in <module>
    from .ProtocolMessage_pb2 import ProtocolMessage
  File "/usr/local/lib/python3.9/site-packages/pyatv/protocols/mrp/protobuf/ProtocolMessage_pb2.py", line 21, in <module>
    _ERRORCODE = DESCRIPTOR.message_types_by_name['ErrorCode']
AttributeError: 'NoneType' object has no attribute 'message_types_by_name'

How to reproduce the bug?

rollback to snapshot 2021.12.10 and then updating , removing HACS integration, restarting Home Assistant and then it stops working

What is expected behavior?

same experience like 2021.12.10

Operating System

supervised home assistant ubuntu 20.04

Python

3.9

pyatv

included version of current HACS integration or stable HA

Device

HomePod Minis and Apple TV all on *OS15.03

Additional context

image
image

@apfelflo89 apfelflo89 added the bug label Feb 3, 2022
@postlund
Copy link
Owner

postlund commented Feb 3, 2022

I'm not entirely sure how to debug this, but I believe that some other integration probably pulls in protobuf with an older version that is not supported by pyatv. Would have been great with a dependency tree somehow.

@apfelflo89
Copy link
Author

How can I serve you with that?

@apfelflo89
Copy link
Author

If I recall correctly that has to be one of HA stock integrations, because my HACS Integrations stay untouched while updating to 2022.02 right, since with 2021.12 everything is fine?

@apfelflo89
Copy link
Author

OK I saw the same issue now having atv-beta 3.0.1 running unter 2021.12.10 now. Is there something I can investigate on my side?

@mountainsandcode
Copy link

@postlund This may be a point. I have this issue as well - tracked in home-assistant/core#65498. I do have a custom integration which contains protobuf with an older version.

@apfelflo89 Can you download diagnostics (see 2022.02 release post) for any integration (doesn't matter which one) and share/ check if protobuf is included there somewhere?

@postlund
Copy link
Owner

postlund commented Feb 3, 2022

@mountainsandcode Sounds reasonable enough. Most likely some of the official integrations pulls it in as well. But I'm a bit puzzled how this can happen, it sounds like a bug in dependency management to me.

@postlund postlund added the 3rd party Used for issues dealing applications using pyatv label Feb 3, 2022
@apfelflo89
Copy link
Author

@mountainsandcode @postlund that would be my config entries, seems like my car custom integration needs a specific version of protobuf. Can I find a way around that?

  "home_assistant": {
    "installation_type": "Home Assistant Supervised",
    "version": "2022.2.1",
    "dev": false,
    "hassio": true,
    "virtualenv": false,
    "python_version": "3.9.7",
    "docker": true,
    "arch": "x86_64",
    "timezone": "Europe/Berlin",
    "os_name": "Linux",
    "os_version": "5.4.0-97-generic",
    "supervisor": "2022.01.1",
    "host_os": "Ubuntu 20.04.3 LTS",
    "docker_version": "19.03.8",
    "chassis": "vm",
    "run_as_root": true
  },
  "custom_components": {
    "presence_simulation": {
      "version": "1.12",
      "requirements": []
    },
    "breaking_changes": {
      "version": "21.12.0",
      "requirements": [
        "pyhaversion>=21.3.0",
        "integrationhelper>=0.2.2",
        "awesomeversion"
      ]
    },
    "esxi_stats": {
      "version": "0.6.2",
      "requirements": [
        "pyvmomi==7.0.1"
      ]
    },
    "hacs": {
      "version": "1.21.0",
      "requirements": [
        "aiogithubapi>=21.11.0"
      ]
    },
    "alexa_media": {
      "version": "3.10.15",
      "requirements": [
        "alexapy==1.25.3",
        "packaging>=20.3",
        "wrapt>=1.12.1"
      ]
    },
    "xiaomi_cloud_map_extractor": {
      "version": "v2.1.5",
      "requirements": [
        "pillow",
        "pybase64",
        "python-miio",
        "requests",
        "pycryptodome"
      ]
    },
    "waste_collection_schedule": {
      "version": "1.14.0",
      "requirements": [
        "icalendar",
        "recurring_ical_events",
        "bs4"
      ]
    },
    "shopping_list": {
      "version": "0.5",
      "requirements": []
    },
    "reversotts": {
      "version": "1.0.2",
      "requirements": [
        "pyttsreverso==0.4"
      ]
    },
    "car_wash": {
      "version": "1.5.1",
      "requirements": []
    },
    "xiaomi_miio_fan": {
      "version": "0.5.4",
      "requirements": [
        "construct==2.10.56",
        "python-miio>=0.5.9.2"
      ]
    },
    "unifiprotect": {
      "version": "0.12.0-beta11",
      "requirements": [
        "pyunifiprotect==3.1.1"
      ]
    },
    "meross_cloud": {
      "version": "1.2.0rc2",
      "requirements": [
        "meross_iot==0.4.4.4"
      ]
    },
    "mbapi2020": {
      "version": "0.6.2",
      "requirements": [
        "protobuf==3.14.0"
      ]
    },
    "attributes": {
      "version": "1.2.0",
      "requirements": []
    },
    "unifigateway": {
      "version": "0.3.3",
      "requirements": [
        "pyunifi==2.21"
      ]
    },
    "easee": {
      "version": "0.9.40",
      "requirements": [
        "pyeasee==0.7.42"
      ]
    },
    "instagram": {
      "version": "1.0.3",
      "requirements": [
        "instaloader==4.8.1"
      ]
    }
  },
  "integration_manifest": {
    "domain": "easee",
    "name": "Easee EV charger",
    "version": "0.9.40",
    "documentation": "https://github.com/fondberg/easee_hass",
    "issue_tracker": "https://github.com/fondberg/easee_hass/issues",
    "requirements": [
      "pyeasee==0.7.42"
    ],
    "config_flow": true,
    "codeowners": [
      "@fondberg",
      "@tmjo",
      "@olalid",
      "@astrandb"
    ],
    "iot_class": "cloud_push",
    "is_built_in": false
  },
  "data": {
    "account": {
      "password": "**REDACTED**",
      "username": "**REDACTED**"
    },
    "options": {
      "monitored_sites": [
        "Garage"
      ],
      "custom_units": [
        "kW"
      ]
    }
  }
}```

@mountainsandcode
Copy link

@apfelflo89 mbapi2020 it is. I also had this integration installed. Removing the integration, uninstalling it from HACS, and then updating HA to 2022.02.1 solved the issue for me. I'll open a ticket in that repo.

@apfelflo89
Copy link
Author

Issue doesn't concern this integration, it was just a symptome. Error lays within mbapi2020 for integration of Mercedes Benz Cars. Can be solved for now by deleting mbapi2020, upgrading and then get it again via HACS but remove "requirements": ["protobuf==3.14.0"], from the manifest.json . Works for me at least.

@ReneNulschDE
Copy link

released a new version of mbapi2020 and changed the protobuf version to 3.19.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3rd party Used for issues dealing applications using pyatv bug
Projects
None yet
Development

No branches or pull requests

4 participants