Closed klopyrev closed 10 months ago
Thanks for this PR! I didn't know that Home Assistant was making these changes, but it looks like they recently made a post about it on the developer blog:
https://developers.home-assistant.io/blog/2023/08/07/weather_entity_forecast_types/
This PR looks good to me, but I'd like to test it first before I commit it. I should have time to test it in the next 1-2 days, and I'll let you know if I see any problems.
Thanks. At this point, I'm actually not sure that I need the updated API. Just the datetime update was probably enough for what I'm doing, but in any case I think it's a change in the right direction.
I didn't follow the new design for WeatherEntity exactly. Specifically, it's still 2 classes and implements the forecast attribute. I'm using the lovelace-hourly-weather frontend custom card, which I think still requires the forecast attribute which means 2 classes. This is the bit of Javascript code in the card implementation: "const s=d.entity,l=this.hass.states[s],{forecast:c}=l.attributes"
I tested this and it looks good. Do you know if this will still work with older versions of Home Assistant, like 2023.7? I'm concerned that if I create a new release with this PR, it could break the integration for people who haven't updated to 2023.8 yet.
Thanks for your contribution!
I don't know if it works with old version, but it doesn't feel like a change that would break older versions. It doesn't change any existing methods. It just adds new ones.
Yeah, my main concern is that the WeatherEntityFeature
enum did not exist in older versions of Home Assistant - it was added in 2023.8:
So with this PR we're importing a constant that only exists in 2023.8 or later. For now I'll mention this in the release notes and update the minimum version in the README so that people on older versions of Home Assistant hopefully won't update.
Thanks again for your contribution!
These are the changes necessary for the hourly forecast card on a dashboard.