Speed up OZW availability check (#38758)
* Speed up OZW availability check * Apply suggestions from code review Co-authored-by: Martin Hjelmare <marhje52@gmail.com> Co-authored-by: Martin Hjelmare <marhje52@gmail.com>pull/38768/head
parent
016cd8f8ef
commit
f31a580caf
|
@ -25,6 +25,7 @@ from .const import DOMAIN, PLATFORMS
|
|||
from .discovery import check_node_schema, check_value_schema
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
OZW_READY_STATES_VALUES = {st.value for st in OZW_READY_STATES}
|
||||
|
||||
|
||||
class ZWaveDeviceEntityValues:
|
||||
|
@ -224,9 +225,7 @@ class ZWaveDeviceEntity(Entity):
|
|||
"""Return entity availability."""
|
||||
# Use OZW Daemon status for availability.
|
||||
instance_status = self.values.primary.ozw_instance.get_status()
|
||||
return instance_status and instance_status.status in (
|
||||
state.value for state in OZW_READY_STATES
|
||||
)
|
||||
return instance_status and instance_status.status in OZW_READY_STATES_VALUES
|
||||
|
||||
@callback
|
||||
def _value_changed(self, value):
|
||||
|
|
Loading…
Reference in New Issue