Package: aioharmony
Python library for programmatically using a Logitech Harmony Link or Ultimate Hub.This library originated fromiandday/pyharmonywhich was a fork
ofbkanuka/pyharmonywith the intent to:Make the harmony library asyncioAbility to provide one’s own custom callbacks to be calledAutomatic reconnect, even if re-connection cannot be established for a timeMore easily get the HUB configuration through API callAdditional callbacks: connect, disconnect, HUB configuration updatedUsing unique msgid’s ensuring that responses from the HUB are correctly managed.ProtocolAs the harmony protocol is being worked out, notes will be in PROTOCOL.md.StatusRetrieving current activityQuerying for entire device informationQuerying for activity information onlyQuerying for current activityStarting ActivitySending CommandChanging channelsCustom callbacks.Usageusage:__main__.py[-h](--harmony_ipHARMONY_IP|--discover)[--protocol{WEBSOCKETS,XMPP}][--loglevel{DEBUG,INFO,WARNING,ERROR,CRITICAL}][--logmodulesLOGMODULES][--show_responses|--no-show_responses][--waitWAIT]{show_config,show_detailed_config,show_current_activity,start_activity,power_off,sync,listen,activity_monitor,send_command,change_channel}...aioharmony-Harmonydevicecontrolpositionalarguments:{show_config,show_detailed_config,show_current_activity,start_activity,power_off,sync,listen,activity_monitor,send_command,change_channel}show_configPrinttheHarmonydeviceconfiguration.show_detailed_configPrintthedetailedHarmonydeviceconfiguration.show_current_activityPrintthecurrentactivityconfig.start_activitySwitchtoadifferentactivity.power_offStoptheactivity.syncSynctheharmony.listenOutputeverythingHUBsendsout.Useincombinationwith--wait.activity_monitorMonitorandshowwhenanactivityischanging.Useincombinationwith--waittokeepmonitoringforactivitiesotherwiseonlycurrentactivitywillbeshown.send_commandSendasimplecommand.send_commandsSendaseriesofsimplecommandsseparatedbyspaces.change_channelChangethechanneloptionalarguments:-h,--helpshowthishelpmessageandexit--harmony_ipHARMONY_IPIPAddressoftheHarmonydevice,multipleIPscanbespecifiedasacommaseparatedlistwithoutspaces.(default:None)--discoverScanforHarmonydevices.(default:False)--protocol{WEBSOCKETS,XMPP}ProtocoltousetoconnecttoHUB.NoteforXMPPonehastoensurethatXMPPisenabledonthehub.(default:None)--loglevel{DEBUG,INFO,WARNING,ERROR,CRITICAL}Logginglevelforallcomponentstoprinttotheconsole.(default:ERROR)--logmodulesLOGMODULESRestrictloggingtomodulesspecified.Multiplecanbeprovidedasacommaseparatedlistwithoutanyspaces.Use*toincludeanyfurthersubmodules.(default:None)--show_responsesPrintoutresponsescomingfromHUB.(default:False)--no-show_responsesDonotprintresponsescomingfromHUB.(default:False)--waitWAITHowlongtowaitinsecondsaftercompletion,usefulincombinationwith--show-responses.Use-1towaitinfinite,otherwisehastobeapositivenumber.(default:0)Release Notes0.1.0. Initial Release0.1.2. Fixed:Enable callback connect only once initial connect and initialization is completed.Fix exception when activity/device name/id is None when trying to retrieve name/id.Fixed content type and name of README in setup.py0.1.3. Fixed:Retry connect on reconnect0.1.4. Fixed:Exception when retrieve_hub_info failed to retrieve informationcall_callback helper would never return True on success.Retry connect on reconnect (was not awaited upon)0.1.5. Fixed:Exception when an invalid command was sent to HUB (or sending command failed on HUB).Messages for failed commands were not printed in main.0.1.6. Fixed:Ignore response code 200 when for sending commandsUpon reconnect, errors will be logged on 1st try only, any subsequent retry until connection is successful will
only provide DEBUG log entries.0.1.7. Fixed:Fix traceback if no configuration retrieved or items missing from configuration (i.e. no activities)Retrieve current activity only after retrieving configuration0.1.8. Fixed:NOTE: This version will ONLY work with 4.15.250 or potentially higher. It will not work with lower versions!Fix traceback if HUB info is not received.Fix for new HUB version 4.15.250. (Thanks toreneboerfor providing the quick fix).0.1.9. Fixed:Fixed “Network unreachable” or “Host unreachable” on certain installations (i.e. in Docker, HassIO)0.1.10. Changed:On reconnect the wait time will now start at 1 seconds and double every time with a maximum of 30 seconds.Reconnect sometimes might not work if request to close was received over web socket but it never was closed.0.1.11. Changed:Timeout changed from 30 seconds to 5 seconds for network activity.For reconnect, first wait for 1 second before starting reconnects.0.1.12. Fixed/Changed:Fixed issue where connection debug messages would not be shown on failed reconnects.Added debug log entry when connected to HUB.0.1.13.Fixed further potential issue where on some OS’s sockets would not be closed by now force closing them.0.2.0. New:Support for XMPP. If XMPP is enabled on Hub then that will be used, otherwise fallback to web sockets.
There are no changes to the API for this. XMPP has to be explicitly enabled on the Harmony HUB.
To do so open the Harmony app and go to: Menu > Harmony Setup > Add/Edit Devices & Activities > Remote & Hub > Enable XMPP
Same steps can be followed to disable XMPP again.Log entries from responsehandler class will now include ip address of HUB for easier identification0.2.1 Fixed:Fixed issue in sending commands to HUB wbe using XMPP protocol.0.2.2 Fixed:Added closing code from aiohttp for web sockets in debug logging if closing code provided.Fixed further potential issue where on some OS’s sockets would not be closed by now force closing them (merge from 0.1.13)Fixed listen parameter as it would just exit instead of continuously wait.0.2.3 Changed:Updated requirement for slixmpp to 1.5.2 as that version works with Home Assistant0.2.4 Fixed:Friendly Name of Harmony HUB was not retrieved anymore, this is now available againRemote ID was not retrieved anymore, this is now available againIf HUB disconnects when retrieving information then retrieval will be retried.Executing aioharmony with option show_detailed_config will now show all config retrieved from HUB0.2.5Fixed: When using XMPP protocol the switching of an activity was not always discovered.Fixed: Call to stop handlers will now be called when timeout occurs on disconnectChanged: ClientCallbackType is now in aioharmony.const instead of aioharmony.harmonyclient.Changed: default log level for aioharmony main is now ERRORNew: callback option new_activity_starting to allow a callback when a new activity is being started (new_activity is called when switching activity is completed)New: 3 new HANDLER types have been added:HANDLER_START_ACTIVITY_NOTIFY_STARTED: activity is being startedHANDLER_STOP_ACTIVITY_NOTIFY_STARTED: power off is startedHANDLER_START_ACTIVITY_NOTIRY_INPROGRESS: activity switch is in progressNew: Protocol to use can be specified (WEBSOCKETS or XMPP) to force specific protocol to be used. If not provided XMPP will be used unless not available then WEBSOCKETS will be used.New: protocol used to connect can now be retrieved. It will return WEBSOCKETS when connected over web sockets or XMPP.New: One can now supply multiple IP addresses for Harmony HUBs when using aioharmony main.New: option activity_monitor for aioharmony main to allow just monitoring of activity changesNew: option logmodules for aioharmony main to specify the modules to put logging information for0.2.6Changed: If XMPP not enabled and no protocol provided then message will be DEBUG instead of Warning to enable XMPP.Fixed: If connect using XMPP fails with for example Connection Refused then it will be logged now and connection marked as failed for reconnection.0.2.7Fixed: Registered handlers would not be unregistered after a timeout when sending commands to HUB.Updated slixmpp from >= 1.5.2 to >= 1.7.0Updated aiohttp from >= 3.4  to 3.7.30.2.8Changed: Get remote_id from Hub without creating websocket connection0.2.9Fixed: Fixed exception in Python 3.10 by removing loop parameter (swolix)0.2.10Fixed: Fixed “module asyncio has no attribute coroutine” exception in call_raw_callback function on Python 3.11Changed: Bumped minimum required Python version to 3.9TODORedo discovery for asyncio. This will be done once XMPP is re-implemented by LogitechMore items can be done from the Harmony iOS app; determining what could be done within the library as wellIs it possible to update device configuration?