8000 Add days of validity as an attribute to cert_expiry by chemelli74 · Pull Request #51524 · home-assistant/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add days of validity as an attribute to 8000 cert_expiry #51524

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

Closed
wants to merge 2 commits into from

Conversation

chemelli74
Copy link
Contributor

Proposed change

Add a new attribute, Days of validity, to allow easy handling in automations

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • The code has been formatted using Black (black --fast homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • Untested files have been added to .coveragerc.

The integration reached or maintains the following Integration Quality Scale:

  • No score or internal
  • 🥈 Silver
  • 🥇 Gold
  • 🏆 Platinum

To help with the load of incoming pull requests:

Copy link
Contributor
@wonderslug wonderslug left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor
@jjlawren jjlawren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...and we come full circle with this one 😉

Looks good!

@frenck
Copy link
Member
frenck commented Jun 7, 2021

Why is this an attribute and not a separate sensor?

@chemelli74
Copy link
Contributor Author

Why is this an attribute and not a separate sensor?

With a previous PR we removed relative time sensor as it should not be allowed anymore.
On top of that, I thought that this value doesn't need to be persistent in the DB.

Am I wrong ?

Simone

@frenck
Copy link
Member
frenck commented Jun 7, 2021

This brings back the old issue (only hidden in the attribute). I'm ok with adding these types of sensors, when separated and disabled by default

As a general rule of thumb, if you want to make automations based on a state attrib 8000 ute, is should have been an entity.

@chemelli74
Copy link
Contributor Author

This brings back the old issue (only hidden in the attribute). I'm ok with adding these types of sensors, when separated and disabled by default

As a general rule of thumb, if you want to make automations based on a state attribute, is should have been an entity.

Got it, so why we removed it in #42338 ? ;-)

Simone

@frenck
Copy link
Member
frenck commented Jun 7, 2021

As for the main sensor provided, the changed behavior in #42338 is correct.

Some helper entities are OK IMHO (for example, we do this a lot for e.g., weather platforms). However, I think it would be nicer if we could make the use of dates in automation easier. Whatever the case, if this is there to make automation easier, it would be a workaround. How can we make this easier in automation?

Could you provide an example of an automation that is unneeded hard now?

@chemelli74
Copy link
Contributor Author

Whatever the case, if this is there to make automation easier, it would be a workaround. How can we make this easier in automation?

I would say a timedelta like function would make templating super easy. So to get minutes/hours/days/months between two timestamps.

Could you provide an example of an automation that is unneeded hard now?

Binary_sensor for remaining days < X days, to be used in alert.

@frenck
Copy link
Member
frenck commented Jun 7, 2021

time delta's is already provided.

Playing with it myself just now, I guess we don't provide an easy way to parse timestamps.

@frenck
Copy link
Member
frenck commented Jun 7, 2021

Got another solution, writing tests as we speak and will open a PR.

@frenck
Copy link
Member
frenck commented Jun 7, 2021

With the PR in #51576 it can be done like this:

image

Is that an acceptable solution?

@chemelli74
Copy link
Contributor Author

With the PR in #51576 it can be done like this:

image

Is that an acceptable solution?

Really nice one!
Fits perfectly.

@chemelli74 chemelli74 closed this Jun 7, 2021
@chemelli74 chemelli74 deleted the chemelli74-cert branch June 8, 2021 08:51
@github-actions github-actions bot locked and limited conversation to collaborators Jun 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants
0