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
72.67k stars 30.42k forks source link

PVPC integration failed to setup #62699

Closed pove closed 2 years ago

pove commented 2 years ago

The problem

Integration is not setting up.

What version of Home Assistant Core has the issue?

core-2021.12.5

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

PVPC Hourly Pricing

Link to integration documentation on our website

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

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Logger: homeassistant.config_entries
Source: components/pvpc_hourly_pricing/__init__.py:142
First occurred: 20:21:20 (1 occurrences)
Last logged: 20:21:20

Error setting up entry PVPC for pvpc_hourly_pricing
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 313, in async_setup
    result = await component.async_setup_entry(hass, self)  # type: ignore
  File "/usr/src/homeassistant/homeassistant/components/pvpc_hourly_pricing/__init__.py", line 107, in async_setup_entry
    coordinator = ElecPricesDataUpdateCoordinator(hass, entry)
  File "/usr/src/homeassistant/homeassistant/components/pvpc_hourly_pricing/__init__.py", line 142, in __init__
    self.api = PVPCData(
TypeError: __init__() got an unexpected keyword argument 'session'

Additional information

No response

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

pvpc_hourly_pricing documentation pvpc_hourly_pricing source (message by IssueLinks)

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

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

jfisbein commented 2 years ago

I have the same problem.

Tried restarting HA, deleting the integration and adding it again, but it didn't solve the issue.

My log:

Logger: homeassistant.config_entries
Source: components/pvpc_hourly_pricing/__init__.py:142
First occurred: 10:59:15 (1 occurrences)
Last logged: 10:59:15

Error setting up entry PVPC for pvpc_hourly_pricing
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 313, in async_setup
    result = await component.async_setup_entry(hass, self)  # type: ignore
  File "/usr/src/homeassistant/homeassistant/components/pvpc_hourly_pricing/__init__.py", line 107, in async_setup_entry
    coordinator = ElecPricesDataUpdateCoordinator(hass, entry)
  File "/usr/src/homeassistant/homeassistant/components/pvpc_hourly_pricing/__init__.py", line 142, in __init__
    self.api = PVPCData(
TypeError: __init__() got an unexpected keyword argument 'session'
azogue commented 2 years ago

Hi @pove and @jfisbein,

Looks like the aiopvpc library didn't update as expected to v3.0.0, which is strange if you're using Home Assistant OS

If you have access to the python environment where HA Core is running, there are some things to check (paths are for the docker container running HA Core in HA OS):

Also, check if there is a deps folder in the config folder. If it exists, it should be empty.

And double-check the custom_components folder to remove any custom install?

pove commented 2 years ago

Hi and thanks @azogue, I have used the SSH Add-on and this command to access bash: docker exec -it homeassistant /bin/bash

From here, I have done the checks you proposed, but it seems everything is ok, anything else I could check?

Here are the checks so far:

  "domain": "pvpc_hourly_pricing",
  "name": "Spain electricity hourly pricing (PVPC)",
  "config_flow": true,
  "documentation": "https://www.home-assistant.io/integrations/pvpc_hourly_pricing",
  "requirements": ["aiopvpc==3.0.0"],
  "codeowners": ["@azogue"],
  "quality_scale": "platinum",
  "iot_class": "cloud_polling"
aiopvpc
aiopvpc-3.0.0.dist-info

INSTALLER LICENSE METADATA RECORD REQUESTED WHEEL

alexa_media         hacs
edata               ytube_music_player
vmanuel commented 2 years ago

Same as @pove .

In /usr/local/lib/python3.9/site-packages/aiopvpc, it is pvpc_data.py with the lines:

class PVPCData:
    ......

    def __init__(
        self,
        *,
        session: aiohttp.ClientSession,
vmanuel commented 2 years ago

Maybe edata custon component? I have it also installed...

vmanuel commented 2 years ago

https://github.com/uvejota/python-edata/blob/dev/requirements.txt ->

aiopvpc==2.2.0

vmanuel commented 2 years ago

Working

So it seems the problem is e-data Custom Component...

vmanuel commented 2 years ago

Created https://github.com/uvejota/homeassistant-edata/issues/37

pove commented 2 years ago

Confirmed. e-data custom component is causing the problem. And as suggested here (https://github.com/uvejota/homeassistant-edata/issues/37#issuecomment-1000874211), just disabling "experimental" config and everything works as expected.