ehendrix23 / aioharmony

Asyncio Python library for connecting to and controlling the Logitech Harmony
Apache License 2.0
23 stars 14 forks source link

Cannot connect using IP #29

Open jasonyork opened 2 years ago

jasonyork commented 2 years ago

I'm unable to connect to my harmony hub when specifying an IP address, however it does work when using the full hostname. See the two examples below for details. If there is anything else I can try, please let me know. Thanks.

aioharmony --harmony_ip 192.168.50.54 --loglevel DEBUG show_config

2021-12-21 16:33:01,516:DEBUG:  aioharmony.__main__ 192.168.50.54: Connecting to HUB
2021-12-21 16:33:01,516:DEBUG:  aioharmony.harmonyapi   192.168.50.54: Initialize
2021-12-21 16:33:01,516:DEBUG:  aioharmony.harmonyclient    192.168.50.54: Initialize HUB
2021-12-21 16:33:01,516:DEBUG:  aioharmony.responsehandler  192.168.50.54: Registering handler Activity_Changed with UUID 8236c15d-acf9-47f5-abec-5ca8a1297f64
2021-12-21 16:33:01,516:DEBUG:  aioharmony.responsehandler  192.168.50.54: Registering handler Activity_Starting with UUID 51decadc-4ffb-4d02-9df0-b99c218d245a
2021-12-21 16:33:01,516:DEBUG:  aioharmony.responsehandler  192.168.50.54: Registering handler Activity_Stopping with UUID 8b444e97-d511-4978-b6ba-19492db7d89a
2021-12-21 16:33:01,517:DEBUG:  aioharmony.responsehandler  192.168.50.54: Registering handler Notification_Received with UUID 944dde5c-34ea-4350-84d0-a68d9ac3f889
Trying to connect to HUB with IP 192.168.50.54.
2021-12-21 16:33:01,517:DEBUG:  aioharmony.responsehandler  192.168.50.54: Callback handler started
2021-12-21 16:33:01,537:DEBUG:  aioharmony.harmonyclient    192.168.50.54: XMPP is enabled
2021-12-21 16:33:01,537:DEBUG:  aioharmony.harmonyclient    192.168.50.54: Using XMPP
2021-12-21 16:33:01,550:WARNING:    slixmpp.stringprep  Using slower stringprep, consider compiling the faster cython/libidn one.
2021-12-21 16:33:01,793:DEBUG:  slixmpp.plugins.base    Loaded Plugin: RFC 6120: Stream Feature: STARTTLS
2021-12-21 16:33:01,795:DEBUG:  slixmpp.plugins.base    Loaded Plugin: RFC 6120: Stream Feature: Resource Binding
2021-12-21 16:33:01,796:DEBUG:  slixmpp.plugins.base    Loaded Plugin: RFC 3920: Stream Feature: Start Session
2021-12-21 16:33:01,797:DEBUG:  slixmpp.plugins.base    Loaded Plugin: RFC 6121: Stream Feature: Roster Versioning
2021-12-21 16:33:01,798:DEBUG:  slixmpp.plugins.base    Loaded Plugin: RFC 6121: Stream Feature: Subscription Pre-Approval
2021-12-21 16:33:01,802:DEBUG:  slixmpp.plugins.base    Loaded Plugin: RFC 6120: Stream Feature: SASL
2021-12-21 16:33:01,802:DEBUG:  aioharmony.hubconnector_xmpp    192.168.50.54: Registering internal handlers.
2021-12-21 16:33:01,803:DEBUG:  aioharmony.hubconnector_xmpp    192.168.50.54: Connecting to hub
2021-12-21 16:33:01,803:DEBUG:  slixmpp.xmlstream.xmlstream Event triggered: connecting
2021-12-21 16:33:01,803:DEBUG:  slixmpp.xmlstream.resolver  DNS: Querying  for AAAA records.
2021-12-21 16:33:01,806:DEBUG:  slixmpp.xmlstream.resolver  DNS: Querying  for A records.
2021-12-21 16:33:01,809:DEBUG:  slixmpp.xmlstream.xmlstream Connection failed: [Errno 99] Address not available
2021-12-21 16:33:01,809:DEBUG:  slixmpp.xmlstream.xmlstream Event triggered: connection_failed
2021-12-21 16:33:01,809:ERROR:  aioharmony.hubconnector_xmpp    192.168.50.54: Connecting to HUB failed with error: [Errno 99] Address not available
An issue occurred trying to connect
2021-12-21 16:33:01,810:DEBUG:  aioharmony.__main__ Cancelling any tasks still running.
2021-12-21 16:33:02,812:DEBUG:  aioharmony.responsehandler  192.168.50.54: Received STOP for callback handler
2021-12-21 16:33:02,812:DEBUG:  aioharmony.responsehandler  192.168.50.54: Callback handler stopped.

aioharmony --harmony_ip HarmonyHub.localdomain --loglevel DEBUG show_config

2021-12-21 16:37:53,480:DEBUG:  aioharmony.__main__ HarmonyHub.localdomain: Connecting to HUB
2021-12-21 16:37:53,480:DEBUG:  aioharmony.harmonyapi   HarmonyHub.localdomain: Initialize
2021-12-21 16:37:53,480:DEBUG:  aioharmony.harmonyclient    HarmonyHub.localdomain: Initialize HUB
2021-12-21 16:37:53,480:DEBUG:  aioharmony.responsehandler  HarmonyHub.localdomain: Registering handler Activity_Changed with UUID e78c3140-7796-4451-be6c-3092c2e2819e
2021-12-21 16:37:53,480:DEBUG:  aioharmony.responsehandler  HarmonyHub.localdomain: Registering handler Activity_Starting with UUID 8363519f-75a3-42e0-af61-c02934b8fd1d
2021-12-21 16:37:53,480:DEBUG:  aioharmony.responsehandler  HarmonyHub.localdomain: Registering handler Activity_Stopping with UUID b8a6a67e-e7ba-46cb-8d30-f4cd6f661358
2021-12-21 16:37:53,481:DEBUG:  aioharmony.responsehandler  HarmonyHub.localdomain: Registering handler Notification_Received with UUID e6811b99-07ca-4b4b-b96c-d66c84cc470e
Trying to connect to HUB with IP HarmonyHub.localdomain.
2021-12-21 16:37:53,482:DEBUG:  aioharmony.responsehandler  HarmonyHub.localdomain: Callback handler started
2021-12-21 16:37:53,518:DEBUG:  aioharmony.harmonyclient    HarmonyHub.localdomain: XMPP is enabled
2021-12-21 16:37:53,518:DEBUG:  aioharmony.harmonyclient    HarmonyHub.localdomain: Using XMPP
2021-12-21 16:37:53,527:WARNING:    slixmpp.stringprep  Using slower stringprep, consider compiling the faster cython/libidn one.
2021-12-21 16:37:53,772:DEBUG:  slixmpp.plugins.base    Loaded Plugin: RFC 6120: Stream Feature: STARTTLS
2021-12-21 16:37:53,774:DEBUG:  slixmpp.plugins.base    Loaded Plugin: RFC 6120: Stream Feature: Resource Binding
2021-12-21 16:37:53,775:DEBUG:  slixmpp.plugins.base    Loaded Plugin: RFC 3920: Stream Feature: Start Session
2021-12-21 16:37:53,776:DEBUG:  slixmpp.plugins.base    Loaded Plugin: RFC 6121: Stream Feature: Roster Versioning
2021-12-21 16:37:53,778:DEBUG:  slixmpp.plugins.base    Loaded Plugin: RFC 6121: Stream Feature: Subscription Pre-Approval
2021-12-21 16:37:53,782:DEBUG:  slixmpp.plugins.base    Loaded Plugin: RFC 6120: Stream Feature: SASL
2021-12-21 16:37:53,782:DEBUG:  aioharmony.hubconnector_xmpp    HarmonyHub.localdomain: Registering internal handlers.
2021-12-21 16:37:53,782:DEBUG:  aioharmony.hubconnector_xmpp    HarmonyHub.localdomain: Connecting to hub
2021-12-21 16:37:53,783:DEBUG:  slixmpp.xmlstream.xmlstream Event triggered: connecting
2021-12-21 16:37:53,783:DEBUG:  slixmpp.xmlstream.resolver  DNS: Querying HarmonyHub.localdomain for AAAA records.
2021-12-21 16:37:53,786:DEBUG:  slixmpp.xmlstream.resolver  DNS: Exception while querying for HarmonyHub.localdomain AAAA records: (1, 'DNS server returned answer with no data')
2021-12-21 16:37:53,786:DEBUG:  slixmpp.xmlstream.resolver  DNS: Querying HarmonyHub.localdomain for A records.
2021-12-21 16:37:53,822:DEBUG:  slixmpp.xmlstream.xmlstream Event triggered: connected
2021-12-21 16:37:53,822:DEBUG:  slixmpp.xmlstream.xmlstream SEND: <stream:stream to='connect.logitech.com' xmlns:stream='http://etherx.jabber.org/streams' xmlns='jabber:client' xml:lang='en' version='1.0'>
2021-12-21 16:37:53,823:DEBUG:  aioharmony.hubconnector_xmpp    HarmonyHub.localdomain: Connected to hub

Verify the DNS:

nslookup HarmonyHub.localdomain

Server:     127.0.0.11
Address:    127.0.0.11#53

Name:   HarmonyHub.localdomain
Address: 192.168.50.54
ehendrix23 commented 2 years ago

Can you do a nslookup using IP. Seems reverse lookup is not working

jasonyork commented 2 years ago

It seems to work using nslookup:

nslookup 192.168.50.54

54.50.168.192.in-addr.arpa  name = HarmonyHub.localdomain.

Also, if it's relevant, connecting via IP with WEBSOCKETS does work:

aioharmony --harmony_ip 192.168.50.54 --loglevel DEBUG --protocol WEBSOCKETS show_config

2021-12-22 08:14:02,347:DEBUG:  aioharmony.__main__ 192.168.50.54: Connecting to HUB
2021-12-22 08:14:02,348:DEBUG:  aioharmony.harmonyapi   192.168.50.54: Initialize
2021-12-22 08:14:02,348:DEBUG:  aioharmony.harmonyclient    192.168.50.54: Initialize HUB
2021-12-22 08:14:02,348:DEBUG:  aioharmony.responsehandler  192.168.50.54: Registering handler Activity_Changed with UUID 6262bbd2-f34f-4a23-abc6-600a3e296252
2021-12-22 08:14:02,348:DEBUG:  aioharmony.responsehandler  192.168.50.54: Registering handler Activity_Starting with UUID 76a32c89-9008-4493-9241-aaf7079894e2
2021-12-22 08:14:02,348:DEBUG:  aioharmony.responsehandler  192.168.50.54: Registering handler Activity_Stopping with UUID fad9c678-208d-43ea-85eb-ae22fcde6646
2021-12-22 08:14:02,348:DEBUG:  aioharmony.responsehandler  192.168.50.54: Registering handler Notification_Received with UUID 92e0a3ee-d2d1-441f-930d-6429cfe8817c
Trying to connect to HUB with IP 192.168.50.54.
2021-12-22 08:14:02,348:DEBUG:  aioharmony.harmonyclient    192.168.50.54: Using WEBSOCKETS
2021-12-22 08:14:02,491:DEBUG:  aioharmony.hubconnector_websocket   192.168.50.54: Connecting to hub
2021-12-22 08:14:02,491:DEBUG:  aioharmony.hubconnector_websocket   192.168.50.54: Retrieving Harmony Hub information.
2021-12-22 08:14:02,491:DEBUG:  aioharmony.hubconnector_websocket   192.168.50.54: Sending post request: {'id ': 1, 'cmd': 'setup.account?getProvisionInfo', 'params': {}}
2021-12-22 08:14:02,492:DEBUG:  aioharmony.responsehandler  192.168.50.54: Callback handler started
2021-12-22 08:14:02,550:DEBUG:  aioharmony.hubconnector_websocket   192.168.50.54: Post response: REDACTED, 'code': '200'}
2021-12-22 08:14:02,551:DEBUG:  aioharmony.hubconnector_websocket   192.168.50.54: Connecting for hub REDACTED
2021-12-22 08:14:02,611:DEBUG:  aioharmony.hubconnector_websocket   192.168.50.54: Connected to hub REDACTED
2021-12-22 08:14:02,612:DEBUG:  aioharmony.hubconnector_websocket   192.168.50.54: Listener started