Improve entity type hints [t] (#77883)
This commit is contained in:
parent
0c767bd0d3
commit
458001a06e
29 changed files with 67 additions and 60 deletions
|
@ -108,7 +108,7 @@ class TadoDeviceBinarySensor(TadoDeviceEntity, BinarySensorEntity):
|
|||
|
||||
self._state = None
|
||||
|
||||
async def async_added_to_hass(self):
|
||||
async def async_added_to_hass(self) -> None:
|
||||
"""Register for sensor updates."""
|
||||
|
||||
self.async_on_remove(
|
||||
|
@ -184,7 +184,7 @@ class TadoZoneBinarySensor(TadoZoneEntity, BinarySensorEntity):
|
|||
self._state_attributes = None
|
||||
self._tado_zone_data = None
|
||||
|
||||
async def async_added_to_hass(self):
|
||||
async def async_added_to_hass(self) -> None:
|
||||
"""Register for sensor updates."""
|
||||
|
||||
self.async_on_remove(
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
|
@ -273,7 +274,7 @@ class TadoClimate(TadoZoneEntity, ClimateEntity):
|
|||
|
||||
self._async_update_zone_data()
|
||||
|
||||
async def async_added_to_hass(self):
|
||||
async def async_added_to_hass(self) -> None:
|
||||
"""Register for sensor updates."""
|
||||
|
||||
self.async_on_remove(
|
||||
|
@ -349,7 +350,7 @@ class TadoClimate(TadoZoneEntity, ClimateEntity):
|
|||
"""List of available fan modes."""
|
||||
return self._supported_fan_modes
|
||||
|
||||
def set_fan_mode(self, fan_mode: str):
|
||||
def set_fan_mode(self, fan_mode: str) -> None:
|
||||
"""Turn fan on/off."""
|
||||
self._control_hvac(fan_mode=HA_TO_TADO_FAN_MODE_MAP[fan_mode])
|
||||
|
||||
|
@ -365,7 +366,7 @@ class TadoClimate(TadoZoneEntity, ClimateEntity):
|
|||
"""Return a list of available preset modes."""
|
||||
return SUPPORT_PRESET
|
||||
|
||||
def set_preset_mode(self, preset_mode):
|
||||
def set_preset_mode(self, preset_mode: str) -> None:
|
||||
"""Set new preset mode."""
|
||||
self._tado.set_presence(preset_mode)
|
||||
|
||||
|
@ -406,7 +407,7 @@ class TadoClimate(TadoZoneEntity, ClimateEntity):
|
|||
|
||||
self._tado.set_temperature_offset(self._device_id, offset)
|
||||
|
||||
def set_temperature(self, **kwargs):
|
||||
def set_temperature(self, **kwargs: Any) -> None:
|
||||
"""Set new target temperature."""
|
||||
if (temperature := kwargs.get(ATTR_TEMPERATURE)) is None:
|
||||
return
|
||||
|
@ -428,7 +429,7 @@ class TadoClimate(TadoZoneEntity, ClimateEntity):
|
|||
self._control_hvac(hvac_mode=HA_TO_TADO_HVAC_MODE_MAP[hvac_mode])
|
||||
|
||||
@property
|
||||
def available(self):
|
||||
def available(self) -> bool:
|
||||
"""Return if the device is available."""
|
||||
return self._tado_zone_data.available
|
||||
|
||||
|
@ -482,7 +483,7 @@ class TadoClimate(TadoZoneEntity, ClimateEntity):
|
|||
] = self._tado_zone_data.default_overlay_termination_duration
|
||||
return state_attr
|
||||
|
||||
def set_swing_mode(self, swing_mode):
|
||||
def set_swing_mode(self, swing_mode: str) -> None:
|
||||
"""Set swing modes for the device."""
|
||||
self._control_hvac(swing_mode=swing_mode)
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@ class TadoHomeSensor(TadoHomeEntity, SensorEntity):
|
|||
self._state_attributes = None
|
||||
self._tado_weather_data = self._tado.data["weather"]
|
||||
|
||||
async def async_added_to_hass(self):
|
||||
async def async_added_to_hass(self) -> None:
|
||||
"""Register for sensor updates."""
|
||||
|
||||
self.async_on_remove(
|
||||
|
@ -211,7 +211,7 @@ class TadoZoneSensor(TadoZoneEntity, SensorEntity):
|
|||
self._state_attributes = None
|
||||
self._tado_zone_data = None
|
||||
|
||||
async def async_added_to_hass(self):
|
||||
async def async_added_to_hass(self) -> None:
|
||||
"""Register for sensor updates."""
|
||||
|
||||
self.async_on_remove(
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
"""Support for Tado hot water zones."""
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
|
@ -152,7 +153,7 @@ class TadoWaterHeater(TadoZoneEntity, WaterHeaterEntity):
|
|||
self._overlay_mode = CONST_MODE_SMART_SCHEDULE
|
||||
self._tado_zone_data = None
|
||||
|
||||
async def async_added_to_hass(self):
|
||||
async def async_added_to_hass(self) -> None:
|
||||
"""Register for sensor updates."""
|
||||
|
||||
self.async_on_remove(
|
||||
|
@ -211,7 +212,7 @@ class TadoWaterHeater(TadoZoneEntity, WaterHeaterEntity):
|
|||
"""Return the maximum temperature."""
|
||||
return self._max_temperature
|
||||
|
||||
def set_operation_mode(self, operation_mode):
|
||||
def set_operation_mode(self, operation_mode: str) -> None:
|
||||
"""Set new operation mode."""
|
||||
mode = None
|
||||
|
||||
|
@ -233,7 +234,7 @@ class TadoWaterHeater(TadoZoneEntity, WaterHeaterEntity):
|
|||
hvac_mode=CONST_MODE_HEAT, target_temp=temperature, duration=time_period
|
||||
)
|
||||
|
||||
def set_temperature(self, **kwargs):
|
||||
def set_temperature(self, **kwargs: Any) -> None:
|
||||
"""Set new target temperature."""
|
||||
temperature = kwargs.get(ATTR_TEMPERATURE)
|
||||
if not self._supports_temperature_control or temperature is None:
|
||||
|
|
|
@ -133,7 +133,7 @@ class TankUtilitySensor(SensorEntity):
|
|||
data.update(data.pop("lastReading", {}))
|
||||
return data
|
||||
|
||||
def update(self):
|
||||
def update(self) -> None:
|
||||
"""Set the device state and attributes."""
|
||||
data = self.get_data()
|
||||
self._state = round(data[SENSOR_TYPE], SENSOR_ROUNDING_PRECISION)
|
||||
|
|
|
@ -61,7 +61,7 @@ class TapsAffSensor(BinarySensorEntity):
|
|||
"""Return true if taps aff."""
|
||||
return self.data.is_taps_aff
|
||||
|
||||
def update(self):
|
||||
def update(self) -> None:
|
||||
"""Get the latest data."""
|
||||
self.data.update()
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ class Ted5000Sensor(SensorEntity):
|
|||
with suppress(KeyError):
|
||||
return self._gateway.data[self._mtu][self._unit]
|
||||
|
||||
def update(self):
|
||||
def update(self) -> None:
|
||||
"""Get the latest data from REST API."""
|
||||
self._gateway.update()
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
"""Support for Tellstick switches using Tellstick Net."""
|
||||
from typing import Any
|
||||
|
||||
from homeassistant.components import switch
|
||||
from homeassistant.components.switch import SwitchEntity
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
|
@ -37,12 +39,12 @@ class TelldusLiveSwitch(TelldusLiveEntity, SwitchEntity):
|
|||
"""Return true if switch is on."""
|
||||
return self.device.is_on
|
||||
|
||||
def turn_on(self, **kwargs):
|
||||
def turn_on(self, **kwargs: Any) -> None:
|
||||
"""Turn the switch on."""
|
||||
self.device.turn_on()
|
||||
self._update_callback()
|
||||
|
||||
def turn_off(self, **kwargs):
|
||||
def turn_off(self, **kwargs: Any) -> None:
|
||||
"""Turn the switch off."""
|
||||
self.device.turn_off()
|
||||
self._update_callback()
|
||||
|
|
|
@ -160,6 +160,6 @@ class TellstickSensor(SensorEntity):
|
|||
self._attr_native_unit_of_measurement = sensor_info.unit or None
|
||||
self._attr_name = f"{name} {sensor_info.name}"
|
||||
|
||||
def update(self):
|
||||
def update(self) -> None:
|
||||
"""Update tellstick sensor."""
|
||||
self._attr_native_value = self._tellcore_sensor.value(self._datatype).value
|
||||
|
|
|
@ -146,14 +146,14 @@ class TelnetSwitch(SwitchEntity):
|
|||
return None
|
||||
self._attr_is_on = rendered == "True"
|
||||
|
||||
def turn_on(self, **kwargs) -> None:
|
||||
def turn_on(self, **kwargs: Any) -> None:
|
||||
"""Turn the device on."""
|
||||
self._telnet_command(self._command_on)
|
||||
if self.assumed_state:
|
||||
self._attr_is_on = True
|
||||
self.schedule_update_ha_state()
|
||||
|
||||
def turn_off(self, **kwargs) -> None:
|
||||
def turn_off(self, **kwargs: Any) -> None:
|
||||
"""Turn the device off."""
|
||||
self._telnet_command(self._command_off)
|
||||
if self.assumed_state:
|
||||
|
|
|
@ -91,7 +91,7 @@ class TemperSensor(SensorEntity):
|
|||
# set calibration data
|
||||
self.temper_device.set_calibration_data(scale=self.scale, offset=self.offset)
|
||||
|
||||
def update(self):
|
||||
def update(self) -> None:
|
||||
"""Retrieve latest state."""
|
||||
try:
|
||||
sensor_value = self.temper_device.get_temperature("celsius")
|
||||
|
|
|
@ -4,6 +4,7 @@ from __future__ import annotations
|
|||
from concurrent import futures
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
from pytfiac import Tfiac
|
||||
import voluptuous as vol
|
||||
|
@ -94,7 +95,7 @@ class TfiacClimate(ClimateEntity):
|
|||
"""Return if the device is available."""
|
||||
return self._available
|
||||
|
||||
async def async_update(self):
|
||||
async def async_update(self) -> None:
|
||||
"""Update status via socket polling."""
|
||||
try:
|
||||
await self._client.update()
|
||||
|
@ -167,7 +168,7 @@ class TfiacClimate(ClimateEntity):
|
|||
"""List of available swing modes."""
|
||||
return SUPPORT_SWING
|
||||
|
||||
async def async_set_temperature(self, **kwargs):
|
||||
async def async_set_temperature(self, **kwargs: Any) -> None:
|
||||
"""Set new target temperature."""
|
||||
if (temp := kwargs.get(ATTR_TEMPERATURE)) is not None:
|
||||
await self._client.set_state(TARGET_TEMP, temp)
|
||||
|
@ -179,18 +180,18 @@ class TfiacClimate(ClimateEntity):
|
|||
else:
|
||||
await self._client.set_state(OPERATION_MODE, HVAC_MAP[hvac_mode])
|
||||
|
||||
async def async_set_fan_mode(self, fan_mode):
|
||||
async def async_set_fan_mode(self, fan_mode: str) -> None:
|
||||
"""Set new fan mode."""
|
||||
await self._client.set_state(FAN_MODE, fan_mode.capitalize())
|
||||
|
||||
async def async_set_swing_mode(self, swing_mode):
|
||||
async def async_set_swing_mode(self, swing_mode: str) -> None:
|
||||
"""Set new swing mode."""
|
||||
await self._client.set_swing(swing_mode.capitalize())
|
||||
|
||||
async def async_turn_on(self):
|
||||
async def async_turn_on(self) -> None:
|
||||
"""Turn device on."""
|
||||
await self._client.set_state(OPERATION_MODE)
|
||||
|
||||
async def async_turn_off(self):
|
||||
async def async_turn_off(self) -> None:
|
||||
"""Turn device off."""
|
||||
await self._client.set_state(ON_MODE, "off")
|
||||
|
|
|
@ -127,7 +127,7 @@ class ThermoworksSmokeSensor(SensorEntity):
|
|||
else:
|
||||
self._attr_native_unit_of_measurement = self.mgr.units(self.serial, PROBE_1)
|
||||
|
||||
def update(self):
|
||||
def update(self) -> None:
|
||||
"""Get the monitored data from firebase."""
|
||||
|
||||
try:
|
||||
|
|
|
@ -109,7 +109,7 @@ class TtnDataSensor(SensorEntity):
|
|||
ATTR_TIME: self._state["time"],
|
||||
}
|
||||
|
||||
async def async_update(self):
|
||||
async def async_update(self) -> None:
|
||||
"""Get the current state."""
|
||||
await self._ttn_data_storage.async_update()
|
||||
self._state = self._ttn_data_storage.data
|
||||
|
|
|
@ -107,7 +107,7 @@ class ThinkingCleanerSensor(SensorEntity):
|
|||
|
||||
self._attr_name = f"{tc_object.name} {description.name}"
|
||||
|
||||
def update(self):
|
||||
def update(self) -> None:
|
||||
"""Update the sensor."""
|
||||
self._update_devices()
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ from __future__ import annotations
|
|||
|
||||
from datetime import timedelta
|
||||
import time
|
||||
from typing import Any
|
||||
|
||||
from pythinkingcleaner import Discovery, ThinkingCleaner
|
||||
import voluptuous as vol
|
||||
|
@ -130,7 +131,7 @@ class ThinkingCleanerSwitch(SwitchEntity):
|
|||
|
||||
return False
|
||||
|
||||
def turn_on(self, **kwargs):
|
||||
def turn_on(self, **kwargs: Any) -> None:
|
||||
"""Turn the device on."""
|
||||
sensor_type = self.entity_description.key
|
||||
if sensor_type == "clean":
|
||||
|
@ -141,13 +142,13 @@ class ThinkingCleanerSwitch(SwitchEntity):
|
|||
elif sensor_type == "find":
|
||||
self._tc_object.find_me()
|
||||
|
||||
def turn_off(self, **kwargs):
|
||||
def turn_off(self, **kwargs: Any) -> None:
|
||||
"""Turn the device off."""
|
||||
if self.entity_description.key == "clean":
|
||||
self.set_graceful_lock(False)
|
||||
self._tc_object.stop_cleaning()
|
||||
|
||||
def update(self):
|
||||
def update(self) -> None:
|
||||
"""Update the switch state (Only for clean)."""
|
||||
if self.entity_description.key == "clean" and not self.is_update_locked():
|
||||
self._tc_object.update()
|
||||
|
|
|
@ -350,7 +350,7 @@ class TibberSensorElPrice(TibberSensor):
|
|||
|
||||
self._device_name = self._home_name
|
||||
|
||||
async def async_update(self):
|
||||
async def async_update(self) -> None:
|
||||
"""Get the latest data and updates the states."""
|
||||
now = dt_util.now()
|
||||
if (
|
||||
|
@ -448,7 +448,7 @@ class TibberSensorRT(TibberSensor, CoordinatorEntity["TibberRtDataCoordinator"])
|
|||
self._attr_native_unit_of_measurement = tibber_home.currency
|
||||
|
||||
@property
|
||||
def available(self):
|
||||
def available(self) -> bool:
|
||||
"""Return True if entity is available."""
|
||||
return self._tibber_home.rt_subscription_running
|
||||
|
||||
|
|
|
@ -119,7 +119,7 @@ class TMBSensor(SensorEntity):
|
|||
}
|
||||
|
||||
@Throttle(MIN_TIME_BETWEEN_UPDATES)
|
||||
def update(self):
|
||||
def update(self) -> None:
|
||||
"""Get the next bus information."""
|
||||
try:
|
||||
self._state = self._ibus_client.get_stop_forecast(self._stop, self._line)
|
||||
|
|
|
@ -225,7 +225,7 @@ class TodSensor(BinarySensorEntity):
|
|||
# Offset is already there
|
||||
self._time_before += timedelta(days=1)
|
||||
|
||||
async def async_added_to_hass(self):
|
||||
async def async_added_to_hass(self) -> None:
|
||||
"""Call when entity about to be added to Home Assistant."""
|
||||
self._calculate_boundary_time()
|
||||
self._calculate_next_update()
|
||||
|
|
|
@ -308,7 +308,7 @@ class TodoistProjectEntity(CalendarEntity):
|
|||
"""Return the name of the entity."""
|
||||
return self._name
|
||||
|
||||
def update(self):
|
||||
def update(self) -> None:
|
||||
"""Update all Todoist Calendars."""
|
||||
self.data.update()
|
||||
# Set Todoist-specific data that can't easily be grabbed
|
||||
|
|
|
@ -103,7 +103,7 @@ class ToonThermostatDevice(ToonDisplayDeviceEntity, ClimateEntity):
|
|||
return {"heating_type": self.coordinator.data.agreement.heating_type}
|
||||
|
||||
@toon_exception_handler
|
||||
async def async_set_temperature(self, **kwargs) -> None:
|
||||
async def async_set_temperature(self, **kwargs: Any) -> None:
|
||||
"""Change the setpoint of the thermostat."""
|
||||
temperature = kwargs.get(ATTR_TEMPERATURE)
|
||||
await self.coordinator.toon.set_current_setpoint(temperature)
|
||||
|
|
|
@ -49,7 +49,7 @@ class TotalConnectBinarySensor(BinarySensorEntity):
|
|||
"""Return the name of the device."""
|
||||
return self._name
|
||||
|
||||
def update(self):
|
||||
def update(self) -> None:
|
||||
"""Return the state of the device."""
|
||||
self._is_tampered = self._zone.is_tampered()
|
||||
self._is_low_battery = self._zone.is_low_battery()
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"""Platform for Roth Touchline floor heating controller."""
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import NamedTuple
|
||||
from typing import Any, NamedTuple
|
||||
|
||||
from pytouchline import PyTouchline
|
||||
import voluptuous as vol
|
||||
|
@ -75,7 +75,7 @@ class Touchline(ClimateEntity):
|
|||
self._current_operation_mode = None
|
||||
self._preset_mode = None
|
||||
|
||||
def update(self):
|
||||
def update(self) -> None:
|
||||
"""Update thermostat attributes."""
|
||||
self.unit.update()
|
||||
self._name = self.unit.get_name()
|
||||
|
@ -120,7 +120,7 @@ class Touchline(ClimateEntity):
|
|||
"""Set new target hvac mode."""
|
||||
self._current_operation_mode = HVACMode.HEAT
|
||||
|
||||
def set_temperature(self, **kwargs):
|
||||
def set_temperature(self, **kwargs: Any) -> None:
|
||||
"""Set new target temperature."""
|
||||
if kwargs.get(ATTR_TEMPERATURE) is not None:
|
||||
self._target_temperature = kwargs.get(ATTR_TEMPERATURE)
|
||||
|
|
|
@ -411,7 +411,7 @@ class TraccarEntity(TrackerEntity, RestoreEntity):
|
|||
"""Return the source type, eg gps or router, of the device."""
|
||||
return SourceType.GPS
|
||||
|
||||
async def async_added_to_hass(self):
|
||||
async def async_added_to_hass(self) -> None:
|
||||
"""Register state update callback."""
|
||||
await super().async_added_to_hass()
|
||||
self._unsub_dispatcher = async_dispatcher_connect(
|
||||
|
@ -445,7 +445,7 @@ class TraccarEntity(TrackerEntity, RestoreEntity):
|
|||
}
|
||||
self._battery = attr.get(ATTR_BATTERY)
|
||||
|
||||
async def async_will_remove_from_hass(self):
|
||||
async def async_will_remove_from_hass(self) -> None:
|
||||
"""Clean up after entity before removal."""
|
||||
await super().async_will_remove_from_hass()
|
||||
self._unsub_dispatcher()
|
||||
|
|
|
@ -75,11 +75,11 @@ class TransmissionSensor(SensorEntity):
|
|||
return self._state
|
||||
|
||||
@property
|
||||
def available(self):
|
||||
def available(self) -> bool:
|
||||
"""Could the device be accessed during the last update call."""
|
||||
return self._tm_client.api.available
|
||||
|
||||
async def async_added_to_hass(self):
|
||||
async def async_added_to_hass(self) -> None:
|
||||
"""Handle entity which will be added."""
|
||||
|
||||
@callback
|
||||
|
@ -102,7 +102,7 @@ class TransmissionSpeedSensor(TransmissionSensor):
|
|||
"""Return the unit of measurement of this entity, if any."""
|
||||
return DATA_RATE_MEGABYTES_PER_SECOND
|
||||
|
||||
def update(self):
|
||||
def update(self) -> None:
|
||||
"""Get the latest data from Transmission and updates the state."""
|
||||
if data := self._tm_client.api.data:
|
||||
mb_spd = (
|
||||
|
@ -117,7 +117,7 @@ class TransmissionSpeedSensor(TransmissionSensor):
|
|||
class TransmissionStatusSensor(TransmissionSensor):
|
||||
"""Representation of a Transmission status sensor."""
|
||||
|
||||
def update(self):
|
||||
def update(self) -> None:
|
||||
"""Get the latest data from Transmission and updates the state."""
|
||||
if data := self._tm_client.api.data:
|
||||
upload = data.uploadSpeed
|
||||
|
@ -163,7 +163,7 @@ class TransmissionTorrentsSensor(TransmissionSensor):
|
|||
STATE_ATTR_TORRENT_INFO: info,
|
||||
}
|
||||
|
||||
def update(self):
|
||||
def update(self) -> None:
|
||||
"""Get the latest data from Transmission and updates the state."""
|
||||
torrents = _filter_torrents(
|
||||
self._tm_client.api.torrents, statuses=self.SUBTYPE_MODES[self._sub_type]
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
"""Support for setting the Transmission BitTorrent client Turtle Mode."""
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
from homeassistant.components.switch import SwitchEntity
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
|
@ -61,11 +62,11 @@ class TransmissionSwitch(SwitchEntity):
|
|||
return self._state == STATE_ON
|
||||
|
||||
@property
|
||||
def available(self):
|
||||
def available(self) -> bool:
|
||||
"""Could the device be accessed during the last update call."""
|
||||
return self._tm_client.api.available
|
||||
|
||||
def turn_on(self, **kwargs):
|
||||
def turn_on(self, **kwargs: Any) -> None:
|
||||
"""Turn the device on."""
|
||||
if self.type == "on_off":
|
||||
_LOGGING.debug("Starting all torrents")
|
||||
|
@ -75,7 +76,7 @@ class TransmissionSwitch(SwitchEntity):
|
|||
self._tm_client.api.set_alt_speed_enabled(True)
|
||||
self._tm_client.api.update()
|
||||
|
||||
def turn_off(self, **kwargs):
|
||||
def turn_off(self, **kwargs: Any) -> None:
|
||||
"""Turn the device off."""
|
||||
if self.type == "on_off":
|
||||
_LOGGING.debug("Stopping all torrents")
|
||||
|
@ -85,7 +86,7 @@ class TransmissionSwitch(SwitchEntity):
|
|||
self._tm_client.api.set_alt_speed_enabled(False)
|
||||
self._tm_client.api.update()
|
||||
|
||||
async def async_added_to_hass(self):
|
||||
async def async_added_to_hass(self) -> None:
|
||||
"""Handle entity which will be added."""
|
||||
self.unsub_update = async_dispatcher_connect(
|
||||
self.hass,
|
||||
|
@ -103,7 +104,7 @@ class TransmissionSwitch(SwitchEntity):
|
|||
self.unsub_update()
|
||||
self.unsub_update = None
|
||||
|
||||
def update(self):
|
||||
def update(self) -> None:
|
||||
"""Get the latest data from Transmission and updates the state."""
|
||||
active = None
|
||||
if self.type == "on_off":
|
||||
|
|
|
@ -120,7 +120,7 @@ class TransportNSWSensor(SensorEntity):
|
|||
"""Icon to use in the frontend, if any."""
|
||||
return self._icon
|
||||
|
||||
def update(self):
|
||||
def update(self) -> None:
|
||||
"""Get the latest data from Transport NSW and update the states."""
|
||||
self.data.update()
|
||||
self._times = self.data.info
|
||||
|
|
|
@ -174,7 +174,7 @@ class TravisCISensor(SensorEntity):
|
|||
|
||||
return attrs
|
||||
|
||||
def update(self):
|
||||
def update(self) -> None:
|
||||
"""Get the latest data and updates the states."""
|
||||
_LOGGER.debug("Updating sensor %s", self.name)
|
||||
|
||||
|
|
|
@ -169,7 +169,7 @@ class SensorTrend(BinarySensorEntity):
|
|||
ATTR_SAMPLE_DURATION: self._sample_duration,
|
||||
}
|
||||
|
||||
async def async_added_to_hass(self):
|
||||
async def async_added_to_hass(self) -> None:
|
||||
"""Complete device setup after being added to hass."""
|
||||
|
||||
@callback
|
||||
|
@ -195,7 +195,7 @@ class SensorTrend(BinarySensorEntity):
|
|||
)
|
||||
)
|
||||
|
||||
async def async_update(self):
|
||||
async def async_update(self) -> None:
|
||||
"""Get the latest data and update the states."""
|
||||
# Remove outdated samples
|
||||
if self._sample_duration > 0:
|
||||
|
|
Loading…
Add table
Reference in a new issue