Skip to content
This repository has been archived by the owner on Dec 14, 2022. It is now read-only.

reconnect after device has been powered off #28

Open
betaboon opened this issue Mar 17, 2021 · 10 comments
Open

reconnect after device has been powered off #28

betaboon opened this issue Mar 17, 2021 · 10 comments

Comments

@betaboon
Copy link
Owner

@o0v7r0o i just reproduced this and it indeed is a problem to be solved :)

@SamJongenelen
Copy link

SamJongenelen commented Jun 15, 2021

+1 here. When the device is offline on HA startup, the following logging is produced:

2021-06-14 16:17:04 DEBUG (MainThread) [aioairctrl.coap.client] syncing
2021-06-14 16:17:05 DEBUG (MainThread) [coap] Sending request - Token: 5518, Remote:
2021-06-14 16:17:05 DEBUG (MainThread) [coap] Sending message <aiocoap.Message at 0xffffaae1ce80: Type.NON POST (MID 26733, token 5518) remote , 1 option(s), 8 byte(s) payload>
2021-06-14 16:17:10 DEBUG (MainThread) [coap] Socket error recevied, details: SockExtendedErr(ee_errno=113, ee_origin=2, ee_type=3, ee_code=1, ee_pad=0, ee_info=0, ee_data=0)
2021-06-14 16:17:10 DEBUG (MainThread) [coap] Incoming error 113 from <UDP6EndpointAddress x.x.x.x (locally x.x.x.x%lo)>
2021-06-14 16:17:13 ERROR (MainThread) [homeassistant.components.fan] Error while setting up philips_airpurifier_coap platform for fan
OSError: [Errno 113] Host is unreachable
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 250, in _async_setup_platform
await asyncio.shield(task)
File "/config/custom_components/philips_airpurifier_coap/fan.py", line 198, in async_setup_platform
await device.init()
File "/config/custom_components/philips_airpurifier_coap/fan.py", line 293, in init
self._client = await CoAPClient.create(self._host)
File "/usr/local/lib/python3.8/site-packages/aioairctrl/coap/client.py", line 38, in create
await obj._init()
File "/usr/local/lib/python3.8/site-packages/aioairctrl/coap/client.py", line 33, in _init
await self._sync()
File "/usr/local/lib/python3.8/site-packages/aioairctrl/coap/client.py", line 54, in _sync
response = await self._client_context.request(request).response
File "/usr/local/lib/python3.8/site-packages/aiocoap/protocol.py", line 832, in _run_outer
await cls._run(app_request, response, weak_observation, protocol, log)
File "/usr/local/lib/python3.8/site-packages/aiocoap/protocol.py", line 884, in _run
blockresponse = await blockrequest.response
aiocoap.error.NetworkError: [Errno 113] Host is unreachable
2021-06-14 16:17:16 ERROR (MainThread) [coap] Connection loss was not expected.
2021-06-14 17:49:35 ERROR (MainThread) [frontend.js.latest.202106030] https://myhal.com/frontend_latest/core.7ce1f920.js:1:7688 Uncaught Error: Suspend promise not set

@GSzabados
Copy link

It would be really great if this could be fixed. I had recently a power outage. Everything comes back on without any issue, but the air purifier. For that, I have to restart HA.

Any idea how to solve this?

@GSzabados
Copy link

GSzabados commented Jul 7, 2021

Has any of you tried any of the methods what is in this topic?

https://community.home-assistant.io/t/add-service-integration-reload/231940

Either a service call of:

homeassistant.reload_config_entry

But for this a config entry would be required, what is currently not part of the integration.

Or maybe just a service call to:

homeassistant.update_entity

@SamJongenelen
Copy link

Has any of you tried any of the methods what is in this topic?

https://community.home-assistant.io/t/add-service-integration-reload/231940

Either a service call of:

homeassistant.reload_config_entry

But for this a config entry would be required, what is currently not part of the integration.

Or maybe just a service call to:

homeassistant.update_entity

Ah, you're trying a workaround for the unavailable by reloading the integration via a service call. Could work yes

@GSzabados
Copy link

Ah, you're trying a workaround for the unavailable by reloading the integration via a service call. Could work yes

The purifier is not on a UPS, so it is loosing power during an outage. When the power is restored, to get it work, I have to restart HA, what I would like to avoid.

Unfortunately I cannot test the idea, as I don't have access to the power plug of the purifier. And fortunately haven't had any outages for the last week. 😆

@GSzabados
Copy link

Actually there was an outage this morning, so I could try the update_entity option. And it is not working as the entity hasn't got a unique id, as it was set up through the configuration.yaml. So it cannot make a service call.

@SamJongenelen
Copy link

Ok, you might want to set the unique_id, right?

@mhetzi mhetzi mentioned this issue Aug 17, 2021
@SamJongenelen
Copy link

I tested this pr version and it reconnects

@GSzabados
Copy link

GSzabados commented Oct 13, 2021

I tested this pr version and it reconnects

What is your case requiring the reconnect? Is it power outage or just loosing connection?

Just asking because there are two issues regarding loosing connection.

One is the power outages what could be solved by adding a unique_id and calling the service to restart the integration.
The other one is a firmware related issue what might have a solution in the aioairctrl repository as a PR.

@SamJongenelen
Copy link

Power conservation; i disable parts of the home conditionally using sonoffs.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants