mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 09:47:13 +00:00
Bump switchbot-api to 1.2.1 (#101664)
SwitchBot Cloud: Dependency version up
This commit is contained in:
parent
1f122eb688
commit
7b78cfc090
@ -32,6 +32,18 @@ class SwitchbotCloudData:
|
|||||||
devices: SwitchbotDevices
|
devices: SwitchbotDevices
|
||||||
|
|
||||||
|
|
||||||
|
def prepare_device(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
api: SwitchBotAPI,
|
||||||
|
device: Device | Remote,
|
||||||
|
coordinators: list[SwitchBotCoordinator],
|
||||||
|
) -> tuple[Device | Remote, SwitchBotCoordinator]:
|
||||||
|
"""Instantiate coordinator and adds to list for gathering."""
|
||||||
|
coordinator = SwitchBotCoordinator(hass, api, device)
|
||||||
|
coordinators.append(coordinator)
|
||||||
|
return (device, coordinator)
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass: HomeAssistant, config: ConfigEntry) -> bool:
|
async def async_setup_entry(hass: HomeAssistant, config: ConfigEntry) -> bool:
|
||||||
"""Set up SwitchBot via API from a config entry."""
|
"""Set up SwitchBot via API from a config entry."""
|
||||||
token = config.data[CONF_API_TOKEN]
|
token = config.data[CONF_API_TOKEN]
|
||||||
@ -48,16 +60,14 @@ async def async_setup_entry(hass: HomeAssistant, config: ConfigEntry) -> bool:
|
|||||||
except CannotConnect as ex:
|
except CannotConnect as ex:
|
||||||
raise ConfigEntryNotReady from ex
|
raise ConfigEntryNotReady from ex
|
||||||
_LOGGER.debug("Devices: %s", devices)
|
_LOGGER.debug("Devices: %s", devices)
|
||||||
devices_and_coordinators = [
|
coordinators: list[SwitchBotCoordinator] = []
|
||||||
(device, SwitchBotCoordinator(hass, api, device)) for device in devices
|
|
||||||
]
|
|
||||||
hass.data.setdefault(DOMAIN, {})
|
hass.data.setdefault(DOMAIN, {})
|
||||||
data = SwitchbotCloudData(
|
data = SwitchbotCloudData(
|
||||||
api=api,
|
api=api,
|
||||||
devices=SwitchbotDevices(
|
devices=SwitchbotDevices(
|
||||||
switches=[
|
switches=[
|
||||||
(device, coordinator)
|
prepare_device(hass, api, device, coordinators)
|
||||||
for device, coordinator in devices_and_coordinators
|
for device in devices
|
||||||
if isinstance(device, Device)
|
if isinstance(device, Device)
|
||||||
and device.device_type.startswith("Plug")
|
and device.device_type.startswith("Plug")
|
||||||
or isinstance(device, Remote)
|
or isinstance(device, Remote)
|
||||||
@ -65,11 +75,10 @@ async def async_setup_entry(hass: HomeAssistant, config: ConfigEntry) -> bool:
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
hass.data[DOMAIN][config.entry_id] = data
|
hass.data[DOMAIN][config.entry_id] = data
|
||||||
_LOGGER.debug("Switches: %s", data.devices.switches)
|
for device_type, devices in vars(data.devices).items():
|
||||||
|
_LOGGER.debug("%s: %s", device_type, devices)
|
||||||
await hass.config_entries.async_forward_entry_setups(config, PLATFORMS)
|
await hass.config_entries.async_forward_entry_setups(config, PLATFORMS)
|
||||||
await gather(
|
await gather(*[coordinator.async_refresh() for coordinator in coordinators])
|
||||||
*[coordinator.async_refresh() for _, coordinator in devices_and_coordinators]
|
|
||||||
)
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
@ -6,5 +6,5 @@
|
|||||||
"documentation": "https://www.home-assistant.io/integrations/switchbot_cloud",
|
"documentation": "https://www.home-assistant.io/integrations/switchbot_cloud",
|
||||||
"iot_class": "cloud_polling",
|
"iot_class": "cloud_polling",
|
||||||
"loggers": ["switchbot-api"],
|
"loggers": ["switchbot-api"],
|
||||||
"requirements": ["switchbot-api==1.1.0"]
|
"requirements": ["switchbot-api==1.2.1"]
|
||||||
}
|
}
|
||||||
|
@ -2517,7 +2517,7 @@ surepy==0.8.0
|
|||||||
swisshydrodata==0.1.0
|
swisshydrodata==0.1.0
|
||||||
|
|
||||||
# homeassistant.components.switchbot_cloud
|
# homeassistant.components.switchbot_cloud
|
||||||
switchbot-api==1.1.0
|
switchbot-api==1.2.1
|
||||||
|
|
||||||
# homeassistant.components.synology_srm
|
# homeassistant.components.synology_srm
|
||||||
synology-srm==0.2.0
|
synology-srm==0.2.0
|
||||||
|
@ -1874,7 +1874,7 @@ sunwatcher==0.2.1
|
|||||||
surepy==0.8.0
|
surepy==0.8.0
|
||||||
|
|
||||||
# homeassistant.components.switchbot_cloud
|
# homeassistant.components.switchbot_cloud
|
||||||
switchbot-api==1.1.0
|
switchbot-api==1.2.1
|
||||||
|
|
||||||
# homeassistant.components.system_bridge
|
# homeassistant.components.system_bridge
|
||||||
systembridgeconnector==3.8.4
|
systembridgeconnector==3.8.4
|
||||||
|
Loading…
x
Reference in New Issue
Block a user