Lovelace: mini graph card

Hi there,

I have some graphs showing my PC’s usage with data drawn from HASS.Agent. When the PC is off, it shows NaN as the entities are unavailable. How can I go about making it display “OFF” when the PC isn’t running?

My initial thought is to make a template sensor for each one that returns OFF when NaN and the entity_id when the state is available, but if there’s a better way to go about it I’d like to get some insight. Many thanks.

image

Make it a template boolean sensor. Everything where state returns >= 0 is “On”, and all other “Off”.

would that then populate the entities field? That would just return a 1 or 0 instead of the entity as a string, wouldn’t it?
What about this:

  - platform: template
    sensors:
      cpu_available:
        state: >
        {% if not is_state('sensor.pc_cpuload', 'unavailable') %}
          'sensor.pc_cpuload'
        {% else %}
          "OFF"
        {% endif %}

and this populates the entities field