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

Feature request: add condition element to hide entry based on templated condition #278

Open
titiviking opened this issue Dec 29, 2022 · 9 comments

Comments

@titiviking
Copy link

Allow for adding conditional element that displays or hides the complete multiple-entity-row from the dashboard based on the specified condition.

Currently the "Conditional Entity" type does not support attributes, but only entity states.
A condition element in this multiple-entity-row would allow to also use templates to use attributes or more complex condition statements.

@akomelj
Copy link

akomelj commented Jan 7, 2023

A pull request with a narrower scope is in #280.

It does not implement templating (which would be better, of course) but allows for setting two additional options for hide_if configuration object:

  • entity, and
  • attribute

The named entity's state or attribute will be evaluated against value/below/above condition when set.

UPDATED: Not to claim credit - hiding by attribute value has already been implemented; it was just not mentioned in the documentation.

@Evililim
Copy link

Can you make an exemple of hiding_by with an other entity state ?
I can't find the correct YAML :

      - entity: switch.wake_on_lan
        name: Wake On Lan
        hide_if:
          - entity: sensor.my_pc_state
            state: on

@akomelj
Copy link

akomelj commented Jan 16, 2023

Please use the same keys (value, below, above) as with the original version. The new keys entity and attribute just set the pointer to the value that should be evaluated when hiding/showing the entity.

Example:

  - entity: sensor.fireplace_pump_speed
    name: Pump
    hide_if:
      entity: fan.fireplace_pump_fan
      value: "off"

@Evililim
Copy link

the hide_if don't work in my config... I will do some tests to understand...

      - entity: switch.wake_on_lan
        name: false
        show_icon: true
        icon: mdi:power
        hide_if:
          entity: sensor.my_pc_state
          value: 'on'

@hmakmur
Copy link

hmakmur commented Jan 31, 2023

If this hide_if feature actually work, can someone add an example on the documentation? I have the same issue and can not get the correct yaml either. Thanks!

@akomelj
Copy link

akomelj commented Jan 31, 2023

Pull request is on a feature branch. You have to install the Javascript manually and provide a gzipped version too.

Something in the lines of (use correct path depending on your Home Assistant installation):

$ cd /config/www/community/lovelace-multiple-entity-row
$ curl -O https://raw.githubusercontent.com/akomelj/lovelace-multiple-entity-row/feature/hide-if-entity/multiple-entity-row.js
$ gzip -c multiple-entity-row.js > multiple-entity-row.js.gz

I have just run these commands, cleared the browser cache, reloaded the Lovelace and hide_if example from a few comments above works as intended.

$ ls -l multiple-entity-row.js multiple-entity-row.js.gz
-rw-r--r-- 1 andrej andrej 36073 jan 31 19:46 multiple-entity-row.js
-rw-r--r-- 1 andrej andrej 11906 jan 31 19:47 multiple-entity-row.js.gz

$ sha256sum multiple-entity-row.js multiple-entity-row.js.gz
1cba1ec64cdc4649d2b435e795676dea8b7996ed39b07f6c1b16d6a29a588ee8  multiple-entity-row.js
11440aade20aa6993e56f4842e39221fb27475d53bd8883de273a164ad29efd8  multiple-entity-row.js.gz

@hmakmur
Copy link

hmakmur commented Feb 1, 2023

Thank you Andrej for your quick responds. I spend more time last night, followed your instructions but was unable to make it work. I may be doing this with incorrect syntax but I tried a few combinations and it still failed to hide.
I was trying to hide the "distance" attribute from Espresense sensor but it did not work.

  - entity: sensor.ble_iphonedad
    secondary_info: last-updated
    type: custom:multiple-entity-row
    name: BLE_iPhoneDad
    entities:
      - attribute: distance
        unit: m
        hide_if:
          entity: sensor.ble_iphonedad
          value: "not_home"

@TheNightmanX
Copy link

Any progress here to get this feature request and the associated pull request done? I would need this feature, too, but am unable to contribute due to lack of programming skills.

@miguelarios
Copy link

Any progress on this? I really like this card, but want to hide the entire entity based on a state of the entity itself.

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

6 participants