As far as the usefulness of constants, here’s one place I’d normally use a constant, and I’m curious what you guys would recommend for HA YAML.
So I have motion sensors in our bathrooms to turn on/off the lights. Cool. But when you get into the shower and close the door/curtain, the sensor no longer detects motion and turns the lights off. Now you’re showering in the dark. Not cool.
My current solution to this problem is to put a humidity sensor near the shower. Then add a condition to the “Lights Off” automation that it only activates if the humidity is below a certain value. No more unhappy wife. But… I’m still experimenting with exactly what value to use as the humidity trigger.
Especially considering I have multiple bathrooms that use this humidity value, instead of coding a literal value (i.e. magic number), I’d normally define a constant for this… but I don’t see a way to do that in HA YAML.
In the above example, I’d love to be able to define a constant for the “65” and maybe even for the “5” on the transition to make tweaking things easier when those values are used in multiple automations. Suggestions?
Thanks! That seems to work well. From reading about how to use input_number , it sounds like you can’t just put that in the below or above field; using a template seems to be the way to do it, right?
I’ve read through this chain and checked out a few others but remain unable to find a solution to my goal of using constants in Lovelace cards, As an example here is a Gauge card for rainfall:
This gauge is repeated a couple of times in other places so if I decide that I want to change the min/max or severity values I need to edit each instance. I’ve tried the suggestions described earlier but either they don’t address this instance or I am not implementing them properly. Any thoughts are appreciated.
Ron