Closed SirIndubitable closed 3 weeks ago
Hey @finity69x2 any chance you can take a look at this?
This sounds super cool. How does this present in the UI?
It would just be an additional service call you can make in scripts/automations/templates. This would be similar to calendar.get_events or weather.get_forecasts https://www.home-assistant.io/blog/2023/07/05/release-20237/#services-can-now-respond
Sorry it's taken so long to get to this. real life gets in the way.
But to your point of the PR...
I've just released an update to the integration that reorganizes the alert attributes. It doesn't add the list service that the PR requests but it does fix the way the attributes are structured to make writing automations etc with them more straightforward.
Hopefully the new changes make this PR unnecessary. Let me know what you think.
But thanks for contributing even if it ultimately doesn't get implemented.
No worries, I definitely know how real life can get in the way :) I like the rewrite, and I think that's a better way to do it if we don't mind a breaking change. I'll drop this PR, because I don't think the service is necessary anymore.
I found the concatenated strings in the entity attributes a little cumbersome to write automatons for. And I saw the recommendation in Issue 66 to take advantage of the new service response feature.
This adds the new service
nws_alerts.list
which can be called on any entry provided by this integration.ps. When starting on this change, my pylint/flake8/mypy had a lot of warnings that I cleaned up first. I'll gladly remove those from this PR if they are making the change harder to follow.
I also noticed some of the typehints were wrong, so I updated those as well.