Improve entity type hints [n] (#77824)

This commit is contained in:
epenet 2022-09-05 14:53:55 +02:00 committed by GitHub
parent 42393db9f3
commit 420733a064
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 69 additions and 59 deletions

View File

@ -133,34 +133,34 @@ class NAD(MediaPlayerEntity):
"""Boolean if volume is currently muted.""" """Boolean if volume is currently muted."""
return self._mute return self._mute
def turn_off(self): def turn_off(self) -> None:
"""Turn the media player off.""" """Turn the media player off."""
self._nad_receiver.main_power("=", "Off") self._nad_receiver.main_power("=", "Off")
def turn_on(self): def turn_on(self) -> None:
"""Turn the media player on.""" """Turn the media player on."""
self._nad_receiver.main_power("=", "On") self._nad_receiver.main_power("=", "On")
def volume_up(self): def volume_up(self) -> None:
"""Volume up the media player.""" """Volume up the media player."""
self._nad_receiver.main_volume("+") self._nad_receiver.main_volume("+")
def volume_down(self): def volume_down(self) -> None:
"""Volume down the media player.""" """Volume down the media player."""
self._nad_receiver.main_volume("-") self._nad_receiver.main_volume("-")
def set_volume_level(self, volume): def set_volume_level(self, volume: float) -> None:
"""Set volume level, range 0..1.""" """Set volume level, range 0..1."""
self._nad_receiver.main_volume("=", self.calc_db(volume)) self._nad_receiver.main_volume("=", self.calc_db(volume))
def mute_volume(self, mute): def mute_volume(self, mute: bool) -> None:
"""Mute (true) or unmute (false) media player.""" """Mute (true) or unmute (false) media player."""
if mute: if mute:
self._nad_receiver.main_mute("=", "On") self._nad_receiver.main_mute("=", "On")
else: else:
self._nad_receiver.main_mute("=", "Off") self._nad_receiver.main_mute("=", "Off")
def select_source(self, source): def select_source(self, source: str) -> None:
"""Select input source.""" """Select input source."""
self._nad_receiver.main_source("=", self._reverse_mapping.get(source)) self._nad_receiver.main_source("=", self._reverse_mapping.get(source))
@ -175,7 +175,7 @@ class NAD(MediaPlayerEntity):
return sorted(self._reverse_mapping) return sorted(self._reverse_mapping)
@property @property
def available(self): def available(self) -> bool:
"""Return if device is available.""" """Return if device is available."""
return self._state is not None return self._state is not None
@ -257,37 +257,37 @@ class NADtcp(MediaPlayerEntity):
"""Boolean if volume is currently muted.""" """Boolean if volume is currently muted."""
return self._mute return self._mute
def turn_off(self): def turn_off(self) -> None:
"""Turn the media player off.""" """Turn the media player off."""
self._nad_receiver.power_off() self._nad_receiver.power_off()
def turn_on(self): def turn_on(self) -> None:
"""Turn the media player on.""" """Turn the media player on."""
self._nad_receiver.power_on() self._nad_receiver.power_on()
def volume_up(self): def volume_up(self) -> None:
"""Step volume up in the configured increments.""" """Step volume up in the configured increments."""
self._nad_receiver.set_volume(self._nad_volume + 2 * self._volume_step) self._nad_receiver.set_volume(self._nad_volume + 2 * self._volume_step)
def volume_down(self): def volume_down(self) -> None:
"""Step volume down in the configured increments.""" """Step volume down in the configured increments."""
self._nad_receiver.set_volume(self._nad_volume - 2 * self._volume_step) self._nad_receiver.set_volume(self._nad_volume - 2 * self._volume_step)
def set_volume_level(self, volume): def set_volume_level(self, volume: float) -> None:
"""Set volume level, range 0..1.""" """Set volume level, range 0..1."""
nad_volume_to_set = int( nad_volume_to_set = int(
round(volume * (self._max_vol - self._min_vol) + self._min_vol) round(volume * (self._max_vol - self._min_vol) + self._min_vol)
) )
self._nad_receiver.set_volume(nad_volume_to_set) self._nad_receiver.set_volume(nad_volume_to_set)
def mute_volume(self, mute): def mute_volume(self, mute: bool) -> None:
"""Mute (true) or unmute (false) media player.""" """Mute (true) or unmute (false) media player."""
if mute: if mute:
self._nad_receiver.mute() self._nad_receiver.mute()
else: else:
self._nad_receiver.unmute() self._nad_receiver.unmute()
def select_source(self, source): def select_source(self, source: str) -> None:
"""Select input source.""" """Select input source."""
self._nad_receiver.select_source(source) self._nad_receiver.select_source(source)
@ -301,7 +301,7 @@ class NADtcp(MediaPlayerEntity):
"""List of available input sources.""" """List of available input sources."""
return self._nad_receiver.available_sources() return self._nad_receiver.available_sources()
def update(self): def update(self) -> None:
"""Get the latest details from the device.""" """Get the latest details from the device."""
try: try:
nad_status = self._nad_receiver.status() nad_status = self._nad_receiver.status()

View File

@ -219,7 +219,7 @@ class NSDepartureSensor(SensorEntity):
return attributes return attributes
@Throttle(MIN_TIME_BETWEEN_UPDATES) @Throttle(MIN_TIME_BETWEEN_UPDATES)
def update(self): def update(self) -> None:
"""Get the trip information.""" """Get the trip information."""
# If looking for a specific trip time, update around that trip time only. # If looking for a specific trip time, update around that trip time only.

View File

@ -55,7 +55,7 @@ class NessZoneBinarySensor(BinarySensorEntity):
self._type = zone_type self._type = zone_type
self._state = 0 self._state = 0
async def async_added_to_hass(self): async def async_added_to_hass(self) -> None:
"""Register callbacks.""" """Register callbacks."""
self.async_on_remove( self.async_on_remove(
async_dispatcher_connect( async_dispatcher_connect(

View File

@ -140,11 +140,11 @@ class NetdataSensor(SensorEntity):
return self._state return self._state
@property @property
def available(self): def available(self) -> bool:
"""Could the resource be accessed during the last update call.""" """Could the resource be accessed during the last update call."""
return self.netdata.available return self.netdata.available
async def async_update(self): async def async_update(self) -> None:
"""Get the latest data from Netdata REST API.""" """Get the latest data from Netdata REST API."""
await self.netdata.async_update() await self.netdata.async_update()
resource_data = self.netdata.api.metrics.get(self._sensor) resource_data = self.netdata.api.metrics.get(self._sensor)
@ -186,11 +186,11 @@ class NetdataAlarms(SensorEntity):
return "mdi:crosshairs-question" return "mdi:crosshairs-question"
@property @property
def available(self): def available(self) -> bool:
"""Could the resource be accessed during the last update call.""" """Could the resource be accessed during the last update call."""
return self.netdata.available return self.netdata.available
async def async_update(self): async def async_update(self) -> None:
"""Get the latest alarms from Netdata REST API.""" """Get the latest alarms from Netdata REST API."""
await self.netdata.async_update() await self.netdata.async_update()
alarms = self.netdata.api.alarms["alarms"] alarms = self.netdata.api.alarms["alarms"]

View File

@ -1,5 +1,6 @@
"""Support for Netgear switches.""" """Support for Netgear switches."""
import logging import logging
from typing import Any
from pynetgear import ALLOW, BLOCK from pynetgear import ALLOW, BLOCK
@ -87,12 +88,12 @@ class NetgearAllowBlock(NetgearDeviceEntity, SwitchEntity):
"""Return true if switch is on.""" """Return true if switch is on."""
return self._state return self._state
async def async_turn_on(self, **kwargs): async def async_turn_on(self, **kwargs: Any) -> None:
"""Turn the switch on.""" """Turn the switch on."""
await self._router.async_allow_block_device(self._mac, ALLOW) await self._router.async_allow_block_device(self._mac, ALLOW)
await self.coordinator.async_request_refresh() await self.coordinator.async_request_refresh()
async def async_turn_off(self, **kwargs): async def async_turn_off(self, **kwargs: Any) -> None:
"""Turn the switch off.""" """Turn the switch off."""
await self._router.async_allow_block_device(self._mac, BLOCK) await self._router.async_allow_block_device(self._mac, BLOCK)
await self.coordinator.async_request_refresh() await self.coordinator.async_request_refresh()

View File

@ -4,6 +4,7 @@ from __future__ import annotations
from collections import namedtuple from collections import namedtuple
from datetime import timedelta from datetime import timedelta
import logging import logging
from typing import Any
from pynetio import Netio from pynetio import Netio
import voluptuous as vol import voluptuous as vol
@ -148,15 +149,15 @@ class NetioSwitch(SwitchEntity):
return self._name return self._name
@property @property
def available(self): def available(self) -> bool:
"""Return true if entity is available.""" """Return true if entity is available."""
return not hasattr(self, "telnet") return not hasattr(self, "telnet")
def turn_on(self, **kwargs): def turn_on(self, **kwargs: Any) -> None:
"""Turn switch on.""" """Turn switch on."""
self._set(True) self._set(True)
def turn_off(self, **kwargs): def turn_off(self, **kwargs: Any) -> None:
"""Turn switch off.""" """Turn switch off."""
self._set(False) self._set(False)
@ -172,6 +173,6 @@ class NetioSwitch(SwitchEntity):
"""Return the switch's status.""" """Return the switch's status."""
return self.netio.states[int(self.outlet) - 1] return self.netio.states[int(self.outlet) - 1]
def update(self): def update(self) -> None:
"""Update the state.""" """Update the state."""
self.netio.update() self.netio.update()

View File

@ -177,7 +177,7 @@ class NeurioEnergy(SensorEntity):
"""Icon to use in the frontend, if any.""" """Icon to use in the frontend, if any."""
return ICON return ICON
def update(self): def update(self) -> None:
"""Get the latest data, update state.""" """Get the latest data, update state."""
self.update_sensor() self.update_sensor()

View File

@ -1,6 +1,8 @@
"""Support for Nexia / Trane XL thermostats.""" """Support for Nexia / Trane XL thermostats."""
from __future__ import annotations from __future__ import annotations
from typing import Any
from nexia.const import ( from nexia.const import (
HOLD_PERMANENT, HOLD_PERMANENT,
HOLD_RESUME_SCHEDULE, HOLD_RESUME_SCHEDULE,
@ -195,7 +197,7 @@ class NexiaZone(NexiaThermostatZoneEntity, ClimateEntity):
"""Return the fan setting.""" """Return the fan setting."""
return self._thermostat.get_fan_mode() return self._thermostat.get_fan_mode()
async def async_set_fan_mode(self, fan_mode): async def async_set_fan_mode(self, fan_mode: str) -> None:
"""Set new target fan mode.""" """Set new target fan mode."""
await self._thermostat.set_fan_mode(fan_mode) await self._thermostat.set_fan_mode(fan_mode)
self._signal_thermostat_update() self._signal_thermostat_update()
@ -216,7 +218,7 @@ class NexiaZone(NexiaThermostatZoneEntity, ClimateEntity):
"""Preset that is active.""" """Preset that is active."""
return self._zone.get_preset() return self._zone.get_preset()
async def async_set_humidity(self, humidity): async def async_set_humidity(self, humidity: int) -> None:
"""Dehumidify target.""" """Dehumidify target."""
if self._thermostat.has_dehumidify_support(): if self._thermostat.has_dehumidify_support():
await self.async_set_dehumidify_setpoint(humidity) await self.async_set_dehumidify_setpoint(humidity)
@ -303,7 +305,7 @@ class NexiaZone(NexiaThermostatZoneEntity, ClimateEntity):
return NEXIA_TO_HA_HVAC_MODE_MAP[mode] return NEXIA_TO_HA_HVAC_MODE_MAP[mode]
async def async_set_temperature(self, **kwargs): async def async_set_temperature(self, **kwargs: Any) -> None:
"""Set target temperature.""" """Set target temperature."""
new_heat_temp = kwargs.get(ATTR_TARGET_TEMP_LOW) new_heat_temp = kwargs.get(ATTR_TARGET_TEMP_LOW)
new_cool_temp = kwargs.get(ATTR_TARGET_TEMP_HIGH) new_cool_temp = kwargs.get(ATTR_TARGET_TEMP_HIGH)
@ -364,27 +366,27 @@ class NexiaZone(NexiaThermostatZoneEntity, ClimateEntity):
attrs[ATTR_HUMIDIFY_SETPOINT] = humdify_setpoint attrs[ATTR_HUMIDIFY_SETPOINT] = humdify_setpoint
return attrs return attrs
async def async_set_preset_mode(self, preset_mode: str): async def async_set_preset_mode(self, preset_mode: str) -> None:
"""Set the preset mode.""" """Set the preset mode."""
await self._zone.set_preset(preset_mode) await self._zone.set_preset(preset_mode)
self._signal_zone_update() self._signal_zone_update()
async def async_turn_aux_heat_off(self): async def async_turn_aux_heat_off(self) -> None:
"""Turn Aux Heat off.""" """Turn Aux Heat off."""
await self._thermostat.set_emergency_heat(False) await self._thermostat.set_emergency_heat(False)
self._signal_thermostat_update() self._signal_thermostat_update()
async def async_turn_aux_heat_on(self): async def async_turn_aux_heat_on(self) -> None:
"""Turn Aux Heat on.""" """Turn Aux Heat on."""
self._thermostat.set_emergency_heat(True) self._thermostat.set_emergency_heat(True)
self._signal_thermostat_update() self._signal_thermostat_update()
async def async_turn_off(self): async def async_turn_off(self) -> None:
"""Turn off the zone.""" """Turn off the zone."""
await self.async_set_hvac_mode(OPERATION_MODE_OFF) await self.async_set_hvac_mode(OPERATION_MODE_OFF)
self._signal_zone_update() self._signal_zone_update()
async def async_turn_on(self): async def async_turn_on(self) -> None:
"""Turn on the zone.""" """Turn on the zone."""
await self.async_set_hvac_mode(OPERATION_MODE_AUTO) await self.async_set_hvac_mode(OPERATION_MODE_AUTO)
self._signal_zone_update() self._signal_zone_update()

View File

@ -169,7 +169,7 @@ class NextBusDepartureSensor(SensorEntity):
"""Return additional state attributes.""" """Return additional state attributes."""
return self._attributes return self._attributes
def update(self): def update(self) -> None:
"""Update sensor with new departures times.""" """Update sensor with new departures times."""
# Note: using Multi because there is a bug with the single stop impl # Note: using Multi because there is a bug with the single stop impl
results = self._client.get_predictions_for_multi_stops( results = self._client.get_predictions_for_multi_stops(

View File

@ -53,6 +53,6 @@ class NextcloudBinarySensor(BinarySensorEntity):
"""Return the unique ID for this binary sensor.""" """Return the unique ID for this binary sensor."""
return f"{self.hass.data[DOMAIN]['instance']}#{self._name}" return f"{self.hass.data[DOMAIN]['instance']}#{self._name}"
def update(self): def update(self) -> None:
"""Update the binary sensor.""" """Update the binary sensor."""
self._is_on = self.hass.data[DOMAIN][self._name] self._is_on = self.hass.data[DOMAIN][self._name]

View File

@ -53,6 +53,6 @@ class NextcloudSensor(SensorEntity):
"""Return the unique ID for this sensor.""" """Return the unique ID for this sensor."""
return f"{self.hass.data[DOMAIN]['instance']}#{self._name}" return f"{self.hass.data[DOMAIN]['instance']}#{self._name}"
def update(self): def update(self) -> None:
"""Update the sensor.""" """Update the sensor."""
self._state = self.hass.data[DOMAIN][self._name] self._state = self.hass.data[DOMAIN][self._name]

View File

@ -153,7 +153,9 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
@staticmethod @staticmethod
@callback @callback
def async_get_options_flow(config_entry): def async_get_options_flow(
config_entry: config_entries.ConfigEntry,
) -> OptionsFlowHandler:
"""Get the options flow for this handler.""" """Get the options flow for this handler."""
return OptionsFlowHandler(config_entry) return OptionsFlowHandler(config_entry)

View File

@ -158,7 +158,7 @@ class NMBSLiveBoard(SensorEntity):
return attrs return attrs
def update(self): def update(self) -> None:
"""Set the state equal to the next departure.""" """Set the state equal to the next departure."""
liveboard = self._api_client.get_liveboard(self._station) liveboard = self._api_client.get_liveboard(self._station)
@ -278,7 +278,7 @@ class NMBSSensor(SensorEntity):
return "vias" in self._attrs and int(self._attrs["vias"]["number"]) > 0 return "vias" in self._attrs and int(self._attrs["vias"]["number"]) > 0
def update(self): def update(self) -> None:
"""Set the state to the duration of a connection.""" """Set the state to the duration of a connection."""
connections = self._api_client.get_connections( connections = self._api_client.get_connections(
self._station_from, self._station_to self._station_from, self._station_to

View File

@ -130,7 +130,7 @@ class NOAATidesAndCurrentsSensor(SensorEntity):
return f"Low tide at {tidetime}" return f"Low tide at {tidetime}"
return None return None
def update(self): def update(self) -> None:
"""Get the latest data from NOAA Tides and Currents API.""" """Get the latest data from NOAA Tides and Currents API."""
begin = datetime.now() begin = datetime.now()
delta = timedelta(days=2) delta = timedelta(days=2)

View File

@ -2,6 +2,7 @@
from datetime import datetime from datetime import datetime
import logging import logging
import time import time
from typing import Any
from nuheat.config import SCHEDULE_HOLD, SCHEDULE_RUN, SCHEDULE_TEMPORARY_HOLD from nuheat.config import SCHEDULE_HOLD, SCHEDULE_RUN, SCHEDULE_TEMPORARY_HOLD
from nuheat.util import ( from nuheat.util import (
@ -100,7 +101,7 @@ class NuHeatThermostat(CoordinatorEntity, ClimateEntity):
return self._thermostat.room return self._thermostat.room
@property @property
def temperature_unit(self): def temperature_unit(self) -> str:
"""Return the unit of measurement.""" """Return the unit of measurement."""
if self._temperature_unit == "C": if self._temperature_unit == "C":
return TEMP_CELSIUS return TEMP_CELSIUS
@ -121,7 +122,7 @@ class NuHeatThermostat(CoordinatorEntity, ClimateEntity):
return self._thermostat.serial_number return self._thermostat.serial_number
@property @property
def available(self): def available(self) -> bool:
"""Return the unique id.""" """Return the unique id."""
return self.coordinator.last_update_success and self._thermostat.online return self.coordinator.last_update_success and self._thermostat.online
@ -178,7 +179,7 @@ class NuHeatThermostat(CoordinatorEntity, ClimateEntity):
"""Return available preset modes.""" """Return available preset modes."""
return PRESET_MODES return PRESET_MODES
def set_preset_mode(self, preset_mode): def set_preset_mode(self, preset_mode: str) -> None:
"""Update the hold mode of the thermostat.""" """Update the hold mode of the thermostat."""
self._set_schedule_mode( self._set_schedule_mode(
PRESET_MODE_TO_SCHEDULE_MODE_MAP.get(preset_mode, SCHEDULE_RUN) PRESET_MODE_TO_SCHEDULE_MODE_MAP.get(preset_mode, SCHEDULE_RUN)
@ -191,7 +192,7 @@ class NuHeatThermostat(CoordinatorEntity, ClimateEntity):
self._thermostat.schedule_mode = schedule_mode self._thermostat.schedule_mode = schedule_mode
self._schedule_update() self._schedule_update()
def set_temperature(self, **kwargs): def set_temperature(self, **kwargs: Any) -> None:
"""Set a new target temperature.""" """Set a new target temperature."""
self._set_temperature_and_mode( self._set_temperature_and_mode(
kwargs.get(ATTR_TEMPERATURE), hvac_mode=kwargs.get(ATTR_HVAC_MODE) kwargs.get(ATTR_TEMPERATURE), hvac_mode=kwargs.get(ATTR_HVAC_MODE)

View File

@ -54,7 +54,7 @@ class NukiDoorsensorEntity(NukiEntity, BinarySensorEntity):
return data return data
@property @property
def available(self): def available(self) -> bool:
"""Return true if door sensor is present and activated.""" """Return true if door sensor is present and activated."""
return super().available and self._nuki_device.is_door_sensor_activated return super().available and self._nuki_device.is_door_sensor_activated

View File

@ -92,7 +92,7 @@ class NumatoGpioBinarySensor(BinarySensorEntity):
self._state = None self._state = None
self._api = api self._api = api
async def async_added_to_hass(self): async def async_added_to_hass(self) -> None:
"""Connect state update callback.""" """Connect state update callback."""
self.async_on_remove( self.async_on_remove(
async_dispatcher_connect( async_dispatcher_connect(
@ -118,7 +118,7 @@ class NumatoGpioBinarySensor(BinarySensorEntity):
"""Return the state of the entity.""" """Return the state of the entity."""
return self._state != self._invert_logic return self._state != self._invert_logic
def update(self): def update(self) -> None:
"""Update the GPIO state.""" """Update the GPIO state."""
try: try:
self._state = self._api.read_input(self._device_id, self._port) self._state = self._api.read_input(self._device_id, self._port)

View File

@ -102,7 +102,7 @@ class NumatoGpioAdc(SensorEntity):
"""Return the icon to use in the frontend, if any.""" """Return the icon to use in the frontend, if any."""
return ICON return ICON
def update(self): def update(self) -> None:
"""Get the latest data and updates the state.""" """Get the latest data and updates the state."""
try: try:
adc_val = self._api.read_adc_input(self._device_id, self._port) adc_val = self._api.read_adc_input(self._device_id, self._port)

View File

@ -2,6 +2,7 @@
from __future__ import annotations from __future__ import annotations
import logging import logging
from typing import Any
from numato_gpio import NumatoGpioError from numato_gpio import NumatoGpioError
@ -88,7 +89,7 @@ class NumatoGpioSwitch(SwitchEntity):
"""Return true if port is turned on.""" """Return true if port is turned on."""
return self._state return self._state
def turn_on(self, **kwargs): def turn_on(self, **kwargs: Any) -> None:
"""Turn the port on.""" """Turn the port on."""
try: try:
self._api.write_output( self._api.write_output(
@ -104,7 +105,7 @@ class NumatoGpioSwitch(SwitchEntity):
err, err,
) )
def turn_off(self, **kwargs): def turn_off(self, **kwargs: Any) -> None:
"""Turn the port off.""" """Turn the port off."""
try: try:
self._api.write_output( self._api.write_output(

View File

@ -109,7 +109,7 @@ class NWSSensor(CoordinatorEntity, SensorEntity):
return f"{base_unique_id(self._latitude, self._longitude)}_{self.entity_description.key}" return f"{base_unique_id(self._latitude, self._longitude)}_{self.entity_description.key}"
@property @property
def available(self): def available(self) -> bool:
"""Return if state is available.""" """Return if state is available."""
if self.coordinator.last_update_success_time: if self.coordinator.last_update_success_time:
last_success_time = ( last_success_time = (

View File

@ -269,7 +269,7 @@ class NWSWeather(WeatherEntity):
return f"{base_unique_id(self.latitude, self.longitude)}_{self.mode}" return f"{base_unique_id(self.latitude, self.longitude)}_{self.mode}"
@property @property
def available(self): def available(self) -> bool:
"""Return if state is available.""" """Return if state is available."""
last_success = ( last_success = (
self.coordinator_observation.last_update_success self.coordinator_observation.last_update_success
@ -289,7 +289,7 @@ class NWSWeather(WeatherEntity):
last_success_time = False last_success_time = False
return last_success or last_success_time return last_success or last_success_time
async def async_update(self): async def async_update(self) -> None:
"""Update the entity. """Update the entity.
Only used by the generic entity update service. Only used by the generic entity update service.

View File

@ -1,6 +1,8 @@
"""Support for NZBGet switches.""" """Support for NZBGet switches."""
from __future__ import annotations from __future__ import annotations
from typing import Any
from homeassistant.components.switch import SwitchEntity from homeassistant.components.switch import SwitchEntity
from homeassistant.config_entries import ConfigEntry from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_NAME from homeassistant.const import CONF_NAME
@ -61,12 +63,12 @@ class NZBGetDownloadSwitch(NZBGetEntity, SwitchEntity):
"""Return the state of the switch.""" """Return the state of the switch."""
return not self.coordinator.data["status"].get("DownloadPaused", False) return not self.coordinator.data["status"].get("DownloadPaused", False)
async def async_turn_on(self, **kwargs) -> None: async def async_turn_on(self, **kwargs: Any) -> None:
"""Set downloads to enabled.""" """Set downloads to enabled."""
await self.hass.async_add_executor_job(self.coordinator.nzbget.resumedownload) await self.hass.async_add_executor_job(self.coordinator.nzbget.resumedownload)
await self.coordinator.async_request_refresh() await self.coordinator.async_request_refresh()
async def async_turn_off(self, **kwargs) -> None: async def async_turn_off(self, **kwargs: Any) -> None:
"""Set downloads to paused.""" """Set downloads to paused."""
await self.hass.async_add_executor_job(self.coordinator.nzbget.pausedownload) await self.hass.async_add_executor_job(self.coordinator.nzbget.pausedownload)
await self.coordinator.async_request_refresh() await self.coordinator.async_request_refresh()