Skip to content
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

[FR ]Time-Based Exemptions #139

Closed
Inlustra opened this issue Jan 30, 2025 · 8 comments
Closed

[FR ]Time-Based Exemptions #139

Inlustra opened this issue Jan 30, 2025 · 8 comments
Labels
enhancement New feature or request

Comments

@Inlustra
Copy link

Inlustra commented Jan 30, 2025

Is your feature request related to a problem? Please describe.
Sometimes, when scrolling through my list of devices, I accidentally turn on my daughter's room light at night. It would be really helpful to have a way to prevent this automatically, rather than having to remember to disable the switch manually each night.

I could see the restriction card being a perfect way to do this. Especially with the confirmation lock.

Describe the solution you'd like
A "time exemption" feature could be a great addition to restriction-card. This would allow exemptions based on a specific time range, so certain users (or everyone) could be restricted from toggling a device during set hours (e.g., 10 PM to 7 AM). This would be really useful for preventing accidental interactions at night.

Describe alternatives you've considered

  • Setting up Home Assistant automations to disable the entity during certain hours.
    • (Means I can't access it even if I want to without a bit of pain)
  • Using other conditional cards, though they don’t fully prevent accidental interactions
    • It's feasible but painful.
  • Creating an input_boolean to act as a lock, but this adds extra complexity.

Additional context
This feature could work similarly to the existing exemption system but with a defined time range instead of user.

@ildar170975
Copy link
Collaborator

ildar170975 commented Jan 30, 2025

The simplest workaround could be a template binary sensor which is ON on a defined time period (could be defined ether as a static interval or with a help of 2 input_datetime helpers).
Note that it would be more flexible solution since the card does not allow templating, and you may put any logic into that binary_sensor.

@ildar170975 ildar170975 changed the title Time-Based Exemptions [FR ]Time-Based Exemptions Jan 30, 2025
@ildar170975 ildar170975 added the enhancement New feature or request label Jan 30, 2025
@Inlustra
Copy link
Author

But where would that go in terms of enabling the restrictions on the card?

@ildar170975
Copy link
Collaborator

You can set restrictions dependently on some entity.
Like this.

@ildar170975
Copy link
Collaborator

Or even simpler:

Image

@Inlustra
Copy link
Author

I totally missed that condition! That being said, still quite faffy!
I actually just forked and will raise a PR if you're open to contributions?

@ildar170975
Copy link
Collaborator

if you're open to contributions?

I am totally opened.
But I honestly & respectfully disagree to add these "time-based exemptions".
Reasons are that we should not add functionality which can be achieved by already existing mechanisms:
1.Template binary sensor accounting time intervals, presence of particular persons at home, age of people, weekdays, manual "override" etc.
2.Input boolean which is operated by some automation accounting similar factors.
There are TONS of possibilities which are much wider these "time exemptions" - and we do not need to add anything to the card, it is already there.
Of course you & other people can use the forked solution!

@Inlustra
Copy link
Author

Ah you know what, you're totally right.

I had it in my head that I was going to have to add:

  • 1 input_boolean
  • 1 automation to turn it on
  • 1 automation to turn it off

But actually a template sensor is way simpler, and I now feel rather stupid

{% set now = now().hour %}
{{ now >= 19 or now < 8 }}  # True from 7PM to 8AM

Thank god for ChatGPT

@ildar170975
Copy link
Collaborator

and I now feel rather stupid

Oh man, please do not. This is called "diversity". The more possible solutions we have - the better. Let's just choose the most flexible one))). Thanks for contribution!!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants