ehendrix23 / aioharmony Goto Github PK
View Code? Open in Web Editor NEWAsyncio Python library for connecting to and controlling the Logitech Harmony
License: Apache License 2.0
Asyncio Python library for connecting to and controlling the Logitech Harmony
License: Apache License 2.0
I successfully connect and initilize a HarmonyAPI object.
Only the first command is accepted, after that it receive (False, 'Unauthorized policy write haDevice denied').
it is only fixed after I restart the Harmony Hub, but again, only one command goes through before receiving an Unauthorized policy error.
Hi,
i would like to ask if its possible to also see the configured home automation devices in the show_config output?
I've configured a hue hub but it looks like home automation is not included in the show_config command.
Is it maybe possible to add this devices also?
Thanks
My end goal here is to find a smooth way of integrating Harmony into the larger Home Assistant ecosystem. I know some people have done it with dummy Hue bridges but that's a brittle setup and very clunky.
This may have been already asked and answered so forgive me if it has been, but is it possible to use this API rather then sending commands, to be able to listen for commands? So that if I say press a button on the remote this could see that I did so?
Now that the release is on Pypi it would be good to merge the code to master as well. I was wondering where the code was until I found the dev branch :P
I just finished migrating my home automation over to "Home Assistant" which I believe uses this library and I noticed the sleep functionality is missing.
I coded a application in c# years ago to control my harmony hub, which included the sleep functionality.. the sleep interval is to be parsed using seconds here is an example:
xml += "<iq type=\"get\" id=\"0\">";
xml += "<oa xmlns=\"connect.logitech.com\" mime=\"vnd.logitech.harmony/vnd.logitech.harmony.engine?setsleeptimer\">interval=" + sleepInterval + "</oa>";
xml += "</iq>";
I'm not familiar with python otherwise I would create a push request, however I do hope you consider adding this functionality in the future.. in turn hopefully it eventually will trickle its way into the home assistant API.
Cheers
Not sure if this has been fully merger now in to HA, an no longer tracked here, but i updated to 0.85 my elite hub and remote are on 206 . Different subnet to my Hass.io . The follwing appears in the logs during set up ..
2019-01-10 17:59:25 ERROR (MainThread) [aioharmony.hubconnector] 10.12.1.49: Exception on post: Connection timeout to host http://10.12.1.49:8088/
2019-01-10 17:59:25 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 350, in _async_add_entity
await entity.async_added_to_hass()
File "/usr/local/lib/python3.6/site-packages/homeassistant/components/remote/harmony.py", line 180, in async_added_to_hass
await self._client.connect()
File "/usr/local/lib/python3.6/site-packages/aioharmony/harmonyapi.py", line 139, in connect
return await self._harmony_client.connect()
File "/usr/local/lib/python3.6/site-packages/aioharmony/harmonyclient.py", line 131, in connect
if not await self._hub_connection.connect():
File "/usr/local/lib/python3.6/site-packages/aioharmony/hubconnector.py", line 106, in connect
response = await self.retrieve_hub_info()
File "/usr/local/lib/python3.6/site-packages/aioharmony/hubconnector.py", line 341, in retrieve_hub_info
return response.get('data')
AttributeError: 'NoneType' object has no attribute 'get'
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
The documentation shows how to call this from the command line, as in:
python3 aioharmony --harmony_ip 192.168.1.203 show_current_activity
but how would I do this from within Python? Is it possible to get an example working .py file to do stuff like showing activities, starting activities, powering off a hub, etc? What do I import and how do I call the functions, etc
Please see here for details: home-assistant/core#21191
From the error message, I wonder if adding a Content-type is enough to fix it (but am not able to test at this time).
It would obviously be good if this could be resolved for the Home Assistant release that ships tomorrow since Harmony updates are rolling out right now.
Hello there. I am new to github so I hope this is the right place to do this :)
I was wondering if you guys could add a sample.py page.
I looked at the documentation, but still do not know how to use it. :(
Thanks in Advance.
Ran into home-assistant/core#62510 and while trying to figure out what was going on I noticed that
has a fix for this already. I've encouraged them to submit a PR, but wanted to add a tracking bug for this in case someone stumbles over this and to make the issue more known
in harmonyclient.py, line: 745 and 752, it should be
self._hub_config.devices
instead of
self._hub_config.activities
I am trying to start an activity with a command like:
python3 /home/wayne/.local/bin/aioharmony --harmony_ip 192.168.1.203 start_activity "Watch TV"
But I get an error stating unrecognized arguments Watch TV. I have also tried passing the number for the activity but that gives the same error.
How do I start an activity?
I execute the following command, but without success... It says sent, but the command is not executed on the device.
aioharmony --harmony_ip <ip> send_command --device_id <id> --command=<command>
2019-08-18 00:25:49,163:WARNING: slixmpp.stringprep Using slower stringprep, consider compiling the faster cython/libidn one.
2019-08-18 00:25:50,326:INFO: slixmpp.features.feature_bind.bind JID set to: 1111/gatorade.
Connected to HUB 192.168.10.113 with firmware version 4.15.250
Command Sent
2019-08-18 00:25:51,842:INFO: slixmpp.xmlstream.xmlstream connection_lost: (None,)
However, https://github.com/misku/pyharmony works well - the command is actually executed:
harmony --harmony_ip <ip> send_command --device_id <id> --command=<command>
Command Sent
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.