mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
Don't add RainMachine restriction switches if underlying data is missing (#80502)
This commit is contained in:
parent
b09e95431c
commit
cee8f2cabb
@ -34,7 +34,7 @@ from .model import (
|
||||
RainMachineEntityDescriptionMixinDataKey,
|
||||
RainMachineEntityDescriptionMixinUid,
|
||||
)
|
||||
from .util import RUN_STATE_MAP
|
||||
from .util import RUN_STATE_MAP, key_exists
|
||||
|
||||
ATTR_AREA = "area"
|
||||
ATTR_CS_ON = "cs_on"
|
||||
@ -237,6 +237,8 @@ async def async_setup_entry(
|
||||
|
||||
# Add switches to control restrictions:
|
||||
for description in RESTRICTIONS_SWITCH_DESCRIPTIONS:
|
||||
if not key_exists(coordinator.data, description.data_key):
|
||||
continue
|
||||
entities.append(RainMachineRestrictionSwitch(entry, data, description))
|
||||
|
||||
async_add_entities(entities)
|
||||
|
Loading…
x
Reference in New Issue
Block a user