From dedf063e43d94d9a0842ef9976d611c2a9229c0b Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Fri, 19 Aug 2022 09:54:13 +0200 Subject: [PATCH] Improve entity type hints [b] (#77012) --- homeassistant/components/balboa/climate.py | 9 +++-- .../components/bayesian/binary_sensor.py | 4 +- homeassistant/components/bbox/sensor.py | 4 +- .../components/beewi_smartclim/sensor.py | 2 +- homeassistant/components/bitcoin/sensor.py | 2 +- homeassistant/components/bizkaibus/sensor.py | 2 +- .../components/blackbird/media_player.py | 8 ++-- homeassistant/components/blebox/climate.py | 5 ++- homeassistant/components/blebox/light.py | 3 +- homeassistant/components/blebox/switch.py | 5 ++- .../components/blink/binary_sensor.py | 2 +- homeassistant/components/blink/camera.py | 6 +-- homeassistant/components/blink/sensor.py | 2 +- homeassistant/components/blockchain/sensor.py | 2 +- .../components/bloomsky/binary_sensor.py | 2 +- homeassistant/components/bloomsky/sensor.py | 2 +- .../components/bluesound/media_player.py | 38 +++++++++++-------- homeassistant/components/bosch_shc/switch.py | 9 +++-- homeassistant/components/broadlink/remote.py | 14 ++++--- homeassistant/components/broadlink/switch.py | 7 ++-- homeassistant/components/bsblan/climate.py | 4 +- 21 files changed, 73 insertions(+), 59 deletions(-) diff --git a/homeassistant/components/balboa/climate.py b/homeassistant/components/balboa/climate.py index 98acf88649e..cd10ccf2bc9 100644 --- a/homeassistant/components/balboa/climate.py +++ b/homeassistant/components/balboa/climate.py @@ -2,6 +2,7 @@ from __future__ import annotations import asyncio +from typing import Any from homeassistant.components.climate import ClimateEntity from homeassistant.components.climate.const import ( @@ -121,7 +122,7 @@ class BalboaSpaClimate(BalboaEntity, ClimateEntity): """Return current preset mode.""" return self._client.get_heatmode(True) - async def async_set_temperature(self, **kwargs): + async def async_set_temperature(self, **kwargs: Any) -> None: """Set a new target temperature.""" scale = self._client.get_tempscale() newtemp = kwargs[ATTR_TEMPERATURE] @@ -133,7 +134,7 @@ class BalboaSpaClimate(BalboaEntity, ClimateEntity): await asyncio.sleep(SET_TEMPERATURE_WAIT) await self._client.send_temp_change(newtemp) - async def async_set_preset_mode(self, preset_mode) -> None: + async def async_set_preset_mode(self, preset_mode: str) -> None: """Set new preset mode.""" modelist = self._client.get_heatmode_stringlist() self._async_validate_mode_or_raise(preset_mode) @@ -141,7 +142,7 @@ class BalboaSpaClimate(BalboaEntity, ClimateEntity): raise ValueError(f"{preset_mode} is not a valid preset mode") await self._client.change_heatmode(modelist.index(preset_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.change_blower(self._ha_to_balboa_blower_map[fan_mode]) @@ -150,7 +151,7 @@ class BalboaSpaClimate(BalboaEntity, ClimateEntity): if mode == self._client.HEATMODE_RNR: raise ValueError(f"{mode} can only be reported but not set") - async def async_set_hvac_mode(self, hvac_mode): + async def async_set_hvac_mode(self, hvac_mode: HVACMode) -> None: """Set new target hvac mode. OFF = Rest diff --git a/homeassistant/components/bayesian/binary_sensor.py b/homeassistant/components/bayesian/binary_sensor.py index 216a8360a84..5641480ba98 100644 --- a/homeassistant/components/bayesian/binary_sensor.py +++ b/homeassistant/components/bayesian/binary_sensor.py @@ -162,7 +162,7 @@ class BayesianBinarySensor(BinarySensorEntity): "state": self._process_state, } - async def async_added_to_hass(self): + async def async_added_to_hass(self) -> None: """ Call when entity about to be added. @@ -397,7 +397,7 @@ class BayesianBinarySensor(BinarySensorEntity): ATTR_PROBABILITY_THRESHOLD: self._probability_threshold, } - async def async_update(self): + async def async_update(self) -> None: """Get the latest data and update the states.""" if not self._callbacks: self._recalculate_and_write_state() diff --git a/homeassistant/components/bbox/sensor.py b/homeassistant/components/bbox/sensor.py index b85c75569d4..43ba6956507 100644 --- a/homeassistant/components/bbox/sensor.py +++ b/homeassistant/components/bbox/sensor.py @@ -136,7 +136,7 @@ class BboxUptimeSensor(SensorEntity): self._attr_name = f"{name} {description.name}" self.bbox_data = bbox_data - def update(self): + def update(self) -> None: """Get the latest data from Bbox and update the state.""" self.bbox_data.update() self._attr_native_value = utcnow() - timedelta( @@ -155,7 +155,7 @@ class BboxSensor(SensorEntity): self._attr_name = f"{name} {description.name}" self.bbox_data = bbox_data - def update(self): + def update(self) -> None: """Get the latest data from Bbox and update the state.""" self.bbox_data.update() sensor_type = self.entity_description.key diff --git a/homeassistant/components/beewi_smartclim/sensor.py b/homeassistant/components/beewi_smartclim/sensor.py index 476ffbdbf1a..4d8936859f5 100644 --- a/homeassistant/components/beewi_smartclim/sensor.py +++ b/homeassistant/components/beewi_smartclim/sensor.py @@ -73,7 +73,7 @@ class BeewiSmartclimSensor(SensorEntity): self._attr_device_class = self._device self._attr_unique_id = f"{mac}_{device}" - def update(self): + def update(self) -> None: """Fetch new state data from the poller.""" self._poller.update_sensor() self._attr_native_value = None diff --git a/homeassistant/components/bitcoin/sensor.py b/homeassistant/components/bitcoin/sensor.py index d5e9cc9adad..49691089f35 100644 --- a/homeassistant/components/bitcoin/sensor.py +++ b/homeassistant/components/bitcoin/sensor.py @@ -181,7 +181,7 @@ class BitcoinSensor(SensorEntity): self.data = data self._currency = currency - def update(self): + def update(self) -> None: """Get the latest data and updates the states.""" self.data.update() stats = self.data.stats diff --git a/homeassistant/components/bizkaibus/sensor.py b/homeassistant/components/bizkaibus/sensor.py index d79192af72d..2c2d1b9db29 100644 --- a/homeassistant/components/bizkaibus/sensor.py +++ b/homeassistant/components/bizkaibus/sensor.py @@ -54,7 +54,7 @@ class BizkaibusSensor(SensorEntity): self.data = data self._attr_name = name - def update(self): + def update(self) -> None: """Get the latest data from the webservice.""" self.data.update() with suppress(TypeError): diff --git a/homeassistant/components/blackbird/media_player.py b/homeassistant/components/blackbird/media_player.py index a20c4294438..b0fda2de0f4 100644 --- a/homeassistant/components/blackbird/media_player.py +++ b/homeassistant/components/blackbird/media_player.py @@ -158,7 +158,7 @@ class BlackbirdZone(MediaPlayerEntity): self._zone_id = zone_id self._attr_name = zone_name - def update(self): + def update(self) -> None: """Retrieve latest state.""" state = self._blackbird.zone_status(self._zone_id) if not state: @@ -183,7 +183,7 @@ class BlackbirdZone(MediaPlayerEntity): _LOGGER.debug("Setting all zones source to %s", idx) self._blackbird.set_all_zone_source(idx) - def select_source(self, source): + def select_source(self, source: str) -> None: """Set input source.""" if source not in self._source_name_id: return @@ -191,12 +191,12 @@ class BlackbirdZone(MediaPlayerEntity): _LOGGER.debug("Setting zone %d source to %s", self._zone_id, idx) self._blackbird.set_zone_source(self._zone_id, idx) - def turn_on(self): + def turn_on(self) -> None: """Turn the media player on.""" _LOGGER.debug("Turning zone %d on", self._zone_id) self._blackbird.set_zone_power(self._zone_id, True) - def turn_off(self): + def turn_off(self) -> None: """Turn the media player off.""" _LOGGER.debug("Turning zone %d off", self._zone_id) self._blackbird.set_zone_power(self._zone_id, False) diff --git a/homeassistant/components/blebox/climate.py b/homeassistant/components/blebox/climate.py index e279991df20..78f47b1ba46 100644 --- a/homeassistant/components/blebox/climate.py +++ b/homeassistant/components/blebox/climate.py @@ -1,5 +1,6 @@ """BleBox climate entity.""" from datetime import timedelta +from typing import Any from homeassistant.components.climate import ClimateEntity from homeassistant.components.climate.const import ( @@ -73,7 +74,7 @@ class BleBoxClimateEntity(BleBoxEntity, ClimateEntity): """Return the desired thermostat temperature.""" return self._feature.desired - async def async_set_hvac_mode(self, hvac_mode): + async def async_set_hvac_mode(self, hvac_mode: HVACMode) -> None: """Set the climate entity mode.""" if hvac_mode == HVACMode.HEAT: await self._feature.async_on() @@ -81,7 +82,7 @@ class BleBoxClimateEntity(BleBoxEntity, ClimateEntity): await self._feature.async_off() - async def async_set_temperature(self, **kwargs): + async def async_set_temperature(self, **kwargs: Any) -> None: """Set the thermostat temperature.""" value = kwargs[ATTR_TEMPERATURE] await self._feature.async_set_temperature(value) diff --git a/homeassistant/components/blebox/light.py b/homeassistant/components/blebox/light.py index a2ad51cfc9c..8202186d86d 100644 --- a/homeassistant/components/blebox/light.py +++ b/homeassistant/components/blebox/light.py @@ -3,6 +3,7 @@ from __future__ import annotations from datetime import timedelta import logging +from typing import Any import blebox_uniapi.light from blebox_uniapi.light import BleboxColorMode @@ -175,6 +176,6 @@ class BleBoxLightEntity(BleBoxEntity, LightEntity): f"Turning on with effect '{self.name}' failed: {effect} not in effect list." ) from exc - async def async_turn_off(self, **kwargs): + async def async_turn_off(self, **kwargs: Any) -> None: """Turn the light off.""" await self._feature.async_off() diff --git a/homeassistant/components/blebox/switch.py b/homeassistant/components/blebox/switch.py index f9c866244c7..5ae37d6b34d 100644 --- a/homeassistant/components/blebox/switch.py +++ b/homeassistant/components/blebox/switch.py @@ -1,5 +1,6 @@ """BleBox switch implementation.""" from datetime import timedelta +from typing import Any from homeassistant.components.switch import SwitchDeviceClass, SwitchEntity from homeassistant.config_entries import ConfigEntry @@ -35,10 +36,10 @@ class BleBoxSwitchEntity(BleBoxEntity, SwitchEntity): """Return whether switch is on.""" return self._feature.is_on - async def async_turn_on(self, **kwargs): + async def async_turn_on(self, **kwargs: Any) -> None: """Turn on the switch.""" await self._feature.async_turn_on() - async def async_turn_off(self, **kwargs): + async def async_turn_off(self, **kwargs: Any) -> None: """Turn off the switch.""" await self._feature.async_turn_off() diff --git a/homeassistant/components/blink/binary_sensor.py b/homeassistant/components/blink/binary_sensor.py index 5b2e490cda9..ddcf58deb6f 100644 --- a/homeassistant/components/blink/binary_sensor.py +++ b/homeassistant/components/blink/binary_sensor.py @@ -69,7 +69,7 @@ class BlinkBinarySensor(BinarySensorEntity): model=self._camera.camera_type, ) - def update(self): + def update(self) -> None: """Update sensor state.""" self.data.refresh() state = self._camera.attributes[self.entity_description.key] diff --git a/homeassistant/components/blink/camera.py b/homeassistant/components/blink/camera.py index 429452cf4bd..e500eb79e42 100644 --- a/homeassistant/components/blink/camera.py +++ b/homeassistant/components/blink/camera.py @@ -58,18 +58,18 @@ class BlinkCamera(Camera): """Return the camera attributes.""" return self._camera.attributes - def enable_motion_detection(self): + def enable_motion_detection(self) -> None: """Enable motion detection for the camera.""" self._camera.arm = True self.data.refresh() - def disable_motion_detection(self): + def disable_motion_detection(self) -> None: """Disable motion detection for the camera.""" self._camera.arm = False self.data.refresh() @property - def motion_detection_enabled(self): + def motion_detection_enabled(self) -> bool: """Return the state of the camera.""" return self._camera.arm diff --git a/homeassistant/components/blink/sensor.py b/homeassistant/components/blink/sensor.py index 094fa8aadbb..3940522074b 100644 --- a/homeassistant/components/blink/sensor.py +++ b/homeassistant/components/blink/sensor.py @@ -72,7 +72,7 @@ class BlinkSensor(SensorEntity): model=self._camera.camera_type, ) - def update(self): + def update(self) -> None: """Retrieve sensor data from the camera.""" self.data.refresh() try: diff --git a/homeassistant/components/blockchain/sensor.py b/homeassistant/components/blockchain/sensor.py index 92cd7a56e92..4feb7a9fa6a 100644 --- a/homeassistant/components/blockchain/sensor.py +++ b/homeassistant/components/blockchain/sensor.py @@ -65,6 +65,6 @@ class BlockchainSensor(SensorEntity): self._attr_name = name self.addresses = addresses - def update(self): + def update(self) -> None: """Get the latest state of the sensor.""" self._attr_native_value = get_balance(self.addresses) diff --git a/homeassistant/components/bloomsky/binary_sensor.py b/homeassistant/components/bloomsky/binary_sensor.py index e1d9d830efa..7b59039a89e 100644 --- a/homeassistant/components/bloomsky/binary_sensor.py +++ b/homeassistant/components/bloomsky/binary_sensor.py @@ -58,7 +58,7 @@ class BloomSkySensor(BinarySensorEntity): self._attr_unique_id = f"{self._device_id}-{sensor_name}" self._attr_device_class = SENSOR_TYPES.get(sensor_name) - def update(self): + def update(self) -> None: """Request an update from the BloomSky API.""" self._bloomsky.refresh_devices() diff --git a/homeassistant/components/bloomsky/sensor.py b/homeassistant/components/bloomsky/sensor.py index f064ce992c6..77978e6324d 100644 --- a/homeassistant/components/bloomsky/sensor.py +++ b/homeassistant/components/bloomsky/sensor.py @@ -112,7 +112,7 @@ class BloomSkySensor(SensorEntity): """Return the class of this device, from component DEVICE_CLASSES.""" return SENSOR_DEVICE_CLASS.get(self._sensor_name) - def update(self): + def update(self) -> None: """Request an update from the BloomSky API.""" self._bloomsky.refresh_devices() state = self._bloomsky.devices[self._device_id]["Data"][self._sensor_name] diff --git a/homeassistant/components/bluesound/media_player.py b/homeassistant/components/bluesound/media_player.py index 7f1c6b6553f..53f6de14b3c 100644 --- a/homeassistant/components/bluesound/media_player.py +++ b/homeassistant/components/bluesound/media_player.py @@ -6,6 +6,7 @@ from asyncio import CancelledError from datetime import timedelta from http import HTTPStatus import logging +from typing import Any from urllib import parse import aiohttp @@ -22,6 +23,7 @@ from homeassistant.components.media_player import ( MediaPlayerEntityFeature, ) from homeassistant.components.media_player.browse_media import ( + BrowseMedia, async_process_play_media_url, ) from homeassistant.components.media_player.const import MEDIA_TYPE_MUSIC @@ -333,7 +335,7 @@ class BluesoundPlayer(MediaPlayerEntity): ) raise - async def async_update(self): + async def async_update(self) -> None: """Update internal status of the entity.""" if not self._is_online: return @@ -930,12 +932,12 @@ class BluesoundPlayer(MediaPlayerEntity): while sleep > 0: sleep = await self.async_increase_timer() - async def async_set_shuffle(self, shuffle): + async def async_set_shuffle(self, shuffle: bool) -> None: """Enable or disable shuffle mode.""" value = "1" if shuffle else "0" return await self.send_bluesound_command(f"/Shuffle?state={value}") - async def async_select_source(self, source): + async def async_select_source(self, source: str) -> None: """Select input source.""" if self.is_grouped and not self.is_master: return @@ -958,14 +960,14 @@ class BluesoundPlayer(MediaPlayerEntity): return await self.send_bluesound_command(url) - async def async_clear_playlist(self): + async def async_clear_playlist(self) -> None: """Clear players playlist.""" if self.is_grouped and not self.is_master: return return await self.send_bluesound_command("Clear") - async def async_media_next_track(self): + async def async_media_next_track(self) -> None: """Send media_next command to media player.""" if self.is_grouped and not self.is_master: return @@ -978,7 +980,7 @@ class BluesoundPlayer(MediaPlayerEntity): return await self.send_bluesound_command(cmd) - async def async_media_previous_track(self): + async def async_media_previous_track(self) -> None: """Send media_previous command to media player.""" if self.is_grouped and not self.is_master: return @@ -991,35 +993,37 @@ class BluesoundPlayer(MediaPlayerEntity): return await self.send_bluesound_command(cmd) - async def async_media_play(self): + async def async_media_play(self) -> None: """Send media_play command to media player.""" if self.is_grouped and not self.is_master: return return await self.send_bluesound_command("Play") - async def async_media_pause(self): + async def async_media_pause(self) -> None: """Send media_pause command to media player.""" if self.is_grouped and not self.is_master: return return await self.send_bluesound_command("Pause") - async def async_media_stop(self): + async def async_media_stop(self) -> None: """Send stop command.""" if self.is_grouped and not self.is_master: return return await self.send_bluesound_command("Pause") - async def async_media_seek(self, position): + async def async_media_seek(self, position: float) -> None: """Send media_seek command to media player.""" if self.is_grouped and not self.is_master: return return await self.send_bluesound_command(f"Play?seek={float(position)}") - async def async_play_media(self, media_type, media_id, **kwargs): + async def async_play_media( + self, media_type: str, media_id: str, **kwargs: Any + ) -> None: """Send the play_media command to the media player.""" if self.is_grouped and not self.is_master: return @@ -1036,21 +1040,21 @@ class BluesoundPlayer(MediaPlayerEntity): return await self.send_bluesound_command(url) - async def async_volume_up(self): + async def async_volume_up(self) -> None: """Volume up the media player.""" current_vol = self.volume_level if not current_vol or current_vol >= 1: return return await self.async_set_volume_level(current_vol + 0.01) - async def async_volume_down(self): + async def async_volume_down(self) -> None: """Volume down the media player.""" current_vol = self.volume_level if not current_vol or current_vol <= 0: return return await self.async_set_volume_level(current_vol - 0.01) - async def async_set_volume_level(self, volume): + async def async_set_volume_level(self, volume: float) -> None: """Send volume_up command to media player.""" if volume < 0: volume = 0 @@ -1058,13 +1062,15 @@ class BluesoundPlayer(MediaPlayerEntity): volume = 1 return await self.send_bluesound_command(f"Volume?level={float(volume) * 100}") - async def async_mute_volume(self, mute): + async def async_mute_volume(self, mute: bool) -> None: """Send mute command to media player.""" if mute: return await self.send_bluesound_command("Volume?mute=1") return await self.send_bluesound_command("Volume?mute=0") - async def async_browse_media(self, media_content_type=None, media_content_id=None): + async def async_browse_media( + self, media_content_type: str | None = None, media_content_id: str | None = None + ) -> BrowseMedia: """Implement the websocket media browsing helper.""" return await media_source.async_browse_media( self.hass, diff --git a/homeassistant/components/bosch_shc/switch.py b/homeassistant/components/bosch_shc/switch.py index aa49d873f6f..28b68ac091b 100644 --- a/homeassistant/components/bosch_shc/switch.py +++ b/homeassistant/components/bosch_shc/switch.py @@ -2,6 +2,7 @@ from __future__ import annotations from dataclasses import dataclass +from typing import Any from boschshcpy import ( SHCCamera360, @@ -183,11 +184,11 @@ class SHCSwitch(SHCEntity, SwitchEntity): == self.entity_description.on_value ) - def turn_on(self, **kwargs) -> None: + def turn_on(self, **kwargs: Any) -> None: """Turn the switch on.""" setattr(self._device, self.entity_description.on_key, True) - def turn_off(self, **kwargs) -> None: + def turn_off(self, **kwargs: Any) -> None: """Turn the switch off.""" setattr(self._device, self.entity_description.on_key, False) @@ -218,10 +219,10 @@ class SHCRoutingSwitch(SHCEntity, SwitchEntity): """Return the state of the switch.""" return self._device.routing.name == "ENABLED" - def turn_on(self, **kwargs) -> None: + def turn_on(self, **kwargs: Any) -> None: """Turn the switch on.""" self._device.routing = True - def turn_off(self, **kwargs) -> None: + def turn_off(self, **kwargs: Any) -> None: """Turn the switch off.""" self._device.routing = False diff --git a/homeassistant/components/broadlink/remote.py b/homeassistant/components/broadlink/remote.py index dd0f40d45bc..da72f4fcb06 100644 --- a/homeassistant/components/broadlink/remote.py +++ b/homeassistant/components/broadlink/remote.py @@ -2,9 +2,11 @@ import asyncio from base64 import b64encode from collections import defaultdict +from collections.abc import Iterable from datetime import timedelta from itertools import product import logging +from typing import Any from broadlink.exceptions import ( AuthorizationError, @@ -174,18 +176,18 @@ class BroadlinkRemote(BroadlinkEntity, RemoteEntity, RestoreEntity): """ return self._flags - async def async_added_to_hass(self): + async def async_added_to_hass(self) -> None: """Call when the remote is added to hass.""" state = await self.async_get_last_state() self._attr_is_on = state is None or state.state != STATE_OFF await super().async_added_to_hass() - async def async_turn_on(self, **kwargs): + async def async_turn_on(self, **kwargs: Any) -> None: """Turn on the remote.""" self._attr_is_on = True self.async_write_ha_state() - async def async_turn_off(self, **kwargs): + async def async_turn_off(self, **kwargs: Any) -> None: """Turn off the remote.""" self._attr_is_on = False self.async_write_ha_state() @@ -198,7 +200,7 @@ class BroadlinkRemote(BroadlinkEntity, RemoteEntity, RestoreEntity): self._flags.update(await self._flag_storage.async_load() or {}) self._storage_loaded = True - async def async_send_command(self, command, **kwargs): + async def async_send_command(self, command: Iterable[str], **kwargs: Any) -> None: """Send a list of commands to a device.""" kwargs[ATTR_COMMAND] = command kwargs = SERVICE_SEND_SCHEMA(kwargs) @@ -255,7 +257,7 @@ class BroadlinkRemote(BroadlinkEntity, RemoteEntity, RestoreEntity): if at_least_one_sent: self._flag_storage.async_delay_save(self._get_flags, FLAG_SAVE_DELAY) - async def async_learn_command(self, **kwargs): + async def async_learn_command(self, **kwargs: Any) -> None: """Learn a list of commands from a remote.""" kwargs = SERVICE_LEARN_SCHEMA(kwargs) commands = kwargs[ATTR_COMMAND] @@ -419,7 +421,7 @@ class BroadlinkRemote(BroadlinkEntity, RemoteEntity, RestoreEntity): self.hass, notification_id="learn_command" ) - async def async_delete_command(self, **kwargs): + async def async_delete_command(self, **kwargs: Any) -> None: """Delete a list of commands from a remote.""" kwargs = SERVICE_DELETE_SCHEMA(kwargs) commands = kwargs[ATTR_COMMAND] diff --git a/homeassistant/components/broadlink/switch.py b/homeassistant/components/broadlink/switch.py index d38898a513f..229949b7ee2 100644 --- a/homeassistant/components/broadlink/switch.py +++ b/homeassistant/components/broadlink/switch.py @@ -3,6 +3,7 @@ from __future__ import annotations from abc import ABC, abstractmethod import logging +from typing import Any from broadlink.exceptions import BroadlinkException import voluptuous as vol @@ -146,19 +147,19 @@ class BroadlinkSwitch(BroadlinkEntity, SwitchEntity, RestoreEntity, ABC): self._command_off = command_off self._attr_name = f"{device.name} Switch" - async def async_added_to_hass(self): + async def async_added_to_hass(self) -> None: """Call when the switch is added to hass.""" state = await self.async_get_last_state() self._attr_is_on = state is not None and state.state == STATE_ON await super().async_added_to_hass() - async def async_turn_on(self, **kwargs): + async def async_turn_on(self, **kwargs: Any) -> None: """Turn on the switch.""" if await self._async_send_packet(self._command_on): self._attr_is_on = True self.async_write_ha_state() - async def async_turn_off(self, **kwargs): + async def async_turn_off(self, **kwargs: Any) -> None: """Turn off the switch.""" if await self._async_send_packet(self._command_off): self._attr_is_on = False diff --git a/homeassistant/components/bsblan/climate.py b/homeassistant/components/bsblan/climate.py index 16d8452f10b..7ebcb48f307 100644 --- a/homeassistant/components/bsblan/climate.py +++ b/homeassistant/components/bsblan/climate.py @@ -106,14 +106,14 @@ class BSBLanClimate(ClimateEntity): self._store_hvac_mode = self._attr_hvac_mode await self.async_set_data(preset_mode=preset_mode) - async def async_set_hvac_mode(self, hvac_mode): + async def async_set_hvac_mode(self, hvac_mode: HVACMode) -> None: """Set HVAC mode.""" _LOGGER.debug("Setting HVAC mode to: %s", hvac_mode) # preset should be none when hvac mode is set self._attr_preset_mode = PRESET_NONE await self.async_set_data(hvac_mode=hvac_mode) - async def async_set_temperature(self, **kwargs): + async def async_set_temperature(self, **kwargs: Any) -> None: """Set new target temperatures.""" await self.async_set_data(**kwargs)