a question from a newbee:
I want to have a card on my dashboard or lovelace where a card should show if my sensor in the mailbox was fired or not and if fired, change the color / icon and stay till 0:00 am.
Everyday at 0:00 am or if mailbox opened a 2nd time on that day it should then reset (example gray instead of red)
How can I achieve this?
What kind of Card do i need to create and how can I tell this card : now you need to be red, or gray.
Stilljack post will point you at customization. Iād ask you to stop and think about the construct.
What are you ACTUALLY trying to accomplish? (sounds like notification of mail?)
Ok so if you notify on the mailbox door how are you going to tell when you opened the door to check mail v. The mailman? How are you going to reset it wheen you have the mail (all of these need to be figured out before you start worrying about colors.)
Reason. It changes what youāre customizing.
If I were doing this Iād also create an input boolean helper to hold the state of the alert in a way that can be reset. That way the door can be opened and closed with impunity and only fire the āyouāve got mailā notification once.
So youād have your sensor (Door opened!)
When that happens have an automation turn on the input boolean. Put THAT on the dashboard. When itās on the natural state of the dashboard will color it. You can call it whatever you want. Then once you grab the mail just turn off the boolean (which will change state in the dash) and all is well until the next time the mail comes.
thanks.
I think I did not make really clear what i want to achieve : A card which keeps the state when fired once. (Not change back to closed when the sensor closes back. )
Like an alarm āyes, alarm was triggered therefore I am redā
If I would know on how to yaml this thing, I would do like:
if ālast changedā < 20h then change color to red.
Your idea with the boolen sounds the right way to me. But not sure on how to implement this in yaml
how would you implement an indicator that an alarm was triggered (which reset it self afterwards if wanted, but this is the second step)?
You do it as described above but also add a second automation that either resets the boolean at a specific time (midnight?) or waits for a delay (you can do this one but itās generally bad to avoid long delays in automations)
exactly, thanks.
but how do I implement it? I even dont now on how to start?`
itās probably very simple, but I dont know how to start and enter my logic if else checks
@NathanCu is right. Write an automation to toggle an input_boolean, and write it using the UI (use entity ids and states, not device ids). If youāre interested in yaml you can look at that afterwards.
First create a ātoggle helperā. Weāll call it āmailbox flagā.
Then create an automation. Itās hard to show examples because we donāt have your sensors, but it would be something likeā¦
When...
Entity: mailbox sensor
State: Changes to "open"
Then do...
Input_boolean turn on: input_boolean.mailbox_flag
Then create a second automationā¦
When...
The time is equal to 00:00:01
Then do...
Input_boolean turn off: input_boolean.mailbox_flag
Your dashboard should be based on the state of input_boolean.mailbox_flag.
Thereās an introduction to automations here:
Itās quite comprehensive if you follow the links through.