diff --git a/homeassistant/components/homematic/binary_sensor.py b/homeassistant/components/homematic/binary_sensor.py index 4d8b4178f54..e2090b74ce8 100644 --- a/homeassistant/components/homematic/binary_sensor.py +++ b/homeassistant/components/homematic/binary_sensor.py @@ -59,7 +59,7 @@ class HMBinarySensor(HMDevice, BinarySensorEntity): """Representation of a binary HomeMatic device.""" @property - def is_on(self): + def is_on(self) -> bool: """Return true if switch is on.""" if not self.available: return False @@ -73,7 +73,7 @@ class HMBinarySensor(HMDevice, BinarySensorEntity): return BinarySensorDeviceClass.MOTION return SENSOR_TYPES_CLASS.get(self._hmdevice.__class__.__name__) - def _init_data_struct(self): + def _init_data_struct(self) -> None: """Generate the data dictionary (self._data) from metadata.""" # Add state to data struct if self._state: @@ -86,11 +86,11 @@ class HMBatterySensor(HMDevice, BinarySensorEntity): _attr_device_class = BinarySensorDeviceClass.BATTERY @property - def is_on(self): + def is_on(self) -> bool: """Return True if battery is low.""" return bool(self._hm_get_state()) - def _init_data_struct(self): + def _init_data_struct(self) -> None: """Generate the data dictionary (self._data) from metadata.""" # Add state to data struct if self._state: diff --git a/homeassistant/components/homematic/climate.py b/homeassistant/components/homematic/climate.py index 28943774b6c..096ad76db11 100644 --- a/homeassistant/components/homematic/climate.py +++ b/homeassistant/components/homematic/climate.py @@ -178,7 +178,7 @@ class HMThermostat(HMDevice, ClimateEntity): # Homematic return self._data.get("CONTROL_MODE") - def _init_data_struct(self): + def _init_data_struct(self) -> None: """Generate a data dict (self._data) from the Homematic metadata.""" self._state = next(iter(self._hmdevice.WRITENODE.keys())) self._data[self._state] = None diff --git a/homeassistant/components/homematic/cover.py b/homeassistant/components/homematic/cover.py index b9f4a4fa96a..f93d92eed56 100644 --- a/homeassistant/components/homematic/cover.py +++ b/homeassistant/components/homematic/cover.py @@ -78,7 +78,7 @@ class HMCover(HMDevice, CoverEntity): """Stop the device if in motion.""" self._hmdevice.stop(self._channel) - def _init_data_struct(self): + def _init_data_struct(self) -> None: """Generate a data dictionary (self._data) from metadata.""" self._state = "LEVEL" self._data.update({self._state: None}) @@ -138,7 +138,7 @@ class HMGarage(HMCover): """Return whether the cover is closed.""" return self._hmdevice.is_closed(self._hm_get_state()) - def _init_data_struct(self): + def _init_data_struct(self) -> None: """Generate a data dictionary (self._data) from metadata.""" self._state = "DOOR_STATE" self._data.update({self._state: None}) diff --git a/homeassistant/components/homematic/entity.py b/homeassistant/components/homematic/entity.py index 3b5d2ebb509..3e4d6a6fc71 100644 --- a/homeassistant/components/homematic/entity.py +++ b/homeassistant/components/homematic/entity.py @@ -204,7 +204,7 @@ class HMDevice(Entity): self._init_data_struct() @abstractmethod - def _init_data_struct(self): + def _init_data_struct(self) -> None: """Generate a data dictionary from the HomeMatic device metadata.""" diff --git a/homeassistant/components/homematic/light.py b/homeassistant/components/homematic/light.py index 838cdc9c3c3..62ce1cc9457 100644 --- a/homeassistant/components/homematic/light.py +++ b/homeassistant/components/homematic/light.py @@ -51,7 +51,7 @@ class HMLight(HMDevice, LightEntity): _attr_max_color_temp_kelvin = 6500 # 153 Mireds @property - def brightness(self): + def brightness(self) -> int | None: """Return the brightness of this light between 0..255.""" # Is dimmer? if self._state == "LEVEL": @@ -59,7 +59,7 @@ class HMLight(HMDevice, LightEntity): return None @property - def is_on(self): + def is_on(self) -> bool: """Return true if light is on.""" try: return self._hm_get_state() > 0 @@ -98,7 +98,7 @@ class HMLight(HMDevice, LightEntity): return features @property - def hs_color(self): + def hs_color(self) -> tuple[float, float] | None: """Return the hue and saturation color value [float, float].""" if ColorMode.HS not in self.supported_color_modes: return None @@ -116,14 +116,14 @@ class HMLight(HMDevice, LightEntity): ) @property - def effect_list(self): + def effect_list(self) -> list[str] | None: """Return the list of supported effects.""" if not self.supported_features & LightEntityFeature.EFFECT: return None return self._hmdevice.get_effect_list() @property - def effect(self): + def effect(self) -> str | None: """Return the current color change program of the light.""" if not self.supported_features & LightEntityFeature.EFFECT: return None @@ -166,7 +166,7 @@ class HMLight(HMDevice, LightEntity): self._hmdevice.off(self._channel) - def _init_data_struct(self): + def _init_data_struct(self) -> None: """Generate a data dict (self._data) from the Homematic metadata.""" # Use LEVEL self._state = "LEVEL" diff --git a/homeassistant/components/homematic/lock.py b/homeassistant/components/homematic/lock.py index b79f28f2bc7..7640146b422 100644 --- a/homeassistant/components/homematic/lock.py +++ b/homeassistant/components/homematic/lock.py @@ -48,7 +48,7 @@ class HMLock(HMDevice, LockEntity): """Open the door latch.""" self._hmdevice.open() - def _init_data_struct(self): + def _init_data_struct(self) -> None: """Generate the data dictionary (self._data) from metadata.""" self._state = "STATE" self._data.update({self._state: None}) diff --git a/homeassistant/components/homematic/sensor.py b/homeassistant/components/homematic/sensor.py index bdd446d7091..0ddc319626e 100644 --- a/homeassistant/components/homematic/sensor.py +++ b/homeassistant/components/homematic/sensor.py @@ -339,7 +339,7 @@ class HMSensor(HMDevice, SensorEntity): # No cast, return original value return self._hm_get_state() - def _init_data_struct(self): + def _init_data_struct(self) -> None: """Generate a data dictionary (self._data) from metadata.""" if self._state: self._data.update({self._state: None}) diff --git a/homeassistant/components/homematic/switch.py b/homeassistant/components/homematic/switch.py index 5f7c1f93dc8..ac8a2e5fe14 100644 --- a/homeassistant/components/homematic/switch.py +++ b/homeassistant/components/homematic/switch.py @@ -35,7 +35,7 @@ class HMSwitch(HMDevice, SwitchEntity): """Representation of a HomeMatic switch.""" @property - def is_on(self): + def is_on(self) -> bool: """Return True if switch is on.""" try: return self._hm_get_state() > 0 @@ -43,7 +43,7 @@ class HMSwitch(HMDevice, SwitchEntity): return False @property - def today_energy_kwh(self): + def today_energy_kwh(self) -> float | None: """Return the current power usage in kWh.""" if "ENERGY_COUNTER" in self._data: try: @@ -61,7 +61,7 @@ class HMSwitch(HMDevice, SwitchEntity): """Turn the switch off.""" self._hmdevice.off(self._channel) - def _init_data_struct(self): + def _init_data_struct(self) -> None: """Generate the data dictionary (self._data) from metadata.""" self._state = "STATE" self._data.update({self._state: None})