Use properties of wemo Insight device (#72316)

This commit is contained in:
Eric Severance 2022-05-22 23:43:42 -07:00 committed by GitHub
parent c4893f96f6
commit cf5e21a996
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 103 additions and 71 deletions

View file

@ -2,7 +2,7 @@
import asyncio
from typing import cast
from pywemo import Insight, Maker
from pywemo import Insight, Maker, StandbyState
from homeassistant.components.binary_sensor import BinarySensorEntity
from homeassistant.config_entries import ConfigEntry
@ -64,4 +64,5 @@ class InsightBinarySensor(WemoBinarySensor):
@property
def is_on(self) -> bool:
"""Return true device connected to the Insight Switch is on."""
return super().is_on and self.wemo.insight_params["state"] == "1"
# Note: wemo.get_standby_state is a @property.
return super().is_on and self.wemo.get_standby_state == StandbyState.ON