mirror of
https://github.com/elisspace/core.git
synced 2026-09-30 22:39:55 +00:00
Improve entity type hints [r] (#77874)
This commit is contained in:
@@ -58,7 +58,7 @@ class RainCloudBinarySensor(RainCloudEntity, BinarySensorEntity):
|
||||
"""Return true if the binary sensor is on."""
|
||||
return self._state
|
||||
|
||||
def update(self):
|
||||
def update(self) -> None:
|
||||
"""Get the latest data and updates the state."""
|
||||
_LOGGER.debug("Updating RainCloud sensor: %s", self._name)
|
||||
self._state = getattr(self.data, self._sensor_type)
|
||||
|
||||
@@ -66,7 +66,7 @@ class RainCloudSensor(RainCloudEntity, SensorEntity):
|
||||
"""Return the units of measurement."""
|
||||
return UNIT_OF_MEASUREMENT_MAP.get(self._sensor_type)
|
||||
|
||||
def update(self):
|
||||
def update(self) -> None:
|
||||
"""Get the latest data and updates the states."""
|
||||
_LOGGER.debug("Updating RainCloud sensor: %s", self._name)
|
||||
if self._sensor_type == "battery":
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
@@ -68,7 +69,7 @@ class RainCloudSwitch(RainCloudEntity, SwitchEntity):
|
||||
"""Return true if device is on."""
|
||||
return self._state
|
||||
|
||||
def turn_on(self, **kwargs):
|
||||
def turn_on(self, **kwargs: Any) -> None:
|
||||
"""Turn the device on."""
|
||||
if self._sensor_type == "manual_watering":
|
||||
self.data.watering_time = self._default_watering_timer
|
||||
@@ -76,7 +77,7 @@ class RainCloudSwitch(RainCloudEntity, SwitchEntity):
|
||||
self.data.auto_watering = True
|
||||
self._state = True
|
||||
|
||||
def turn_off(self, **kwargs):
|
||||
def turn_off(self, **kwargs: Any) -> None:
|
||||
"""Turn the device off."""
|
||||
if self._sensor_type == "manual_watering":
|
||||
self.data.watering_time = "off"
|
||||
@@ -84,7 +85,7 @@ class RainCloudSwitch(RainCloudEntity, SwitchEntity):
|
||||
self.data.auto_watering = False
|
||||
self._state = False
|
||||
|
||||
def update(self):
|
||||
def update(self) -> None:
|
||||
"""Update device state."""
|
||||
_LOGGER.debug("Updating RainCloud switch: %s", self._name)
|
||||
if self._sensor_type == "manual_watering":
|
||||
|
||||
Reference in New Issue
Block a user