Combining two different cards in one card

I am completely dumb when it comes to YAML coding, so I am trying to get help here.

I have one card showing if my phone is Home or Away based on device_tracker. The entity name is ‘device_tracker.erics_samsung_flip5’.

I also have one card showing in which room the phone is based on Bermuda BLE Trilateration. The entity name is ‘sensor.bermuda_eric_area’.

I have different rooms defined as areas, and the ‘sensor.bermuda_eric_area’ do show up correctly.

They both work separately, but how can I get them on the same card, so that it:

  • shows Away when ‘device_tracker.erics_samsung_flip5’ is not in the Home zone
  • shows in what room it is when ‘device_tracker.erics_samsung_flip5’ is in the Home zone

Advice is much appreciated. thank you!

The easiest way would be to create a combined template sensor. The entity ids you supplied make it very easy to give you an example config for this, :+1:

configuration.yaml

template:
  - sensor:
      - name: "Erics Phone Location"
        icon: >
          {% if is_state('device_tracker.erics_samsung_flip5','home') %}
            mdi:floor-plan
          {% else %}
            mdi:cellphone-marker
          {% endif %}
        state: >
          {% if is_state('device_tracker.erics_samsung_flip5','home') %}
            {{ states('sensor.bermuda_eric_area') }}
          {% else %}
            {{ state_translated('device_tracker.erics_samsung_flip5') }}
          {% endif %}

If this is the first time you have created a template sensor you will need to restart Home Assistant.

Then you can put sensor.erics_phone_location in your dashboard.

This works BTW. I implemented it myself.

image

I used a changing icon co I could see with a quick glance the source of the location.

image

image