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

Hub not discovered #9

Closed
ag-wood opened this issue Nov 16, 2020 · 3 comments
Closed

Hub not discovered #9

ag-wood opened this issue Nov 16, 2020 · 3 comments

Comments

@ag-wood
Copy link

ag-wood commented Nov 16, 2020

Hi and thanks for your good work. I'm trying to work out the issue I am having with adding an Acmeda hub to HomeAssistant as an integration, which has led me to here.

The integration in HA fails to find my hub and the demo.py in this project appears to mirror that behaviour. When doing a discover with demo.py, the packet I receive contains the data:

b'\x00\x00\x00\x03W\x00\x00\x04\x00\x16BLmjn8ampyLghgNx6Efeir\x00\x06\xf0\xfek"s\x14\x00\x0800000039\x00 d3f02996ae1e49e58d8f30fac78a5811\x00\x00\x00\x00\x00\x00\x00\x00'

I am wondering if the above is enough to allow you to help me explain why the aiopulse module is not recognising my hub.

Thanks for any information you can supply.

@atmurray
Copy link
Owner

atmurray commented Nov 21, 2020

Hi, the way the discovery works is that it sends a udp broadcast packet and attempts a TCP connection to any hub that responds.
It doesn't actually decode the UDP response.
Using demo.py and setting the log level to debug (log debug) you should see something like the following:

Starting hub discovery
DEBUG:aiopulse.transport:Connection established
DEBUG:aiopulse.transport:UDP datagram received
INFO:aiopulse.hub:10.0.0.23: Discovered hub on port 12414
DEBUG:aiopulse.transport:Connection established
DEBUG:aiopulse.transport:UDP datagram received
INFO:aiopulse.hub:10.0.0.23: Handshake complete
DEBUG:aiopulse.hub:10.0.0.23: Disconnecting
DEBUG:aiopulse.transport:Socket closed
DEBUG:aiopulse.transport:10.0.0.23: TCP buffer cleared.
DEBUG:aiopulse.transport:10.0.0.23: TCP connection closed.
INFO:aiopulse.hub:10.0.0.23: Disconnected
Hub added to prompt
INFO:aiopulse.hub:Discovery complete
DEBUG:aiopulse.transport:UDP connection closed
DEBUG:aiopulse.transport:Socket closed

What do you get for the same commands?

@ag-wood
Copy link
Author

ag-wood commented Nov 21, 2020

@atmurray , thanks for the reply, mine seems to be much less chatty than yours:

(aiopulse_test) [adrian@localhost aiopulse_test]$ python -V
Python 3.8.0
(aiopulse_test) [adrian@localhost aiopulse_test]$ pip freeze
aiopulse==0.4.2
async-timeout==3.0.1
(aiopulse_test) [adrian@localhost aiopulse_test]$ python ./demo.py 
> log debug
Log level set to debug
> discover
Starting hub discovery
> DEBUG:aiopulse.transport:Connection established
INFO:aiopulse.hub:Discovery complete
DEBUG:aiopulse.transport:UDP connection closed
DEBUG:aiopulse.transport:Socket closed

A tcp dump at the same time shows nothing of tcp packets, only udp. Does the hub have to be in a particular mode or is it enough that it is connected to the wifi?

@ag-wood
Copy link
Author

ag-wood commented Nov 21, 2020

@atmurray, thanks for the prompt in the right direction. It turns out it was a firewall issue i.e. inbound packets were being blocked. I'll need to investigate further but temporarily stopping the firewall and then re-testing resulted in a successful discovery.

@ag-wood ag-wood closed this as completed Nov 21, 2020
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