Fix xiaomi aqara cube with lumi.acpartner.v3 gateway (#22130)

pull/22360/head
Yu 2019-03-25 01:56:17 +08:00 committed by Sebastian Muszynski
parent ed93c3b2c1
commit 89f8203163
1 changed files with 8 additions and 2 deletions

View File

@ -476,18 +476,24 @@ class XiaomiCube(XiaomiBinarySensor):
self._last_action = data[self._data_key]
if 'rotate' in data:
action_value = float(data['rotate']
if isinstance(data['rotate'], int)
else data['rotate'].replace(",", "."))
self._hass.bus.fire('xiaomi_aqara.cube_action', {
'entity_id': self.entity_id,
'action_type': 'rotate',
'action_value': float(data['rotate'].replace(",", "."))
'action_value': action_value
})
self._last_action = 'rotate'
if 'rotate_degree' in data:
action_value = float(data['rotate_degree']
if isinstance(data['rotate_degree'], int)
else data['rotate_degree'].replace(",", "."))
self._hass.bus.fire('xiaomi_aqara.cube_action', {
'entity_id': self.entity_id,
'action_type': 'rotate',
'action_value': float(data['rotate_degree'].replace(",", "."))
'action_value': action_value
})
self._last_action = 'rotate'