Restarted, no errors.
But before these errors took place not every restart - so I need more restarts, more statistics.
Does it guarantee that the 1st condition will be checked first?
Seems that this entity variable relates to the sensor (sensor.daylight_savings_times in your example).
And this code checks THIS sensor.
Is there any meaning to check if THIS sensor exists in the code which customizing THIS sensor?
Also, how to check OTHER sensors - like input_numbers from my case?
yes, because those can be template sensors not yet initialized, or created by other integrations during setup. If bad luck, a non guarded customization can lock your instance in repeating errorsā¦
you can check external entities (global is what theyāre called ) as you know you can do like in other JS ( eg custom:button-card)
# using an attribute of another (global) entity
sensor.power_consumption:
templates:
icon_color: >
if (entities['sensor.smart_meter'].attributes.power > 3000) return 'red';
return green;
Are you from Holland? I am and need your help. I am new to this but learned al lot the past weeks.
I installed mod-card and your custom-ui. Itās in resources. I would like to change the color of the icon of the Mode when its Perm.Low to orange. Do i have to create this in the configuration of the ventilation in configuration.yaml or in this card? The card has this code:
you can either install custom-ui and customize those entities under:
homeassistant:
customize:
as is described in the examples file on my repo, or you can install/use card-mod, and mod these in the lovelace card config, as is described in the card-mod repo docs ;-))
btw, please format your code correctly with the </> button in the editor, so we can check for errors. or use triple (not single) ``` backticks
rightā¦ my code was an example, and ofc based on an entity with its specific states. I dont think your entity has state 'backed_upā so adjust to your specific setting and needs
how do you find the state of your entity?
(not trying to be a pain here, but trying to help you find out yourself)
that seems like var(--disabled-text-color) but you could simply test that and check your theme?
or, it could be what ever color is in your paper-item-icon-color:.
ofc you can also put var(--paper-item-icon-color) in the case
yes, thats a familiar error, when you dont āguardā your templates. The state you use in the template isnt yet properly initialized at startup, and thus can not be used in the template.
it throws these until the state is ready, and you probably see no issues after that?
I would strongly suggest you find the incorrect templates, because if things go wild, you might not be able to reach the frontend at all, and all you see is frontend errors in your log
its a matter of elimination. comment them all and see if the error is gone? ok?
than enable half of them and retry. error still gone? enable half of the rest. if not, check in the last enabled sectionā¦
but, you dont need to do this in all your custom-ui templates, just the ones where the state is created during startup. Mostly HA template sensors, or things made by python scripts etc etc
wouldnt think so no, only templates. but, with the method above, its easily checked
btw, a state.state will most likely ever be āunavailableā , not āUnavailableā. you need to check the true state in the state machine, not what is shown in the Frontend
it checks if attributes are available, And if a certain attributes is available, And then if that attributes is true. in all other cases it returns the exception