Add setup type hints [c-d] (#63428)

Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
epenet
2022-01-05 15:05:22 +01:00
committed by GitHub
parent 953a4f07fa
commit 47812575d0
6 changed files with 64 additions and 13 deletions

View File

@@ -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)