Skip to content

Allow area, device, and entity selectors to optionally support multiple selections like target selector#11059

Closed
r-t-s wants to merge 1 commit intohome-assistant:devfrom
r-t-s:entity_selector
Closed

Allow area, device, and entity selectors to optionally support multiple selections like target selector#11059
r-t-s wants to merge 1 commit intohome-assistant:devfrom
r-t-s:entity_selector

Conversation

@r-t-s
Copy link
Copy Markdown

@r-t-s r-t-s commented Dec 31, 2021

Proposed change

Changes to the Area, Device, and Entity selectors to allow them to select multiple entities.
The user interface is similar to the Area, Device and Entity selector component of the target selector.
Single or multi select is configured with the optional multiple option on the selector configuration.
The selectors can now potentially return a list of area, device, or entity IDs.

This is motivated by the need to have multiple entity selector so a blueprint can trigger on multiple entities.
But brings a consistent UI for the Area, Device, Entity, and Target selector.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (thank you!)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Example configuration

blueprint:
  name: Test Selectors
  description: This is used to test the variois Selectors
  domain: automation
  source_url: https://github.com/home-assistant/core/blob/dev/homeassistant/components/automation/blueprints/test.yaml
  input:
    target_selector:
      name: My Target Selector
      selector:
        target:
    entity_selector:
      name: My Entity Selector
      selector:
        entity:
          multiple: True
    area_selector:
      name: My Area Selector
      selector:
        area:
          multiple: True
          device:
            model: Forecast
    device_selector:
      name: My Device Selector
      selector:
        device:
          multiple: True

mode: single
max_exceeded: silent

trigger:
  platform: state
  entity_id: !input entity_selector

action:
    delay: 30

Additional information

Associated core PR #63138

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue or discussion:
  • Link to documentation pull request: #20961

Checklist

  • The code change is tested and works locally.
  • There is no commented out code in this PR.
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

return html``;
}
return html`
<div class="mdc-chip-set items">
Copy link
Copy Markdown
Member

@balloob balloob Feb 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this code needs to be generalized. This is now copy pasted 3 times?

I think it might benefit it we start with a single selector in this PR instead of trying to do entity, device and areas in one PR.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about a single selector file with a common base class and 4 specializations (Target, Area, Device, Entity) ?
Then we have the existing Area, Device and Entity pickers that are called from the selectors.

@r-t-s
Copy link
Copy Markdown
Author

r-t-s commented Apr 15, 2022

When I noticed the merge conflicts I also noticed that much of the work of this PULL request has already been completed.
i.e. the selection support for multiple Entities, Areas, and Devices.
One difference is that this PULL request tried to unify the style of the UI for Target, Area, Entity, and Device selectors.
Should I continue this effort or NOT ?

@zsarnett
Copy link
Copy Markdown
Contributor

PRobably be easier to start from scratch with the new code. This is something we want to do eventually so if you would like to do these one at a time then that would be great!

@balloob
Copy link
Copy Markdown
Member

balloob commented Apr 15, 2022

So one thing we have been considering (but didn't get to) is to unify the look of targets, area, device and entity picker to all look like targets. That would be something to pursue.

@r-t-s r-t-s closed this Apr 15, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Apr 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants