Skip to content

Commit

Permalink
v0.2.0 (#12)
Browse files Browse the repository at this point in the history
* Fix connection for HUB version 4.15.250

Fix for HUB version 4.15.250; aioharmony will not work with lower versions.

* Use XMPP instead of web sockets

Use XMPP instead of web sockets

* Workaround for xmpp issue in Home Assistant

* Removed wait, does not work

* Add identifier to logger entries in responsehandler

Added identifier for which HUB any log messages are produced from responsehandler, making it easier to determine the HUB it is for.

* Add slixmpp in setup.py required list

Added slixmpp in setup.py for required package.

* Update version as beta right now

* Added release notes

Added release notes

* Potential fix for Host unreachable issues

* Update __version__.py

* Update to wait times on reconnect

* Merge for web socket reconnect fix

Merge for potential web socket reconnect fix

* Flake8

* Beta version update

* Further websocket fixes

* Changed timeout

Changed timeout from 30 seconds to 5 seconds
Sleep for 1 second before trying reconnects.

* Fixed debug logging issue on reconnects

* Update to beta version 8 after merge

* Fixes after merge

* Enable cleanup after closing websocket

* Set version to 0.2.0

* Add instructions for enabling XMPP
  • Loading branch information
ehendrix23 authored Jul 30, 2019
1 parent 0961024 commit 13c2b07
Show file tree
Hide file tree
Showing 12 changed files with 571 additions and 126 deletions.
16 changes: 11 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ of `bkanuka/pyharmony <https://github.com/bkanuka/pyharmony>`__ with the intent
Protocol
--------

As the harmony protocol is being worked out, notes will be in PROTOCOL.md. Currently it is using web sockets
due to a change by Logitech. Logitech has informed they will re-open XMPP sometime in January/2019. Once re-opened
this library will be moved to use XMPP.
As the harmony protocol is being worked out, notes will be in PROTOCOL.md.

Status
------
Expand Down Expand Up @@ -108,10 +106,10 @@ Release Notes
- Fix traceback if no configuration retrieved or items missing from configuration (i.e. no activities)
- Retrieve current activity only after retrieving configuration
0.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 to `reneboer <https://github.com/reneboer>`__ for providing the quick fix).

NOTE: This version will ONLY work with 4.15.250 or potentially higher. It will not work with lower versions!
0.1.9. Fixed:
- Fixed "Network unreachable" or "Host unreachable" on certain installations (i.e. in Docker, HassIO)
0.1.10. Changed:
Expand All @@ -123,6 +121,14 @@ Release Notes
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.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 identification



TODO
----
Expand Down
6 changes: 3 additions & 3 deletions aioharmony/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,15 @@ async def start_activity(client, args):
if activity_id:
print('Found activity named %s (id %s)' % (args.activity,
activity_id))

if activity_id:
status = await client.start_activity(activity_id)

if status[0]:
print('Started Actvivity, message: ', status[1])
print('Started Activity, message: ', status[1])
else:
print('Activity start failed: ', status[1])

else:
print('Invalid activity: ', args.activity)

async def power_off(client, _):
"""Power off Harmony Hub.
Expand Down
2 changes: 1 addition & 1 deletion aioharmony/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.1.12'
__version__ = '0.2.0'
32 changes: 19 additions & 13 deletions aioharmony/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,39 +12,40 @@
#
DEFAULT_CMD = 'vnd.logitech.connect'
DEFAULT_DISCOVER_STRING = '_logitech-reverse-bonjour._tcp.local.'
DEFAULT_HUB_PORT = '8088'
DEFAULT_XMPP_HUB_PORT = '5222'
DEFAULT_WS_HUB_PORT = '8088'
DEFAULT_HARMONY_MIME = 'vnd.logitech.harmony/vnd.logitech.harmony.engine'

#
# The HUB commands that can be send
#
HUB_COMMANDS = {
'change_channel': {
'mime': 'harmony.engine',
'change_channel': {
'mime': 'harmony.engine',
'command': 'changeChannel'
},
'get_current_state': {
'get_current_state': {
'mime': 'vnd.logitech.connect/vnd.logitech.statedigest',
'command': 'get'
},
'get_config': {
'mime': DEFAULT_HARMONY_MIME,
'get_config': {
'mime': DEFAULT_HARMONY_MIME,
'command': 'config'
},
'get_current_activity': {
'mime': DEFAULT_HARMONY_MIME,
'mime': DEFAULT_HARMONY_MIME,
'command': 'getCurrentActivity'
},
'send_command': {
'mime': DEFAULT_HARMONY_MIME,
'send_command': {
'mime': DEFAULT_HARMONY_MIME,
'command': 'holdAction'
},
'start_activity': {
'mime': 'harmony.activityengine',
'start_activity': {
'mime': 'harmony.activityengine',
'command': 'runactivity'
},
'sync': {
'mime': 'setup.sync',
'sync': {
'mime': 'setup.sync',
'command': None
}
}
Expand All @@ -60,6 +61,11 @@
Callable[[object, Optional[Any]], Any]
]

ConnectorCallbackType = NamedTuple('ConnectorCallbackType',
[('connect', Optional[CallbackType]),
('disconnect', Optional[CallbackType])
])

ClientConfigType = NamedTuple('ClientConfigType',
[('config', dict),
('info', dict),
Expand Down
2 changes: 1 addition & 1 deletion aioharmony/harmonyapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def account_id(self) -> Optional[str]:

@property
def fw_version(self) -> Optional[str]:
return self.hub_config.info.get('current_fw_version')
return self.hub_config.info.get('hubSwVersion')

@property
def current_activity(self) -> tuple:
Expand Down
Loading

0 comments on commit 13c2b07

Please sign in to comment.