Template YAML content in card visibility?

I have a card set up with the following YAML. How can I modify the visibility section to look at the full calculated value instead of just one device’s value? I read through https://www.home-assistant.io/dashboards/conditional/#yaml-configuration and the forums and didn’t find anyone talking about this.

I only want my main dashboard to show unknown power draw when it’s above a certain value.

I could make a sensor that does the same calculation, but I’d rather wait for the official Home Assistant sensor since they’re already calculating it on the Energy dashboard.

type: markdown
content: >-
  {{( (states("sensor.balance_power_minute_average") | float) - 
  (states("sensor.back_roof_heat_power") | float) -
  (states("sensor.tofsmygga_plug_3613_2_power") | float)
   ) | round(0)}}
grid_options:
  columns: 6
  rows: auto
visibility:
  - condition: numeric_state
    entity: sensor.balance_power_minute_average
    above: 50

Two options:

  1. Have a helper so you can use that state in visibility
  2. Use a custom solution that allows templating hidden state directly. This is possible with UIX Forge, which is part of UI eXtension.
1 Like