How to show sensor attribute Est. Crit. Temp in customize template and extra badge

HI,

I have this sensor:
sensor.schimmel_sensor 62

with attributes:

Dewpoint: 8.78837161349112
Est. Crit. Temp: 15.89655172413793
unit_of_measurement: %
friendly_name: Schimmel sensor
custom_ui_state_card: state-card-custom-ui
icon: mdi:blur-radial

I am struggling to create a separate extra badge to show up the dewpoint and Est. Crit. Temp.

“{{states.sensor.schimmel_sensor.attributes.friendly_name}}” results in Schimmel sensor, which is correct
“{{states.sensor.schimmel_sensor.attributes.Dewpoint}}” results in 8.78837161349112, also correct
(btw dewpoint dienst work, case sensitive it is)
“{{states.sensor.schimmel_sensor.attributes.Est._Crit._Temp}}” doesn’t work, neither does
{{states.sensor.schimmel_sensor.attributes.Est.__Crit.__Temp}}

error: Error rendering template: UndefinedError: 'mappingproxy object' has no attribute 'Est'

How would i have the sensor show up the attribute Est. Crit. Temp

fyi:

this is the sensor:

##########################################################################################
# Moldindicator
##########################################################################################
# calibration_factor = (temp_indoor - temp_outdoor) / (temp_criticalpoint - temp_outdoor)
# momenteel ingesteld op (17-6,2)/15,5-6,2)

- platform: mold_indicator
  name: Schimmel sensor
  indoor_temp_sensor: sensor.temperatuur_living
  indoor_humidity_sensor: sensor.luchtvochtigheid_living
  outdoor_temp_sensor: sensor.br_temperature
  calibration_factor: 1.16

08

and this the sensor customization through @andrey 's Custom-ui :

sensor.schimmel_sensor:
  icon: mdi:blur-radial
  templates:
    theme: >
      if (attributes.state > 60) return 'red'; else return 'default';
  extra_badge:
    - entity_id: states.sensor.schimmel_sensor_Dewpoint
    - entity_id: states.sensor.schimmel_sensor_Est._Crit._Temp

Please have a look,

Marius

mold_indicator should be fixed not to include spaces or dots in attribute names

ok thanks, but that’s beyond my possibilities :wink:

is this a programming error, or could the custom-ui be modified to be able to show these spaces and dots?

Not sure who created the mold_indicator…

Cheers,
Marius

https://github.com/home-assistant/home-assistant/pull/11694

1 Like

thanks @olskar,
didn’t realize we could do that .
Cheers,
Marius

to get back to the customizing above, just reporting back this works for now, waiting for the sensor itself to get an update on the attributes:

my first attempts were wrong on 2 aspects: Dewpoint is an attribute of the sensors itself, so extra_badge needed to be ‘attribute’ and not ‘entity_id: state’ . (when the attribute Est. Crit. Temp. will be changed into est_crit_temp or something comparable we’ll be able to use that) For now ive corrected the second badge into a real sensor using the entity_id of the outside temperature, leading to:

sensor.schimmel_sensor:
  icon: mdi:blur-radial
  extra_badge:
    - attribute: Dewpoint
      unit: Dew
    - entity_id: sensor.br_temperature
      unit: "°C"
  templates:
    theme: >
      if (entity.state > 60) return 'red'; else return 'default';

resulting in:

17

coloring the other sensors with theming too from red to green, still hoping to hear about the ‘tricks’ to get a flashing alert signal, i guess by changing the theme every second or so?

Cheers,
Marius

1 Like

In HA 0.69.1, this worked for me (sorry, without proper spacing):
sensor.ez_schimmel:
custom_ui_state_card: state-card-custom-ui
friendly_name: EZ Schimmel
icon: mdi:blur-radial
extra_badge:
- attribute: dewpoint
unit: Tau
- attribute: estimated_critical_temp
unit: “°C”
templates:
theme: >
if (entity.state > 60) return ‘red’; else return ‘default’;

Coloring seems to need some work, though, as it is shown red even at 36%…
Groetjes!
Peter

you need a default theme to be able to set it… have that defined in the frontend?