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

Hide_if does not work with switch or helper #108

Closed
tanker11 opened this issue Oct 25, 2022 · 17 comments
Closed

Hide_if does not work with switch or helper #108

tanker11 opened this issue Oct 25, 2022 · 17 comments
Labels
bug Something isn't working

Comments

@tanker11
Copy link

Which version of Room Card?
1.07.00

Describe the bug
Hide_if works well with light.xxx entities, but won't with input_boolean.xxx (created by HA in helpers section) or switch.xxx entities created in Node-Red.

To Reproduce
Steps to reproduce the behavior:

Create a Room Card containing the below type of hide_if:
rows:

  • entities:
    • entity: light.0e_ceiling_light
      name: Ceiling
      show_icon: true
      tap_action:
      action: toggle
    • entity: light.0e_mirror_light
      name: Mirror
      icon: mdi:mirror-rectangle
      show_icon: true
      tap_action:
      action: toggle
      hide_if:
      conditions:
      • condition: equals
        entity: switch.visibility_0e
        value: 'on'

Expected behavior
It should work with any boolean type of entities, not only with one (some) of them.

Desktop (please complete the following information):

OS: Win10
Browser Firefox
Version 105.03
HA: Home Assistant 2022.10.1 (Docker)
Room Card installed via HACS

@tanker11 tanker11 added the bug Something isn't working label Oct 25, 2022
@marcokreeft87
Copy link
Owner

Does it give you an error? Because its working here:

image

@tanker11
Copy link
Author

tanker11 commented Oct 25, 2022 via email

@tanker11
Copy link
Author

tanker11 commented Oct 25, 2022 via email

@marcokreeft87
Copy link
Owner

What are the states the switch can have?

@tanker11
Copy link
Author

tanker11 commented Oct 25, 2022 via email

@marcokreeft87
Copy link
Owner

marcokreeft87 commented Oct 25, 2022

'on' and 'off', same for all entities I tested. Update: I realized that hide_if for the row works only with entities that are already in on the card. It won't work with others 'outside' of the card's scope. Is this a desired behavior? For me it would mean to add an entity only because I want to control the visibility... Marco Kreeft @.> ezt írta (időpont: 2022. okt. 25., K, 12:35):

What are the states the switch can have? — Reply to this email directly, view it on GitHub <#108 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHVM6O43F5X4SGPGKZLFPQLWE6ZWZANCNFSM6AAAAAARNY62NQ . You are receiving this because you authored the thread.Message ID: @.
>

It will work with every entity within Home Assistant. I think it got something to do with the enitiy you are using. Since you report it is working with a light entity. The card call hass to get the state or attribute value so it doest make any difference in type of entity. There are multiple users of room card that use this functionality, it even is unit tested on every release. As long as I can't reproduce I can't fix it for you. So I hate to say it, but the only one who can fix this issue for you, is you.

Or provide me with more data, but I don't see how

@lyczko
Copy link

lyczko commented Oct 26, 2022

Also don't work for me.
I don't have any error but they don't hide anything.
Try with many domains light/sensor/switch an with many variables.
It works first time, when i use your example code, and never again later.

`type: custom:room-card
title: SALON
entity: light.salon_standard
icon: mdi:lightbulb-outline
show_icon: true
tap_action:
action: toggle
entities:

  • entity: light.salon_komoda
    name: Komoda
    tap_action:
    action: toggle
    hide_if:
    entity: light.salon_komoda
    state: 'off'
  • entity: light.salon_1
    name: test
    tap_action:
    action: toggle
    `
    image

@marcokreeft87
Copy link
Owner

marcokreeft87 commented Oct 26, 2022

Also don't work for me. I don't have any error but they don't hide anything. Try with many domains light/sensor/switch an with many variables. It works first time, when i use your example code, and never again later.

`type: custom:room-card title: SALON entity: light.salon_standard icon: mdi:lightbulb-outline show_icon: true tap_action: action: toggle entities:

  • entity: light.salon_komoda
    name: Komoda
    tap_action:
    action: toggle
    hide_if:
    entity: light.salon_komoda
    state: 'off'
  • entity: light.salon_1
    name: test
    tap_action:
    action: toggle
    `

Thats because you didnt use the example code:

entity: light.salon_komoda
name: Komoda
tap_action:
action: toggle
hide_if:
  conditions:
    - condition: equals
      value: 'off' 

This should work

@lyczko
Copy link

lyczko commented Oct 26, 2022

Yep, this version works.
I used your examples from wiki , and i am wrong understanding this:

entities:
- entity: light.mancave
name: Ceiling
hide_if:
entity: sensor.light_unavailable
state: true
tap_action:
action: toggle

Thanks. Good Job!

@marcokreeft87
Copy link
Owner

Yep, this version works. I used your examples from wiki , and i am wrong understanding this:

entities: - entity: light.mancave name: Ceiling hide_if: entity: sensor.light_unavailable state: true tap_action: action: toggle

Thanks. Good Job!

Ah yeah, that needed to be updated. Sorry about that

@tanker11
Copy link
Author

tanker11 commented Oct 26, 2022 via email

@marcokreeft87
Copy link
Owner

I also made further tests, I can confirm if the entity is on the card, it will work with hide_if. If not, it won't. Marco Kreeft @.> ezt írta (időpont: 2022. okt. 26., Sze, 14:37):

Yep, this version works. I used your examples from wiki , and i am wrong understanding this: entities: - entity: light.mancave name: Ceiling hide_if: entity: sensor.light_unavailable state: true tap_action: action: toggle Thanks. Good Job! Ah yeah, that needed to be updated. Sorry about that — Reply to this email directly, view it on GitHub <#108 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHVM6OYWU4RTOLQZQNVWGZDWFEQX3ANCNFSM6AAAAAARNY62NQ . You are receiving this because you authored the thread.Message ID: @.
>

Show me

@MattFryer
Copy link

I also have had the issue where I could only hide based on an entity already in the room card. I've found a work around for now which might be helpful to others.

In my use case I have an input boolean I use to toggle if the holiday lights (christmas tree, outside lights, etc) are up. I then use this to control if automations for them should run and to hide them in the UI when they aren't.

I was trying this but it didn't work because the input_boolean wasn't in the card as an entity in itself:

  • entity: light.christmas_tree_lights
    name: Christmas Tree
    hide_if:
    conditions:
    - condition: equals
    entity: input_boolean.holiday_lights
    value: 'off'

I added the input_boolean as an info_entity and the above then worked as expected. I then tried setting the input_boolean info_entity with a hide condition that always made it hidden as follows:

info_entities:

  • entity: input_boolean.holiday_lights
    hide_if:
    conditions:
    - condition: not_equals
    value: hide_always

This hid the info_entity but didn't stop the hide_if on the light entity working. This seems like a work around at least for now.

@marcokreeft87
Copy link
Owner

I also have had the issue where I could only hide based on an entity already in the room card. I've found a work around for now which might be helpful to others.

In my use case I have an input boolean I use to toggle if the holiday lights (christmas tree, outside lights, etc) are up. I then use this to control if automations for them should run and to hide them in the UI when they aren't.

I was trying this but it didn't work because the input_boolean wasn't in the card as an entity in itself:

  • entity: light.christmas_tree_lights
    name: Christmas Tree
    hide_if:
    conditions:
    • condition: equals
      entity: input_boolean.holiday_lights
      value: 'off'

I added the input_boolean as an info_entity and the above then worked as expected. I then tried setting the input_boolean info_entity with a hide condition that always made it hidden as follows:

info_entities:

  • entity: input_boolean.holiday_lights
    hide_if:
    conditions:
    • condition: not_equals
      value: hide_always

This hid the info_entity but didn't stop the hide_if on the light entity working. This seems like a work around at least for now.

Yes I fixed a similar issue with icon conditions. I wanted to fix this for hide_if also but due to a very busy schedule I forgot.
I will put this on the todo list.

FYI: The entity doesnt need to be on the card. The only reason that helps is because every entity on the card will trigger an update of the card when it changes state. Since the card isnt including the entities used in hide_if currently, only a refresh of the page, or your workaround will help refresh the card.

@marcokreeft87
Copy link
Owner

@MattFryer can you please make a seperate bug for your issue? That will help me do administration and dont forget

@marcokreeft87
Copy link
Owner

@MattFryer can you check out v1.07.03? That should fix your problem

@MattFryer
Copy link

@marcokreeft87 sorry, only just seen the message about making another bug report. Just tested and v1.07.03 fixed the issue for me. Works perfectly without the work around.

Thanks for the quick turn around!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants