Hero Tile show some of the data

HI,

Is there a way that i can only show some of the data that is coming across from Home Assistant in a tile?

this is what is been sent but i only want to show the value inc vat “20.0655” in the tile

value_exc_vat: 19.11
value_inc_vat: 20.0655
valid_from: ‘2022-04-28T17:00:00+00:00’
valid_to: ‘2022-04-28T17:30:00+00:00’
tariff_code: E-1R-OE-FIX-24M-21-07-30-A

Many thanks in advance

Are those each individual states of the entity? If so, they should get exposed as individual ‘attributes’ of the Thing within SharpTools and you should be able to use the Hero Attribute tile to pick which attribute you want displayed:

Alternatively, if you want to mix and match data from that device along with other data (from that device, other devices, or variables), the Super Tile might be interesting to you.

there not no its all in one state, there are two states which are been exposed as individual attributes but this is just in one.

i did look at Super Tile but could not work it out there either

I believe the Home Assistant solution would be to use a Template Sensor and get a part of the existing state using a substring.

You’d probably get the best support from the Home Assistant community on how to use a Template Sensor and grab a substring, but from a quick bit of playing around, the following worked (replace the static myvalue definition with a reference to your entity state):

Template:

{% 
set myvalue = "value_exc_vat: 19.11
value_inc_vat: 20.0655
valid_from: ‘2022-04-28T17:00:00+00:00’
valid_to: ‘2022-04-28T17:30:00+00:00’
tariff_code: E-1R-OE-FIX-24M-21-07-30-A" 
%}

{% for line in myvalue.split("\n") %}
  {% if 'value_inc_vat' in line.split(":")[0] %}
     {{ line.split(":")[1] }}
  {% endif %}
{% endfor %}

Result:

20.0655

And it looks like you would update your YAML file with something like:

template:
    - sensor:
        - name: "sensor_demo"
          state: >
          {{ your template here }}

Thank you Josh great advice as normal :slight_smile:

1 Like