hmm, it might stumble on the global entity reference (using ‘entities’ ) then. for the sake of testing could you replace those 2 input_numbers with actual numbers please
sensor.battery_*:
templates:
icon_color: >
if (['unavailable', 'unknown'].includes(state)) return 'brown';
if (state < 50) return 'orange';
if (state < 10) return 'red';
return 'green';
if this helps, (and it is in fact the global entity reference) we need to ask Romrider to review the template and see if the global referencing can be mitigated
if (state <= Number(entities['input_number.battery_level_critical'].state)) return 'red';
line. in JS that is a global variable, opposed to the state which is local (to the template).
I’ll tag @romrider here to please have him check if anything can be done? Hey Rom, if you have a moment, could you please have a look at the support_custom_ui code you wrote for me earlier? Would be great if you could make it support the global entities[].state too?
thanks if you would
Settings → Entities: icon’s color is NOT customized, the “template” data is displayed.
versus
Lovelace dashboard: icon IS customized, but the “template” data are flickering
if I go to Settings, entities, select a battery entity and then click the slider icon top right, I see the icon, customized and the customized dropdown.
However, I am using YAML mode, so clicking an entity in the entities list on most items gives me the warning I can manage them in the UI.
I guess the answer is NO, I don’t see a difference…
homeassistant:
customize_glob:
sensor.battery_*:
templates:
icon_color: >
if (['unavailable', 'unknown'].includes(state)) return 'brown';
if (state <= Number(entities['input_number.battery_level_critical'].state)) return 'red';
if (state <= Number(entities['input_number.battery_level_warning'].state)) return 'rgb(250,218,67)';
return 'green';
hide_attributes:
- templates
- icon_color
So, only adding "last_updated: return entity.last_updated;" removes the differences.
OK, could it be a cashing issues? I cleared the browser’s cashe, restarted HA & tried to reproduce the same condition - now I do NOT see these differences.
Support "entities" inside button-card (waiting for RomRider).
Rectify that flickering with “attributes” dropdown menu.
May I ask you about one more thing?
You proposed to add a "last_updated" attribute above.
Does it mean that ANY attribute may be added to a set of entities?
Particularly, lets consider this example:
I have a set of "binary_sensor.battery_charging_life360_*" entities keeping a battery’s state (charging or not).
Examples of names:
battery_charging_life360_mama
battery_charging_life360_papa
…
Each sensor has an attribute "location" (equal to the associated Life360 device_tracker's state):