Use more state attribute name constants (#40428)
This commit is contained in:
1 parent
f78391ce2a
commit
5e90a4d000
36 files changed
+231
-156
No files matched your search
@@ -5,6 +5,7 @@ import voluptuous as vol
|
||||
|
||||
from homeassistant.const import (
|
||||
ATTR_ENTITY_ID,
|
||||
ATTR_SUPPORTED_FEATURES,
|
||||
CONF_DEVICE_ID,
|
||||
CONF_DOMAIN,
|
||||
CONF_ENTITY_ID,
|
||||
@@ -61,7 +62,7 @@ async def async_get_actions(hass: HomeAssistant, device_id: str) -> List[dict]:
|
||||
CONF_TYPE: "set_hvac_mode",
|
||||
}
|
||||
)
|
||||
if state.attributes["supported_features"] & const.SUPPORT_PRESET_MODE:
|
||||
if state.attributes[ATTR_SUPPORTED_FEATURES] & const.SUPPORT_PRESET_MODE:
|
||||
actions.append(
|
||||
{
|
||||
CONF_DEVICE_ID: device_id,
|
||||
|
||||
@@ -5,6 +5,7 @@ import voluptuous as vol
|
||||
|
||||
from homeassistant.const import (
|
||||
ATTR_ENTITY_ID,
|
||||
ATTR_SUPPORTED_FEATURES,
|
||||
CONF_CONDITION,
|
||||
CONF_DEVICE_ID,
|
||||
CONF_DOMAIN,
|
||||
@@ -63,7 +64,10 @@ async def async_get_conditions(
|
||||
}
|
||||
)
|
||||
|
||||
if state and state.attributes["supported_features"] & const.SUPPORT_PRESET_MODE:
|
||||
if (
|
||||
state
|
||||
and state.attributes[ATTR_SUPPORTED_FEATURES] & const.SUPPORT_PRESET_MODE
|
||||
):
|
||||
conditions.append(
|
||||
{
|
||||
CONF_CONDITION: "device",
|
||||
|
||||
Reference in new issue
Block a user