Skip to content

Commit

Permalink
Merge pull request #101 from quarcko/master
Browse files Browse the repository at this point in the history
Fix for Xiaomi Aqara gateway
  • Loading branch information
jlusiardi authored Jan 31, 2019
2 parents 54c99e3 + 61e792e commit 9604d76
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions homekit/model/characteristics/characteristic_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ def get_short(self, uuid: str):
:param uuid: the UUID in long form or the shortened version as defined in chapter 5.6.1 page 72.
:return: the textual representation
"""
uuid = uuid.upper()
orig_item = uuid
if uuid.endswith(self.baseUUID):
uuid = uuid.split('-', 1)[0]
Expand Down
1 change: 1 addition & 0 deletions homekit/model/services/service_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ def __getitem__(self, item):
return 'Unknown Service: {i}'.format(i=item)

def get_short(self, item):
item = item.upper()
orig_item = item
if item.endswith(self.baseUUID):
item = item.split('-', 1)[0]
Expand Down
3 changes: 2 additions & 1 deletion tests/characteristicsTypes_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,5 @@ def test_get_short(self):
self.assertEqual(CharacteristicsTypes.get_short(CharacteristicsTypes.DOOR_STATE_TARGET), 'door-state.target')
self.assertEqual(CharacteristicsTypes.get_short(CharacteristicsTypes.AIR_PURIFIER_STATE_CURRENT),
'air-purifier.state.current')
self.assertEqual(CharacteristicsTypes.get_short('1a'), 'Unknown Characteristic 1a')
#self.assertEqual(CharacteristicsTypes.get_short('1a'), 'Unknown Characteristic 1a')
self.assertEqual(CharacteristicsTypes.get_short('1a'), 'lock-management.auto-secure-timeout')

0 comments on commit 9604d76

Please sign in to comment.