Closed roldengarm closed 10 months ago
Indicators allow setting the attribute of an entity it is listed in the config table (no examples though) can you share what will be the thoeritcal configuration you want to use so I can direct you better?
Thanks @regevbr So I've got a sensor with id "living_temp_sensor_temperature" which shows the temperature. I would like to show when it was last updated. This is useful as they are Zigbee wireless sensors and sometimes they no longer update.
When I display it in an entity row card it shows like this, so I'd like to add the "x minutes ago" to mini-climate-card
the YAML for above:
entity: sensor.living_room_temp_sensor_temperature
type: custom:multiple-entity-row
name: Living Room
secondary_info: last-changed
entities:
- entity: sensor.living_room_temp_sensor_humidity
name: humidity
- entity: sensor.living_room_temp_sensor_battery
name: battery
Does this answer your question? I really appreciate your support!
Can you share your mini climate card config?
Sure! @regevbr
type: custom:mini-climate
entity: climate.living_ac
secondary_info:
type: hvac-action
hide: false
icon: mdi:heating-coil
indicators:
battery:
icon: mdi:battery
unit: '%'
round: 1
source:
entity: sensor.living_room_temp_sensor_battery
humidity:
icon: mdi:water
unit: '%'
round: 1
source:
entity: sensor.living_room_temp_sensor_humidity
type: custom:mini-climate
entity: climate.living_ac
secondary_info:
type: hvac-action
hide: false
icon: mdi:heating-coil
indicators:
battery:
icon: mdi:battery
unit: '%'
round: 1
source:
entity: sensor.living_room_temp_sensor_battery
humidity:
icon: mdi:water
unit: '%'
round: 1
source:
entity: sensor.living_room_temp_sensor_humidity
updated:
source:
entity: sensor.living_room_temp_sensor_temperature
attribute: last_updated
Thanks @regevbr I tried that, but doesn't seem to work. It just shows empty. Any idea?
Are you sure that it has an attribute called last_updated?
@regevbr pretty sure, please see below debugging template:
please check in the developer tools on the entity itself. My guess is that it is not an attribute but a property of the entity. You can use a mapper instead see examples in the docs if that is the case
Thanks @regevbr I fixed it with a mapper indeed, like this:
updated:
icon: mdi:clock
source:
entity: sensor.living_room_temp_sensor_temperature
mapper: |
(value, entity, climate_entity, hvac_mode) => {
const date = new Date(entity.last_changed);
const minutes = Math.floor((new Date() - date) / 60000);
return minutes + ' min ago';
}
I would like to display the last_updated property of a sensor under the indicators. As this is an attribute, I'm not sure how to do that? As the examples only show how to display entities. So e.g. the templated value would be:
sensor.living_temp_sensor_temperature.last_updated