Combine Temperature and Humidity in one sensor for display

Hi,

I want to add a new entity (That I can put as “text” in a Mushroom chips card as display).

This is how it is supposed to look, Screenshot 2023-03-03 at 12.05.44

I did this with some Text and the mushroom-template-card. However, I want to use an entity Card for example, or the Mushroom chip card to dispaly the value *Temperature | Humidity" as one sensor / Text value.

Could you help me out here please? This is what I got:

template:
 - sensor:
        - name: "thermosensor1"
          state: >
           {{ {{states('sensor.feuchtigkeitssensor1_temperature')}}  C° | {{states('sensor.feuchtigkeitssensor1_humidity')}} %  }}
            
            

Thanks for any help in advance!

one example here using template-card with second information , seems to be same as you want:

type: custom:mushroom-template-card
primary: Salon
layout: vertical
tap_action:
  action: navigate
  navigation_path: living
icon: mdi:sofa
secondary: '{{ states(''sensor.hue_motion_sensor_salon_table_temperature'') }} °C'
icon_color: |-
  {% if is_state('light.salon','on') %}
     amber
  {% endif %} 
1 Like

Hei! Thank you so much for your fast response!

Yeah the Issue is, we use it on our floorplan, and there I seem to not be able to customize the template card:

 - type: custom:mushroom-template-card
        primary: >-
          {{states('sensor.feuchtigkeitssensor1_temperature') }} C° I
          {{states('sensor.feuchtigkeitssensor1_humidity') }} %  
        secondary: ''
        icon: mdi:thermometer
        fill_container: true
        card_mod:
          style: |

            ha-card {
              
              height: 1.0vw!important;
              background: white;
              padding:0px;
              font-size: 2px;
              --primary-text-color: black;
              width:13.0vw!important;
            }
            :host{
                top: 25%;
                left: 36%;
                width: 20%;
                font-size: 14px;
             }

Here he wont take the font-size… Seems off topic here sorry :frowning:

Now it looks like this but when i make the window smaller the template card gets unreadable and some text is cut off:

If I understanf correctly, you use ha-floorplan in hacs with custom:mushroom-template-card and card_mod to modify the layout.

Basically, if you want to display a long text/value sensor, how the ha-floorplan is managing it ?

I see this reco:

Currently I use the template card, correctly! The Floorplan it self scales perfectly because the whole dasboard is a “panel” layout :wink: above that I am layering the entity cards and so on, and here now the template-card. But I want to use the Chip-Card because it looks sleeker and I can adapt it more easy. Therefore I need to combine the sensor.yxTemperature and sensor.yxHumidity into one text sensor. Is this possible with my posted code? Thanks!

Something like this : (to try in the configuration.yaml)

  - platform: template
    sensors:
      thermosensor1:
       value_template: >
        {{states('sensor.feuchtigkeitssensor1_temperature')}}  C° | {{states('sensor.feuchtigkeitssensor1_humidity')}} %

image

1 Like

thanks!

Sadly I get this error:

    - sensor:
        - name: "thermosensor1"
          value_template: >
            {{states('sensor.feuchtigkeitssensor1_temperature')}}  C° | {{states('sensor.feuchtigkeitssensor1_humidity')}} %
                

My code is:

    - sensor:
        - name: "thermosensor1"
          value_template: >
            {{states('sensor.feuchtigkeitssensor1_temperature')}}  C° | {{states('sensor.feuchtigkeitssensor1_humidity')}} %
                

What am I missing?

I didn’t get your last message, seems you wrote twice the same and I don’t see the error.

Take my code provided in the last message of yesterday and put this in your configuration.yaml but sorry I forgot that my test is in sensor: !include sensor.yaml, so you need to add one extra line on top and indent

sensor:
Then my code indented correctly

But that I’m not sure. I’m always confused when it’s not directly in configuration.yaml

Try first the code ,if nok then add with sensor on top

Sorry, I copied the code twice as you said, Are you using the legacy format of template sensors? Because that is what it seems. The value_template is not available for me when not using the legacy format I think… Trying something now

Indeed, it’s legacy.

In documentation: this example is nearly the same. It should works

template:
  - sensor:
      - name: "Sun State"
        state: >
          {% if is_state('sun.sun', 'above_horizon') %}
            up
          {% else %}
            down
          {% endif %}


If someone else got the same problem, here is how to combine two sensor values in the new format:

template:
    - sensor:
        - name: "thermosensor1"
          state: "{{states('sensor.feuchtigkeitssensor1_temperature')}}  C° | {{states('sensor.feuchtigkeitssensor1_humidity')}} %"

Hope this helps anyone that has the same issue!

2023-03-06_14h27_14

2 Likes

Good to know that you find a way.
As it in one line, it’s indeed needed to put under ".

1 Like

Hi,

i’ve tested your solution but for me the sensor stay as unknow, any idea ?

template:
    - sensor:
        - name: "thermosensor1"
          state: "{{states('sensor.temperature_bureau_adrien_temperature')}}  C° | {{states('sensor.temperature_bureau_adrien_humidity')}} %"
2 Likes

anyone know how i to add graph history when clicking/pressing on the temp/hum?