diff --git a/custom_components/drivvo/config_flow.py b/custom_components/drivvo/config_flow.py index 057df2b..b66beed 100644 --- a/custom_components/drivvo/config_flow.py +++ b/custom_components/drivvo/config_flow.py @@ -1,6 +1,6 @@ from collections.abc import Mapping import logging -from typing import Any +from typing import Any, Dict import voluptuous as vol @@ -152,7 +152,7 @@ def __init__(self) -> None: self.user: str self.password: str - async def async_step_import(self, import_config: dict[str, Any]) -> FlowResult: + async def async_step_import(self, import_config: Dict[str, Any]) -> FlowResult: """Import existing configuration.""" if (f"{DOMAIN}_{import_config.get(CONF_EMAIL)}").lower() in [ @@ -183,7 +183,7 @@ async def async_step_import(self, import_config: dict[str, Any]) -> FlowResult: }, ) - async def async_step_user(self, user_input=None): + async def async_step_user(self, user_input=None) -> FlowResult: errors = {} if user_input is not None: @@ -218,7 +218,7 @@ async def async_step_user(self, user_input=None): async def async_step_vehicle( self, user_input=None, - ): + ) -> FlowResult: errors = {} if user_input is not None: diff --git a/custom_components/drivvo/sensor.py b/custom_components/drivvo/sensor.py index 014722e..4b08dea 100755 --- a/custom_components/drivvo/sensor.py +++ b/custom_components/drivvo/sensor.py @@ -1,5 +1,5 @@ import logging -from typing import Any +from typing import Any, Dict import voluptuous as vol @@ -111,7 +111,7 @@ async def async_setup_platform( class DrivvoSensor(Entity): - def __init__(self, hass, email, password, data, interval): + def __init__(self, hass, email, password, data, interval) -> None: """Inizialize sensor.""" self._attr_unique_id = f"{data.id}_refuellings" self._attr_has_entity_name = True @@ -134,17 +134,17 @@ def __init__(self, hass, email, password, data, interval): self.data = data @property - def icon(self): + def icon(self) -> str: """Return the default icon.""" return ICON @property - def state(self): + def state(self) -> int: """Returns the number of supplies so far.""" return self.data.refuelling_total @property - def extra_state_attributes(self): + def extra_state_attributes(self) -> Dict[str, Any]: """Attributes.""" return { @@ -168,7 +168,7 @@ def extra_state_attributes(self): "refuelling_volume_total": self.data.refuelling_volume_total, } - async def async_update(self): + async def async_update(self) -> None: """Updates the data by making a request to the API.""" self.data = await get_data_vehicle( hass=self.hass,