Use a single source of data for switchbot (#84215)
This commit is contained in:
parent
6e612a45ff
commit
7c13e7cdfd
6 changed files with 39 additions and 55 deletions
|
@ -54,7 +54,7 @@ async def async_setup_entry(
|
|||
coordinator: SwitchbotDataUpdateCoordinator = hass.data[DOMAIN][entry.entry_id]
|
||||
async_add_entities(
|
||||
SwitchBotBinarySensor(coordinator, binary_sensor)
|
||||
for binary_sensor in coordinator.data["data"]
|
||||
for binary_sensor in coordinator.device.parsed_data
|
||||
if binary_sensor in BINARY_SENSOR_TYPES
|
||||
)
|
||||
|
||||
|
@ -77,4 +77,4 @@ class SwitchBotBinarySensor(SwitchbotEntity, BinarySensorEntity):
|
|||
@property
|
||||
def is_on(self) -> bool:
|
||||
"""Return the state of the sensor."""
|
||||
return self.data["data"][self._sensor]
|
||||
return self.parsed_data[self._sensor]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue