From f31a580caff1fa75d8ce121c28539b9d6931c79d Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen <balloob@gmail.com> Date: Tue, 11 Aug 2020 18:23:10 +0200 Subject: [PATCH] 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> --- homeassistant/components/ozw/entity.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/ozw/entity.py b/homeassistant/components/ozw/entity.py index ffec0feff07..39971d0c976 100644 --- a/homeassistant/components/ozw/entity.py +++ b/homeassistant/components/ozw/entity.py @@ -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):