mirror of
https://github.com/home-assistant/core.git
synced 2025-11-11 20:10:12 +00:00
Add setup type hints [c-d] (#63428)
Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
@@ -1,17 +1,26 @@
|
||||
"""Support for Dexcom sensors."""
|
||||
from __future__ import annotations
|
||||
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import CONF_UNIT_OF_MEASUREMENT, CONF_USERNAME
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||
|
||||
from .const import COORDINATOR, DOMAIN, GLUCOSE_TREND_ICON, GLUCOSE_VALUE_ICON, MG_DL
|
||||
|
||||
|
||||
async def async_setup_entry(hass, config_entry, async_add_entities):
|
||||
async def async_setup_entry(
|
||||
hass: HomeAssistant,
|
||||
config_entry: ConfigEntry,
|
||||
async_add_entities: AddEntitiesCallback,
|
||||
) -> None:
|
||||
"""Set up the Dexcom sensors."""
|
||||
coordinator = hass.data[DOMAIN][config_entry.entry_id][COORDINATOR]
|
||||
username = config_entry.data[CONF_USERNAME]
|
||||
unit_of_measurement = config_entry.options[CONF_UNIT_OF_MEASUREMENT]
|
||||
sensors = []
|
||||
sensors: list[SensorEntity] = []
|
||||
sensors.append(DexcomGlucoseTrendSensor(coordinator, username))
|
||||
sensors.append(DexcomGlucoseValueSensor(coordinator, username, unit_of_measurement))
|
||||
async_add_entities(sensors, False)
|
||||
|
||||
Reference in New Issue
Block a user