Home Assistant Community

Lovelace UI - Conditional Question and Suggested Tweaks

lovelace
Tags: #<Tag:0x00007f374db9a880>
#1

Part question, part observation that might could lead to tweaks in the lovelace code:

First, my zwave climate entities present themselves as modes, so the same thermostat presents a heat and a cooling that is used to interact with the thermostat depending on what the state is, which is ridiculous, but anyways, thats the way it is.

So I’ve used the conditional card in lovelace to show/hide the appropriate entity depending on whether I am on heat or cool or other. The problem is if I change the heat/cool mode, the entity hides, but the new entity will not show unless I either refresh the page or switch views and back.

Can we have a way to auto-refresh when conditionals change on a view? Or, can I call this manually via an automation?

Second, I notice there is some padding around the conditional entities so when certain ones are hidden and the other visible, it throws by cards out of alignment between the left and right stacks by 2-4 px or so. Could be a minor tweak there on how that is handled.

Lastly, the alarm panel entity card when put in a horizontal stack tries to kill itself, so that might need tweaking.

0 Likes

#2

Hello. I’m trying to do what you did with conditionals, and it’s just not working for me. Can you post the yaml code for the conditional card to only show one thermostat at a time?

0 Likes

#3

Here is what I have; the cards are on a Home (default) tab:

title: Home
views:
  - title: Home
    id: home
    icon: mdi:home
    panel: false
    cards:
      - type: vertical-stack
        cards:
          - type: conditional
            conditions:
              - entity: climate.trane_upstairs_cooling
                state_not: "heat"
            card:
              type: thermostat
              entity: climate.trane_upstairs_cooling

          - type: conditional
            conditions:
              - entity: climate.trane_upstairs_heating
                state: "heat"
            card:
              type: thermostat
              entity: climate.trane_upstairs_heating

          - type: conditional
            conditions:
              - entity: climate.trane_downstairs_cooling
                state_not: "heat"
            card:
              type: thermostat
              entity: climate.trane_downstairs_cooling

          - type: conditional
            conditions:
              - entity: climate.trane_downstairs_heating
                state: "heat"
            card:
              type: thermostat
              entity: climate.trane_downstairs_heating
0 Likes

#4

Thanks for this. As I was looking for a solution, someone else pointed me to a custom card that does this. It’s a lot cleaner than this way, and it just works. Just thought you might be interested in it as well. It only took me about 5 minutes to get it all going:

0 Likes

#5

Thanks I will take a look.

I also realized shortly after I posted that my config apparently also does not work/hide after upgrading from .83 to .85! Probably in the breaking changes/notes that I have not fully read yet…

0 Likes

#6

I think the auto migration to the system managed interface vs. yaml file broke what I had been doing before.

That custom lovelace card is perfect. Migrated to that, thanks for the tip!

0 Likes