diff --git a/homeassistant/components/fibaro/binary_sensor.py b/homeassistant/components/fibaro/binary_sensor.py index 3c423dc0ce8..359869efc25 100644 --- a/homeassistant/components/fibaro/binary_sensor.py +++ b/homeassistant/components/fibaro/binary_sensor.py @@ -1,6 +1,8 @@ """Support for Fibaro binary sensors.""" from __future__ import annotations +from typing import Any + from homeassistant.components.binary_sensor import ( ENTITY_ID_FORMAT, BinarySensorDeviceClass, @@ -49,7 +51,7 @@ async def async_setup_entry( class FibaroBinarySensor(FibaroDevice, BinarySensorEntity): """Representation of a Fibaro Binary Sensor.""" - def __init__(self, fibaro_device): + def __init__(self, fibaro_device: Any) -> None: """Initialize the binary_sensor.""" super().__init__(fibaro_device) self.entity_id = ENTITY_ID_FORMAT.format(self.ha_id) @@ -62,6 +64,6 @@ class FibaroBinarySensor(FibaroDevice, BinarySensorEntity): self._attr_device_class = SENSOR_TYPES[stype][2] self._attr_icon = SENSOR_TYPES[stype][1] - def update(self): + def update(self) -> None: """Get the latest data and update the state.""" self._attr_is_on = self.current_binary_state diff --git a/homeassistant/components/fibaro/switch.py b/homeassistant/components/fibaro/switch.py index fe2b35866b0..66aad4d673b 100644 --- a/homeassistant/components/fibaro/switch.py +++ b/homeassistant/components/fibaro/switch.py @@ -1,6 +1,8 @@ """Support for Fibaro switches.""" from __future__ import annotations +from typing import Any + from homeassistant.components.switch import ENTITY_ID_FORMAT, SwitchEntity from homeassistant.config_entries import ConfigEntry from homeassistant.const import Platform @@ -31,27 +33,21 @@ async def async_setup_entry( class FibaroSwitch(FibaroDevice, SwitchEntity): """Representation of a Fibaro Switch.""" - def __init__(self, fibaro_device): + def __init__(self, fibaro_device: Any) -> None: """Initialize the Fibaro device.""" - self._state = False super().__init__(fibaro_device) self.entity_id = ENTITY_ID_FORMAT.format(self.ha_id) - def turn_on(self, **kwargs): + def turn_on(self, **kwargs: Any) -> None: """Turn device on.""" self.call_turn_on() - self._state = True + self._attr_is_on = True - def turn_off(self, **kwargs): + def turn_off(self, **kwargs: Any) -> None: """Turn device off.""" self.call_turn_off() - self._state = False + self._attr_is_on = False - @property - def is_on(self): - """Return true if device is on.""" - return self._state - - def update(self): + def update(self) -> None: """Update device state.""" - self._state = self.current_binary_state + self._attr_is_on = self.current_binary_state