Creating Entities From Attributes?

I am using the Traccar integration to pull GPS info on my car. The device tracker entity in HA looks like the below:

What I’d like to do is create an entity from one of these attributes (I assume that’s what they’re called) so that I can have something like an entity card showing the name of the entity and then the secondary info be the current speed. Is that possible? How could I do this?

The way to mirror attributes onto their own entity is to use Template sensors. For your Traccar entity, you will need to put something like following in your configuration.yaml file:

template:
  - sensor:
      - name: Honda Current Speed
        state: "{{ state_attr('device_tracker.honda_accord', 'speed') }}"
        unit_of_measurement: mph
        availability: "{{ has_value('device_tracker.honda_accord') }}"

I don’t understand exactly what you’re asking about the name and secondary information, so there may be an easier way to do what you are trying to do, and someone can give you a better option if you explain you goal a different way.

In the entity card you can show an attribute.

  1. You probably meant Entities card - the Entity card does not show secondary-info.
  2. To show an entity’s state (or an attribute’s value) and a speed as a secondary-info - the best option could be using a custom template-entity-row card for a corresponding row inside Entities card.

P.S. There is a method to create a custom secondary-info for a conventional entity row - using card-mod. For details - check card-mod thread - 1st post - link at the bottom - using “after” pseudoclass.

1 Like

This mostly works. The attribute last reported speed of 0, but the new entity that was created shows unknown. Is this because it hasn’t received any information since its creation?

Probably because of using a wrong template. Check if the entity has the “current_speed” attribute (could be just a “speed” as it shown in your screenshot and I am 99% sure in it 'cause using Traccar myself).

bah…that’s what it was. I should really refrain from doing things like this in the wee hours of the morning.