Fix bug in ZHA and tweak non sensor channel logic (#21234)
* fix race condition and prevent profiles from stealing channels * fix battery voltage
This commit is contained in:
parent
5b24b271cc
commit
cece6454e4
3 changed files with 23 additions and 10 deletions
|
@ -5,6 +5,7 @@ For more details about this component, please refer to the documentation at
|
|||
https://home-assistant.io/components/zha/
|
||||
"""
|
||||
import asyncio
|
||||
from enum import Enum
|
||||
import logging
|
||||
|
||||
from homeassistant.helpers.dispatcher import (
|
||||
|
@ -23,6 +24,13 @@ from .channels.general import BasicChannel
|
|||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class DeviceStatus(Enum):
|
||||
"""Status of a device."""
|
||||
|
||||
CREATED = 1
|
||||
INITIALIZED = 2
|
||||
|
||||
|
||||
class ZHADevice:
|
||||
"""ZHA Zigbee device object."""
|
||||
|
||||
|
@ -61,6 +69,7 @@ class ZHADevice:
|
|||
self._zigpy_device.__class__.__name__
|
||||
)
|
||||
self.power_source = None
|
||||
self.status = DeviceStatus.CREATED
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
|
@ -186,6 +195,7 @@ class ZHADevice:
|
|||
self.name,
|
||||
BasicChannel.POWER_SOURCES.get(self.power_source)
|
||||
)
|
||||
self.status = DeviceStatus.INITIALIZED
|
||||
_LOGGER.debug('%s: completed initialization', self.name)
|
||||
|
||||
async def _execute_channel_tasks(self, task_name, *args):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue