* Add support for DoorLock cluster * Add test for zha lock * Change lock_state report to REPORT_CONFIG_IMMEDIATE * Update channel command wrapper to return the entire result This allows for return values other than result[1] * Fix tests * Fix lint * Update DoorLock test to work with updated zigpy schema * Fix lint * Fix unlock test
This commit is contained in:
1 parent
592d30d495
commit
cb460a85ba
11 files changed
+305
-34
No files matched your search
@@ -1,6 +1,7 @@
|
||||
"""Switches on Zigbee Home Automation networks."""
|
||||
import logging
|
||||
|
||||
from zigpy.zcl.foundation import Status
|
||||
from homeassistant.components.switch import DOMAIN, SwitchDevice
|
||||
from homeassistant.const import STATE_ON
|
||||
from homeassistant.core import callback
|
||||
@@ -66,16 +67,16 @@ class Switch(ZhaEntity, SwitchDevice):
|
||||
|
||||
async def async_turn_on(self, **kwargs):
|
||||
"""Turn the entity on."""
|
||||
success = await self._on_off_channel.on()
|
||||
if not success:
|
||||
result = await self._on_off_channel.on()
|
||||
if not isinstance(result, list) or result[1] is not Status.SUCCESS:
|
||||
return
|
||||
self._state = True
|
||||
self.async_schedule_update_ha_state()
|
||||
|
||||
async def async_turn_off(self, **kwargs):
|
||||
"""Turn the entity off."""
|
||||
success = await self._on_off_channel.off()
|
||||
if not success:
|
||||
result = await self._on_off_channel.off()
|
||||
if not isinstance(result, list) or result[1] is not Status.SUCCESS:
|
||||
return
|
||||
self._state = False
|
||||
self.async_schedule_update_ha_state()
|
||||
|
||||
Reference in new issue
Block a user