before cleanup
This commit is contained in:
@@ -33,13 +33,14 @@ async def async_setup(hass, config):
|
||||
"""Setup example component."""
|
||||
|
||||
async def async_set_half_service(service):
|
||||
entity_ids = await async_extract_entity_ids(hass, service, expand_group=True)
|
||||
entity_ids = await async_extract_entity_ids(service, expand_group=True)
|
||||
for entity_id in entity_ids:
|
||||
if not entity_id.startswith(f"{COVER_DOMAIN}."):
|
||||
state = hass.states.get(entity_id)
|
||||
if not entity_id.startswith(f"{COVER_DOMAIN}.") or state is None:
|
||||
continue
|
||||
data = {
|
||||
ATTR_ENTITY_ID: entity_id,
|
||||
ATTR_POSITION: hass.states.get(entity_id).attributes.get(ATTR_HALF_POSITION, 20)
|
||||
ATTR_POSITION: state.attributes.get(ATTR_HALF_POSITION, 20)
|
||||
}
|
||||
await hass.services.async_call(COVER_DOMAIN, SERVICE_SET_COVER_POSITION, data)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user