HADashboard - sensor with 2 units value

Hi,

I have a running widget sensor, showing 2 values and it works fine. Except that I miss an argument for adding °C to my value (and it’s not auto transported from HA)

LivingRoom
58.1%
19.1 [can’t place °C here]

tempwoonkamer:
    widget_type: sensor
    entity: sensor.living_room_sensor_2
    sub_entity: sensor.living_room_sensor_3
    title: Woonkamer
    title_style: "color: lightblue; font-size: 150%; font-weight: bold;"
    widget_style: "background: linear-gradient(to bottom, rgba(22,123,191,1) 0%,rgba(0,57,132,1) 100%);"
    value_style: "color: #FFAA01; font-size: 200%;"
    state_text_style: "color: #FFAA01; font-size: 200%;"
    units: "%"
    unit_style: "color: lightblue; font-size: 150%; font-weight: bold;"

This attribute doesn’t exist: sub_entity_units

Tried to “hack” it via CSS “after” code - got it to work if I manually edit the compiled css but that gets lots on each refresh
state_text::after { content: ' °C';}

I’m trying to avoid to change the py code since that part is in Docker and would get overwritten on the next refresh.

Any hints would be welcome.

Did you try:

unit_of_measurement: ‘°C’

You have a few options.

@ReneTode may have other ideas, as he is much more knowledgeable about HADashboard than I am.

that is the easiest option.

there is no unit_of_measurement for sub_states.
sub_state is added later on by someone else for different reasons then to show 2 sensor states.

in the future we will have a widget that can show as many entity states as you like.
ill make sure that unit of measurement is added there.

Oh, sorry. My fault. Learned again something new. :wink:

Ignore the below - I was able to make it (so far) as a template sensor. (and just realized @ ReneTode suggested the same!)

sensor:
  - platform: template
    sensors:
      temp_living_room:
        friendly_name: Living Room Temp
        value_template: "{{ states.sensor.living_room_sensor_3.state }} °C  |  {{ states.sensor.living_room_sensor_2.state}} %"

I need help… I can’t figure it out (as I lack coding logic skills). I tried many different examples but I can’t crack it.

This doesn’t work. And this closest example I found wouldn’t do exaclty what I want as I can’t figure out how to concatenate values and unit of measure… I’m simply trying to get this as result:

12°C - 52%

```
sensor:
- platform: template
sensors:
weather_temperature:>-
friendly_name:‘Living Room Temp’
unit_of_measurement:‘°C - %’
value_template:
" {{ float(states(‘sensor.living_room_sensor_3’)) }} "
" {{ float(states(‘sensor.living_room_sensor_2’)) }} "

</s> <s>This only outputs an error</s> <s>
Error loading /config/configuration.yaml: mapping values are not allowed here
in “/config/configuration.yaml”, line 132, column 23
```
Thanks

i wouldnt combine them but you can.
but i think i would try it like this:

        unit_of_measurement:''
        value_template:
             " {{ float(states('sensor.living_room_sensor_3')) }}°C - {{ float(states('sensor.living_room_sensor_2')) }}% "