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

Commit

Permalink
Fix xiaomi vibration sensor
Browse files Browse the repository at this point in the history
  • Loading branch information
doudz committed Jul 18, 2020
1 parent d1a6001 commit 6fab776
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions tests/test_devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,11 @@ def test_quirks(self):
102: 99041,
10: 0})
self.assertEqual(device.get_property_value('battery_voltage'), 2.835)

def test_available_actions(self):
device = core.Device({'addr': '1234', 'ieee': '0123456789abcdef'}, self.zigate)
device.set_attribute(1, 0, {'attribute': 5, 'lqi': 255, 'data': 'lumi.vibration.aq1'})
self.assertEqual(device.available_actions(), {1: []})


if __name__ == '__main__':
Expand Down
3 changes: 2 additions & 1 deletion zigate/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2512,7 +2512,8 @@ def available_actions(self, endpoint_id=None):
# except device 0x010a because Tradfri Outlet don't have level control
# but still have endpoint 8...
actions[ep_id].append(ACTIONS_LEVEL)
if 0x0101 in endpoint['in_clusters']:
if 0x0101 in endpoint['in_clusters'] and self.receiver_on_when_idle():
# because of xiaomi vibration sensor
actions[ep_id].append(ACTIONS_LOCK)
if 0x0102 in endpoint['in_clusters']:
actions[ep_id].append(ACTIONS_COVER)
Expand Down

0 comments on commit 6fab776

Please sign in to comment.