From 6ebf19c4ba2472d318b238be2b68595943f1a723 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Thu, 19 Feb 2026 14:29:39 +0100 Subject: [PATCH] Use shorthand attribute in danfoss_air switch (#163486) --- homeassistant/components/danfoss_air/switch.py | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/homeassistant/components/danfoss_air/switch.py b/homeassistant/components/danfoss_air/switch.py index 5e7c5728d81..c30dc3fac83 100644 --- a/homeassistant/components/danfoss_air/switch.py +++ b/homeassistant/components/danfoss_air/switch.py @@ -59,21 +59,10 @@ class DanfossAir(SwitchEntity): def __init__(self, data, name, state_command, on_command, off_command): """Initialize the switch.""" self._data = data - self._name = name + self._attr_name = name self._state_command = state_command self._on_command = on_command self._off_command = off_command - self._state = None - - @property - def name(self): - """Return the name of the switch.""" - return self._name - - @property - def is_on(self): - """Return true if switch is on.""" - return self._state def turn_on(self, **kwargs: Any) -> None: """Turn the switch on.""" @@ -89,6 +78,6 @@ class DanfossAir(SwitchEntity): """Update the switch's state.""" self._data.update() - self._state = self._data.get_value(self._state_command) - if self._state is None: + self._attr_is_on = self._data.get_value(self._state_command) + if self._attr_is_on is None: _LOGGER.debug("Could not get data for %s", self._state_command)