Hey all, been building dashboards for a few weeks now. Really liking the level of customization. Now for my first question…
I have a tile for my door sensor. Red when it’s open and green when closed. Pretty simple. What I haven’t figured out is how to make the tile stay yellow for five minutes after the door is closed (the cooldown period). This way I can tell at a glance if the door recently closed. If the door reopens before the cooldown, then the tile goes back to red immediately. Is this possible?
You might be able to do it with a rule and a variable.
For example, you might set it up as:
Text Variable: $doorStatus
Two Rules:
Basic Open/Closed Status
Stayed Closed Status
Rule 1: Basic Open/Closed Status
Triggers:
- Contact changes to closed
- Contact changes to open
Flow:
IF $context.event.value is open
THEN Set $doorStatus to open
ELSE Set $doorStatus to closed-recently
Using $context.event.value in the IF condition makes the rule run faster. Rather than asking your smart home hub for the status of the door again, it uses the triggering event value as the condition.
It’s under Variable → Context Variables (tab): Event > Location/Device Event > Value
Rule 2: Stayed Closed Status
Triggers:
- Contact stays closed for 5 minutes
Flow:
Set $doorStatus to closed
Dashboard / Tiles
That would give you a variable $doorStatus which has three possible values:
open
closed-recently
closed
Then you could either just add that variable directly to your dashboard and then customize the icon / style as you see fit. Or you could use a Super Tile which gives you more control over how things are displayed.
Here’s an example of the style configuration of a tile using the above variable concept:
I put this rule in place last April, but since then I’ve added a bunch of new rules and wanted to start consolidating them. Here’s what I ended up with (rule below). Works perfect! Happy to hear if you have any suggestions on a better way to code this.