Skip to content
This repository has been archived by the owner on Oct 5, 2024. It is now read-only.

Commit

Permalink
Merge pull request #118 from doudz/v0.28
Browse files Browse the repository at this point in the history
Fix power for lumi.plug and OTA update
  • Loading branch information
doudz authored Mar 1, 2019
2 parents 830cf56 + f29bccb commit e447c1d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
17 changes: 12 additions & 5 deletions zigate/clusters.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,13 +244,20 @@ class C0008(Cluster):
@register_cluster
class C000c(Cluster):
cluster_id = 0x000c
type = 'Analog input (Xiaomi cube: Rotation)'
attributes_def = {0x0055: {'name': 'rotation', 'value': 'round(value, 2)',
'unit': '°', 'expire': 2, 'type': float},
0xff05: {'name': 'rotation_time', 'value': 'value',
'unit': 'ms', 'expire': 2, 'type': int},
type = 'Analog input'
attributes_def = {0x0055: {'name': 'power', 'value': 'round(value, 2)',
'unit': 'W', 'type': float},
}

def __init__(self, endpoint=None, device=None):
Cluster.__init__(self, endpoint=endpoint, device=device)
if self._device and 'cube' in self._device.get_value('type', ''):
self.attributes_def = {0x0055: {'name': 'rotation', 'value': 'round(value, 2)',
'unit': '°', 'expire': 2, 'type': float},
0xff05: {'name': 'rotation_time', 'value': 'value',
'unit': 'ms', 'expire': 2, 'type': int},
}


# +---+
# | 2 |
Expand Down
1 change: 1 addition & 0 deletions zigate/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
0x28: 'b', # int8
0x29: 'h', # int16
0x2a: 'i', # int24
0x2b: 'I', #
0x30: 'b', # enum8
0x38: 'f', # float semi
0x39: 'f', # float simple
Expand Down
2 changes: 1 addition & 1 deletion zigate/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1611,7 +1611,7 @@ def ota_load_image(self, path_to_file):
response = self.send_data(0x0500, data)

# If response is success place header and file content to variable
if response == 0:
if response.status == 0:
LOGGER.info('OTA header loaded to server successfully.')
self._ota_reset_local_variables()
self._ota['image']['header'] = header
Expand Down
2 changes: 1 addition & 1 deletion zigate/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
# file that was distributed with this source code.
#

__version__ = '0.28.3'
__version__ = '0.28.4'

0 comments on commit e447c1d

Please sign in to comment.