Pirate-Weather / pirate-weather-ha

Replacement for the default Dark Sky Home Assistant integration using Pirate Weather
https://pirateweather.net/
Apache License 2.0
360 stars 24 forks source link

`sourceTimes` sensor #296

Closed cloneofghosts closed 1 month ago

cloneofghosts commented 1 month ago

Describe the feature

I'm not sure how possible it would be but it would be nice to have a sourceTimes sensor (or sensors) to show when the models used for your forecast were last updated.

Home Assistant version

2024.8.2

Integration version

1.5.7

Acknowledgements

alexander0042 commented 1 month ago

This is actually super doable! The data is all there, and the framework for adding sensors is plenty established, so mostly just adding entries to a list.

The complicated part is that the Python module we're using in Home Assistant doesn't support the flags attribute. I can work around this by just parsing the raw JSON, but it is a reminder that we really should create an "official" Python wrapper for Pirate Weather. It wouldn't be a massive project, and a few are already floating around, but would make things like this easier, as well as future maintenance issues.

alexander0042 commented 1 month ago

Ok, just pushed a commit that includes these, let me know if it works!

I can't always get changes in quickly, but I really try to work yours in whenever it's relatively easy 😃

cloneofghosts commented 1 month ago

Tested in my devcontainer and they're working. Thanks. image