tomasmcguinness / homeassistant-mixergy

Add support for Mixergy's smart water tank into Home Assistant
MIT License
31 stars 8 forks source link

Tank unavailable after each Home Assistant upgrade #22

Open Blue-beef opened 9 months ago

Blue-beef commented 9 months ago

Each time Home Assistant is updated my tank data becomes unavailable. To rectify I have delete the tank and add it again with the same credentials and serial number as before.

tomasmcguinness commented 9 months ago

Very strange. I use docker to host my home assistant and I've updated it numerous times without impacting my integration.

Do you get an error in the logs?

Blue-beef commented 9 months ago

Yes, I get the following error message:

Error requesting sensor data: Cannot connect to host www.mixergy.io:443 ssl:default [Try again]

On Mon, 16 Oct 2023 at 10:04, Tomas McGuinness @.***> wrote:

Very strange. I use docker to host my home assistant and I've updated it numerous times without impacting my integration.

Do you get an error in the logs?

— Reply to this email directly, view it on GitHub https://github.com/tomasmcguinness/homeassistant-mixergy/issues/22#issuecomment-1764040319, or unsubscribe https://github.com/notifications/unsubscribe-auth/A27R67ZSMXBQ27IGLAZ5A53X7T2DLANCNFSM6AAAAAA6BXPMYA . You are receiving this because you authored the thread.Message ID: @.***>

Blue-beef commented 9 months ago

Hi Tomas,

I've investigated further and it's happening every time I restart HA, not just when HA is updated.

And the following error is logged:

Log Details (ERROR)

Logger: homeassistant.components.sensor Source: helpers/entity_platform.py:359 Integration: Sensor (documentation https://www.home-assistant.io/integrations/sensor, issues https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+sensor%22 ) First occurred: 5:27:46 pm (1 occurrences) Last logged: 5:27:46 pm Error while setting up mixergy platform for sensor

Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 1155, in _create_direct_connection hosts = await asyncio.shield(host_resolved) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 874, in _resolve_host addrs = await self._resolver.resolve(host, port, family=self._family) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/resolver.py", line 33, in resolve infos = await self._loop.getaddrinfo( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/asyncio/base_events.py", line 867, in getaddrinfo return await self.run_in_executor( ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/socket.py", line 962, in getaddrinfo for res in _socket.getaddrinfo(host, port, family, type, proto, flags): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ socket.gaierror: [Errno -3] Try again

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 290, in _async_refresh self.data = await self._async_update_data() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 246, in _async_update_data return await self.update_method() ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/mixergy/sensor.py", line 25, in async_update_data await tank.fetch_data() File "/config/custom_components/mixergy/tank.py", line 273, in fetch_data await self.authenticate() File "/config/custom_components/mixergy/tank.py", line 86, in authenticate async with session.get(ROOT_ENDPOINT) as resp: File "/usr/local/lib/python3.11/site-packages/aiohttp/client.py", line 1141, in aenter self._resp = await self._coro ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/client.py", line 536, in _request conn = await self._connector.connect( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 540, in connect proto = await self._create_connection(req, traces, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 901, in _createconnection , proto = await self._create_direct_connection(req, traces, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 1169, in _create_direct_connection raise ClientConnectorError(req.connection_key, exc) from exc aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host www.mixergy.io:443 ssl:default [Try again]

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 359, in _async_setup_platform await asyncio.shield(task) File "/config/custom_components/mixergy/sensor.py", line 30, in async_setup_entry await coordinator.async_config_entry_first_refresh() File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 262, in async_config_entry_first_refresh raise ex homeassistant.exceptions.ConfigEntryNotReady: Cannot connect to host www.mixergy.io:443 ssl:default [Try again]

On Mon, 16 Oct 2023 at 10:04, Tomas McGuinness @.***> wrote:

Very strange. I use docker to host my home assistant and I've updated it numerous times without impacting my integration.

Do you get an error in the logs?

— Reply to this email directly, view it on GitHub https://github.com/tomasmcguinness/homeassistant-mixergy/issues/22#issuecomment-1764040319, or unsubscribe https://github.com/notifications/unsubscribe-auth/A27R67ZSMXBQ27IGLAZ5A53X7T2DLANCNFSM6AAAAAA6BXPMYA . You are receiving this because you authored the thread.Message ID: @.***>

tomasmcguinness commented 8 months ago

Interesting issue. This doesn't look like the component itself, rather it cannot reach mixergy.io. Perhaps the component isn't waiting for something to be ready. I will need to look at the integration documentation again and see what I can do about the ConfigEntryNotReady exception.

jdwood38 commented 7 months ago

If it’s helpful, it appears I might have the same or very similar issue but as a fresh install. I had the Mixergy integration installed on a previous HA instance but this is now a new one and I can’t add the tank.

I have no issues logging into Mixergy app or website and I can log into the website when using Firefox integration within HA, so doesn’t seem to be a connectivity issue.

Thanks in advance.

This error originated from a custom integration.

Logger: custom_components.mixergy.config_flow Source: custom_components/mixergy/config_flow.py:82 Integration: Mixergy (documentation, issues) First occurred: 06:37:10 (2 occurrences) Last logged: 06:38:48

Unexpected exception Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 1173, in _create_direct_connection hosts = await asyncio.shield(host_resolved) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 884, in _resolve_host addrs = await self._resolver.resolve(host, port, family=self._family) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/resolver.py", line 33, in resolve infos = await self._loop.getaddrinfo( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/asyncio/base_events.py", line 867, in getaddrinfo return await self.run_in_executor( ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/socket.py", line 962, in getaddrinfo for res in _socket.getaddrinfo(host, port, family, type, proto, flags): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ socket.gaierror: [Errno -3] Try again

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/config/custom_components/mixergy/config_flow.py", line 82, in async_step_user info = await validate_input(self.hass, user_input) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/mixergy/config_flow.py", line 44, in validate_input result = await tank.test_authentication() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/mixergy/tank.py", line 47, in test_authentication return await self.authenticate() ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/mixergy/tank.py", line 88, in authenticate async with session.get(ROOT_ENDPOINT) as resp: File "/usr/local/lib/python3.11/site-packages/aiohttp/client.py", line 1187, in aenter self._resp = await self._coro ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/client.py", line 574, in _request conn = await self._connector.connect( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 544, in connect proto = await self._create_connection(req, traces, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 911, in _createconnection , proto = await self._create_direct_connection(req, traces, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 1187, in _create_direct_connection raise ClientConnectorError(req.connection_key, exc) from exc aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host www.mixergy.io:443 ssl:default [Try again]