question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Repeating options not working for attributes

See original GitHub issue

Using the https://github.com/thomasloven/lovelace-auto-entities#repeating-options does not work as expected for my case.

What I want to achieve: Reduce lines of code.

I have

type: 'custom:auto-entities'
card:
  type: entities
  title: "Open doors, windows etc."
  state_color: true
  show_header_toggle: false
filter:
  include:
    - domain: binary_sensor
      attributes:
        device_class: door
      state: 'on'
      options:
        secondary_info: last-changed
    - domain: binary_sensor
      attributes:
        device_class: window
      state: 'on'
      options:
        secondary_info: last-changed
    - domain: binary_sensor
      attributes:
        device_class: garage_door
      state: 'on'
      options:
        secondary_info: last-changed
    - domain: binary_sensor
      attributes:
        device_class: lock
      state: 'on'
      options:
        secondary_info: last-changed
  exclude: null
show_empty: false
unique: true
sort:
  method: last_changed
  reverse: true

So instead of having a full block with same filter options (domain is always binary_sensor, state is always on, options are always the same, only attribute device_class is different) I wanted to use the repeating options as documented at https://github.com/thomasloven/lovelace-auto-entities#repeating-options.

BUT it does not work. Doesn´t matter what kind of syntax I use, I end up with a card not showing up at all. I really tried everything.

NO:

    - domain: binary_sensor
      attributes:
        device_class 1: door
        device_class 2: window
      state: 'on'
      options:
        secondary_info: last-changed

NO:

    - domain: binary_sensor
      attributes:
        - device_class 1: door
          device_class 2: window
      state: 'on'
      options:
        secondary_info: last-changed

NO:

    - domain: binary_sensor
      attributes:
        - device_class 1: door
        - device_class 2: window
      state: 'on'
      options:
        secondary_info: last-changed

NO:

    - domain: binary_sensor
      - attributes 1:
        device_class:
      - attributes 2:
        device_class 2: window
      state: 'on'
      options:
        secondary_info: last-changed

Does this not work for attributes? Or am I doing something wrong (syntax)? How to shrink this?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
thomaslovencommented, May 18, 2021

Try

domain: binary_sensor
or:
  - attributes:
      device_class 1: door
  - attributes:
      device_class 2: window
state: 'on'
options:
  secondary_info: last-changed
0reactions
bcuttercommented, May 22, 2021

That worked like a charm - thanks a lot Thomas! Awesome 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

'create variations from all attributes' not working properly
On clicking 'create variations from all attributes' all the variations are NOT getting created. In fact it also created duplicate variations.
Read more >
AngularJS. When select have ng-model attribute, ng-selected ...
The question: How to make option selected, when I'm using the model? Here is my plunker ( selected not working here). My code:...
Read more >
Why are there duplicate attributes for a local option set in our ...
In our Development environment, we recently changed the values of a local option set. The labels stayed the same.
Read more >
Duplicate attributes, options and actions (on the same product ...
Since the two attributes are sharing the same options, you can set them once and then copy them for the second attribute by...
Read more >
Limit on repeating attributes - Documentum - OpenText Forums
Hi All, We are using D 6.5 SP1 running on AIX 6.1 and Oracle 11g.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found