I have lots of entities that have lots of attributes each and I continue to add more such entities.
I’ve learned about creating template sensors for attributes, but there’s got to be an easier way.
I found this:
How to wildcard template entities? - Configuration - Home Assistant Community (home-assistant.io)
but I can’t get it to work.
I am able to make this line of code work in a card:
{{ states.binary_sensor | selectattr('object_id', 'match', 'mikrotik_255_')
| map(attribute='entity_id') | list }}
but what it does is list all the entities that begin with “mikrotik_255_”
Interestingly, the above code shows (among other entities):
binary_sensor.mikrotik_255_hex_s_ups
But, this code:
{{ states.binary_sensor | selectattr('object_id', 'match', 'mikrotik_255_s_')
| map(attribute='entity_id') | list }}
does not produce any results. Adding the “s_” at the end of “mikrotik_255_” breaks it.
Regardless, what I really want is some simple (and simple enough for me to understand) code that I can use in a card that will show all the attribute’s names and their values by identifying a single entity.
Something like the following (I hope my pretend code doesn’t hurt the brains of real programmers too much):
{{ code.code.code.code."mikrotik_255_s_ups".code.code.code }}
attribution: Data provided by Mikrotik
name: ups1
offline_time: 0s
min_runtime: never
alarm_setting: immediate
model: CP1500PFCLCDa
serial: CXXLV2003186
manufacture_date: unknown
nominal_battery_voltage: unknown
runtime_left: 1h1m15s
battery_charge: 100
battery_voltage: 0
line_voltage: 124
load: 12
hid_self_test: unknown
device_class: power
friendly_name: Mikrotik-255 hEX S UPS
Thank you.