generated from ludeeus/integration_blueprint
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #117 from ThomasLomas/config-entry
- Fixes errors in logs when reloading, changing options, migrating cameras - Fixes deprecated method warning - Uses runtime data to auto clean up
- Loading branch information
Showing
19 changed files
with
111 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,25 @@ | ||
"""Support for Starling Home Hub thermostats.""" | ||
|
||
from homeassistant.config_entries import ConfigEntry | ||
from homeassistant.core import HomeAssistant | ||
from homeassistant.helpers.entity_platform import AddEntitiesCallback | ||
|
||
from custom_components.starling_home_hub.const import DOMAIN | ||
from custom_components.starling_home_hub.entities.thermostat import StarlingHomeHubThermostatEntity | ||
from custom_components.starling_home_hub.models.coordinator import CoordinatorData | ||
from custom_components.starling_home_hub.coordinator import StarlingHomeHubDataUpdateCoordinator, StarlingHomeHubConfigEntry | ||
|
||
|
||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback) -> None: | ||
async def async_setup_entry(hass: HomeAssistant, entry: StarlingHomeHubConfigEntry, async_add_entities: AddEntitiesCallback) -> None: | ||
"""Set up the climate / thermostat platform.""" | ||
|
||
coordinator = hass.data[DOMAIN][entry.entry_id] | ||
coordinator: StarlingHomeHubDataUpdateCoordinator = hass.data[DOMAIN][entry.entry_id] | ||
entities: list[StarlingHomeHubThermostatEntity] = [] | ||
data: CoordinatorData = coordinator.data | ||
|
||
for device in filter(lambda device: device[1].properties["type"] == "thermostat", data.devices.items()): | ||
for device in filter(lambda device: device[1].properties["type"] == "thermostat", entry.runtime_data.devices.items()): | ||
entities.append( | ||
StarlingHomeHubThermostatEntity( | ||
device_id=device[0], | ||
coordinator=coordinator | ||
) | ||
) | ||
|
||
async_add_entities(entities, True) | ||
async_add_entities(entities, update_before_add=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,25 @@ | ||
"""Fan entity for Starling Home Hub.""" | ||
|
||
from homeassistant.config_entries import ConfigEntry | ||
from homeassistant.core import HomeAssistant | ||
from homeassistant.helpers.entity_platform import AddEntitiesCallback | ||
|
||
from custom_components.starling_home_hub.const import DOMAIN | ||
from custom_components.starling_home_hub.entities.fan import StarlingHomeHubFanEntity | ||
from custom_components.starling_home_hub.models.coordinator import CoordinatorData | ||
from custom_components.starling_home_hub.coordinator import StarlingHomeHubDataUpdateCoordinator, StarlingHomeHubConfigEntry | ||
|
||
|
||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback) -> None: | ||
async def async_setup_entry(hass: HomeAssistant, entry: StarlingHomeHubConfigEntry, async_add_entities: AddEntitiesCallback) -> None: | ||
"""Set up the fan platform.""" | ||
|
||
coordinator = hass.data[DOMAIN][entry.entry_id] | ||
coordinator: StarlingHomeHubDataUpdateCoordinator = hass.data[DOMAIN][entry.entry_id] | ||
entities: list[StarlingHomeHubFanEntity] = [] | ||
data: CoordinatorData = coordinator.data | ||
|
||
for device in filter(lambda device: device[1].properties["category"] == "fan", data.devices.items()): | ||
for device in filter(lambda device: device[1].properties["category"] == "fan", entry.runtime_data.devices.items()): | ||
entities.append( | ||
StarlingHomeHubFanEntity( | ||
device_id=device[0], | ||
coordinator=coordinator | ||
) | ||
) | ||
|
||
async_add_entities(entities, True) | ||
async_add_entities(entities, update_before_add=True) |
Oops, something went wrong.