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

Airconwithme devices are unavailable in Home Assistant #57

Open
srkoster opened this issue Dec 14, 2024 · 8 comments
Open

Airconwithme devices are unavailable in Home Assistant #57

srkoster opened this issue Dec 14, 2024 · 8 comments

Comments

@srkoster
Copy link

Version 1.8.5 breaks the cloud connection to my Airconwithme devices. They are added to Home Assistant but get the status unavailable.

This is because of edfcb25 and the adding of await self.stop() in intesisbase.py. When I comment out this line on my machine, everything is working fine. My conclusion is that Airconwithme devices don't give a response when a command is issued.

@jnimmo
Copy link
Owner

jnimmo commented Dec 14, 2024

Hi @srkoster, are you able to get some debug logging showing the issue - is it that the writer is being closed when it might be closed already?
I'd be surprised if the Airconwithme devices aren't providing a response, perhaps the API version for Airconwithme needs a bump

DEVICE_AIRCONWITHME: "1.6.2",
but really would need to see a packet capture of the Airconwithme application to validate that

@srkoster
Copy link
Author

The debug logs don't show that much and I'm not sure if the resolving set_value's await is from the cloud or local connection since I use both.

DEBUG (MainThread) [pyintesishome] Opening connection to airconwithme API at 212.92.35.34:8210
DEBUG (MainThread) [pyintesishome] Sending command {"command":"connect_req","data":{"token":709274429}}
DEBUG (MainThread) [pyintesishome] Cancelled the keepalive task
DEBUG (MainThread) [pyintesishome] Received: {"command":"connect_rsp","data":{"status":"ok"}}
DEBUG (MainThread) [pyintesishome] airconwithme API Received: {"command":"connect_rsp","data":{"status":"ok"}}
INFO (MainThread) [pyintesishome] airconwithme successfully authenticated
DEBUG (MainThread) [pyintesishome] Resolving set_value's await
DEBUG (MainThread) [pyintesishome] pyIntesisHome lost connection to the airconwithme server

I can try to bump the API version on my installation, or to add more debug logging in the python script.

@srkoster
Copy link
Author

srkoster commented Dec 14, 2024

I did a packet capture and indeed, the airconwithme app shows a request and a acknowledge back from the api.

So I guess something else is causing that TimeoutError. Unfortunately raising the timeout doesn't work either.

@srkoster
Copy link
Author

I've added a bit more debug logging and then get the following log. It shows that there's a received response (processed by the async def _data_received(self) function), but it's only processed after the async def _send_command(self, command: str) function has been completely entirely (so always after the timeout)

2024-12-15 07:02:44.382 DEBUG (MainThread) [pyintesishome] Opening connection to airconwithme API at 212.92.35.34:8210
2024-12-15 07:02:44.421 DEBUG (MainThread) [pyintesishome] Sending command {"command":"connect_req","data":{"token":1989604596}}
2024-12-15 07:02:44.421 DEBUG (MainThread) [pyintesishome] If writer 
2024-12-15 07:02:44.421 DEBUG (MainThread) [pyintesishome] Start drain 
2024-12-15 07:02:44.421 DEBUG (MainThread) [pyintesishome] Wait for received response 
2024-12-15 07:02:49.422 DEBUG (MainThread) [pyintesishome] Timeout error 
2024-12-15 07:02:49.423 DEBUG (MainThread) [pyintesishome] Received: {"command":"connect_rsp","data":{"status":"ok"}}

@jnimmo
Copy link
Owner

jnimmo commented Dec 15, 2024

Thanks for confirming that, how quick was the response in the packet capture?

@srkoster
Copy link
Author

It was sub second

@jnimmo jnimmo closed this as completed in e1c1ebd Dec 17, 2024
@jnimmo jnimmo reopened this Dec 17, 2024
@jnimmo
Copy link
Owner

jnimmo commented Dec 17, 2024

Could you try out the latest commit of pyIntesishome - or try copying in the updated timeout code? Looks like the timeout might have been blocking and preventing the response from being processed?

timeout = 5.0
start_time = asyncio.get_event_loop().time()
while not self._received_response.is_set():
if asyncio.get_event_loop().time() - start_time > timeout:
_LOGGER.error("Timeout waiting for response")
await self.stop()
break
await asyncio.sleep(0.1)

@srkoster
Copy link
Author

Thanks for the update. Unfortunately the outcome is the same:
2024-12-17 13:25:06.368 ERROR (MainThread) [pyintesishome] Timeout waiting for response

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

No branches or pull requests

2 participants