Is there a way to strip unit of measurement from picture elements card entities?

Just figured this one out, leaving it here in case it’s of use to anyone, as I hadn’t found a post asking this question which gave a satisfying answer, other than to create a template sensor duplicating every one of my temperature sensors.

  - type: custom:config-template-card
    variables:
      - states['sensor.bedroom_temperature'].state 
    entities:
      - sensor.bedroom_temperature
    element:
      type: state-label
      entity: sensor.blank_blank
      prefix: '${vars[0]}'
    style: 
      top: 8%  
      left: 20%

Note that the style for positioning must be applied to the config-template-card, and not the element.

I did have to create one template sensor - a blank, dummy sensor, using the method I found in this post. This allowed me to have a text label (the prefix field), which config-template-card allowed to become a template referencing the value of the temperature sensor.

I wish it was a little neater of a solution, but it beats having a whole bunch of new template sensors with no units cluttering up the entities list.

1 Like