Skip to content

Commit

Permalink
Remove single use vars for service and attrs
Browse files Browse the repository at this point in the history
  • Loading branch information
mill1000 committed Nov 2, 2023
1 parent 43b7a5c commit 4196172
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions custom_components/midea_ac/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,6 @@
HVACMode.AUTO: AC.OperationalMode.AUTO,
}

_ATTR_FOLLOW_ME = "follow_me"
_SERVICE_SET_FOLLOW_ME = "set_follow_me"
_SERVICE_SET_FOLLOW_ME_SCHEMA = {
vol.Required(CONF_ENABLED): cv.boolean,
}


async def async_setup_entry(
hass: HomeAssistant,
Expand All @@ -76,8 +70,10 @@ async def async_setup_entry(
if helpers.property_exists(coordinator.device, "follow_me"):
platform = entity_platform.async_get_current_platform()
platform .async_register_entity_service(
_SERVICE_SET_FOLLOW_ME,
_SERVICE_SET_FOLLOW_ME_SCHEMA,
"set_follow_me",
{
vol.Required(CONF_ENABLED): cv.boolean,
},
"async_set_follow_me",
)

Expand Down Expand Up @@ -227,7 +223,7 @@ def extra_state_attributes(self) -> dict[str, str]:
state_attributes = {}

if hasattr(self._device, "follow_me"):
state_attributes[_ATTR_FOLLOW_ME] = getattr(
state_attributes["follow_me"] = getattr(
self._device, "follow_me")

return state_attributes
Expand Down

0 comments on commit 4196172

Please sign in to comment.