Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FR: allow entity_id for numeric state trigger #242

Closed
Mariusthvdb opened this issue Jan 6, 2022 · 2 comments
Closed

FR: allow entity_id for numeric state trigger #242

Mariusthvdb opened this issue Jan 6, 2022 · 2 comments

Comments

@Mariusthvdb
Copy link

Mariusthvdb commented Jan 6, 2022

please consider allowing a config like:

        filter:
          include:
            - entity_id: sensor.*_actueel
              state: '> input_number.power_threshold' # or states('input_number.power_threshold')

which would prevent some more complex templating (including iterating over all states.sensor.), like:

        filter:
          template: >
            {% set threshold = states('input_number.power_threshold')|float %}
            {% set ns = namespace(above_threshold=[]) %}
            {% for s in states.sensor
             |selectattr('entity_id', 'search', '_actueel')
             if s.state|float > threshold %}
            {% set ns.above_threshold = ns.above_threshold + [s.entity_id] %}
            {% endfor %}
            {{ns.above_threshold}}

https://www.home-assistant.io/docs/automation/trigger/#numeric-state-trigger allow us to do that since some time, would be great if auto-entities could follow suit in that regard.

@thomasloven
Copy link
Owner

Templates are very heavy lifting for the frontend. That's why there's only a single template filter which will have to do everything.

@Mariusthvdb
Copy link
Author

Mariusthvdb commented Feb 19, 2022

maybe I didnt phrase correctly, but I didnt mean to ask for templating, I was thinking to these numeric triggers:

automation:
  trigger:
    - platform: numeric_state
      entity_id: sensor.temperature

to be used as:

        filter:
          include:
            - state: '> input_number.power_threshold'

bw, I am seeing a lot of:

Unhandled Promise Rejection: TypeError: t.startsWith is not a function. (In 't.startsWith("$$")', 't.startsWith' is undefined)

Schermafbeelding 2022-02-20 om 17 03 19

and I havent found a specific card yet, because it throws on many views....

as simple as:

  - type: custom:auto-entities
    card:
      type: entities
      title: Hue groups
      show_header_toggle: false
    show_empty: false
    filter:
      include:
        - attributes:
            is_hue_group: true

yep thats is, all config with attributes are erroring:

      exclude:
        - attributes:
            last_triggered: null

or

          not:
            attributes:
              current: 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants