From b03c97cdd09f329c6860f295d0f110f19d52a37a Mon Sep 17 00:00:00 2001 From: Greg Dowling Date: Fri, 19 Mar 2021 19:27:56 +0000 Subject: [PATCH] Make Vera should_poll static rather than dynamic (#47854) * Make should_poll static. * Address review comments. * Fix black error. --- CODEOWNERS | 2 +- homeassistant/components/vera/__init__.py | 4 +++- homeassistant/components/vera/manifest.json | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CODEOWNERS b/CODEOWNERS index 1b0f2747dee..2afbc288b0f 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -510,7 +510,7 @@ homeassistant/components/usgs_earthquakes_feed/* @exxamalte homeassistant/components/utility_meter/* @dgomes homeassistant/components/velbus/* @Cereal2nd @brefra homeassistant/components/velux/* @Julius2342 -homeassistant/components/vera/* @vangorra +homeassistant/components/vera/* @pavoni homeassistant/components/verisure/* @frenck homeassistant/components/versasense/* @flamm3blemuff1n homeassistant/components/version/* @fabaff @ludeeus diff --git a/homeassistant/components/vera/__init__.py b/homeassistant/components/vera/__init__.py index 929e4424d80..e544ddb925f 100644 --- a/homeassistant/components/vera/__init__.py +++ b/homeassistant/components/vera/__init__.py @@ -236,7 +236,9 @@ class VeraDevice(Generic[DeviceType], Entity): def update(self): """Force a refresh from the device if the device is unavailable.""" - if not self.available: + refresh_needed = self.vera_device.should_poll or not self.available + _LOGGER.debug("%s: update called (refresh=%s)", self._name, refresh_needed) + if refresh_needed: self.vera_device.refresh() @property diff --git a/homeassistant/components/vera/manifest.json b/homeassistant/components/vera/manifest.json index 1f180b39750..76d6bda5c7b 100644 --- a/homeassistant/components/vera/manifest.json +++ b/homeassistant/components/vera/manifest.json @@ -4,5 +4,5 @@ "config_flow": true, "documentation": "https://www.home-assistant.io/integrations/vera", "requirements": ["pyvera==0.3.13"], - "codeowners": ["@vangorra"] + "codeowners": ["@pavoni"] }