-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Add visibility condition for lovelace cards based on an entity's last updated time #25864
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Add visibility condition for lovelace cards based on an entity's last updated time #25864
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems you haven't yet signed a CLA. Please do so here.
Once you do that we will be able to review and accept this pull request.
Thanks!
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
80a2cfc
to
d12b782
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @LukeMondy
It seems you haven't yet signed a CLA. Please do so here.
Once you do that we will be able to review and accept this pull request.
Thanks!
d12b782
to
1aa6218
Compare
entityIds.add(condition.entity); | ||
} | ||
if ( | ||
typeof condition.within === "string" && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really sure if this chunk is right..., I copied it from the NumericState condition
const within = condition.within; | ||
const after = condition.after; | ||
|
||
function HaDurationData_to_milliseconds( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As mentioned: I feel like this function must exist somewhere, but if it doesn't, this is not the right place for it. Any tips for where it should go?
Proposed change
This change adds a condition to lovelace cards, where you can decide if a card should be visible based on the time since the last change to an entity was made.
An example might be: I have a card show up on my dashboard when occupancy is detected at my front-door, showing a picture of who was there - but as soon as they leave, and the occupancy sensor is cleared, the picture immediately disappears.
This change allows me to set a visibility condition where I say display the picture for 5 minutes after the last update to the occupancy sensor.
I'm sure people will come up with other ideas too :).
Type of change
Example configuration
Additional information
This PR is not yet ready for merge - apologies, it's my first time contributing here.
Some things that need fixing:
HaDurationData_to_milliseconds
I wrote is either: duplicating functionality from somewhere I couldn't find; or if not, is very much in the wrong place. Any advice on this would be great.to the
translations/en.json
file, I get:and I don't know why yet.
Checklist
If user exposed functionality or configuration variables are added/changed:
Demo: