pirate-weather-ha
pirate-weather-ha copied to clipboard
Missing properties in forecast + new weather forecasting entities
*NB: this is not really a pirate-weather-ha issue but just wanted to start the discussion here 😃
Let me start off by saying I really like pirate-weather! It has both great spatial- and temporal resolution, which is something I need for an integration I am working on. I am building a 'local' alternative to solcast / forecast.solar for forecasting solar PV power/energy production and I rely on accurate weather forecasts, mainly cloud cover and temperature.
I wanted to share something which will probably be useful information for the pirate-weather integration, the weather forecasting system in HA is being revamped: https://github.com/home-assistant/core/pull/75219. Here is a preview of what it looks like on the frontend side: https://github.com/home-assistant/frontend/pull/15028
My biggest problem at the moment is that there is no cloud_cover
property in the weather forecast field. I have started a discussion here: https://github.com/home-assistant/architecture/discussions/905 but it seems to get no traction. My question is, would you be able to add the cloud_cover
property even though the architecture discussion has not reached any kind of agreement? I don't think it would present any major issues since this is not a core integration, but you would slightly deviate from the spec. It would be awesome to point future users of my integration to your weather integration since it will have the required cloud_cover
property.
Just FYI, my alternatives are to use the weather entity state (cloudy, clear, etc.) and convert that to a cloud cover percentage, or to setup a secondary sensor entity that holds the cloud cover information. For example with pirate-weather, I could do:
sensor:
- platform: pirateweather
api_key: <APIKEY>
scan_interval: '00:15:00'
monitored_conditions:
- cloud_cover
For the best user experience I would ofcourse highly prefer to have all this information in a single weather
entity which users can configure.
Anyway, sorry for the wall of text but thanks again for the great integration!
Thank you so much for looping me into this! I didn't realize that revamp was underway, but it's needed at this point. The weather entity is pretty restrictive, which is exactly why the I use the sensors to augment it as a solution.
I've never actually tried adding in additional properties to the weather entity. The data is there, and is already read in, so should be possible, but I don't know if the HA framework will let me. The Pirate Weather Integration allows for hourly/ daily sensors to be created, so should hit all the requirements you have here; however, I know adding a ton of sensors crowds things up.
I'll keep an eye on those changes and work it in once they go though, and keep you posted if I think of any other solution
The forecast in a Weather entity is not frozen so you can expand/add to it with other fields such as cloud cover. Would obviously not be working with built-in cards but as for custom component/cards you can do pretty much what you want.
Thanks, that's useful information. What about the properties that are listed here? weather/#forecast
Because it does not mention anything about expanding it with other fields.
Because it does not mention anything about expanding it with other fields.
Docs are for core components. If you (as this one) are working on custom you can add whatever you want to the forecast
data. The weather
entity is not limiting that capability by it's implementation.
Will get to the other weather
requests once we have the revamp of the Weather Entity complete
Yes I get that. I am not working on a custom component, but on an addon. The addon takes a HA weather entity as input to get weather forecast data. The goal is to let everyone use any weather entity they have, but I need a few fields such as temperature
, humidity
, air_speed
and cloud_cover
. That includes the weather integrations in core.
Perhaps the forecast
properties can be extended or made more flexible. As I am developing this addon I tried a lot of weather API's / integrations and some have much more information than others, such as irradiation data, dew point data, visibility, pollen, fog, frost, pressure etc. I think it's much better to standardize this list in core then let custom components come up with field names themselves. And ofcourse then core integrations can also populate those fields for which they have data.
Really useful to know that it's not frozen, since it means I can just add other attributes to it! Looking through possible attributes, I'm thinking I'll try adding humidity and cloud cover first, but are there any other key ones you had in mind? Or another custom integration that implemented this?
Got this working, it was super easy! There's nothing in the GUI, but you can view new attributes in the developer tools states menu, which I'm thinking is what you're after here? I don't know how you'd use it, but the data is getting in,
Yep, exactly. As for how to use it, the forecast
attribute is basically just a list with dicts in it, one for each timestamp.
So {{ state_attr('weather.pirateweather', 'forecast') }}
will result in:
[
{
"datetime": "2023-06-20T08:00:00+00:00",
"precipitation_probability": 0,
"wind_bearing": 126.04,
"condition": "cloudy",
"temperature": 21.7,
"wind_speed": 12.89,
"precipitation": 0
},
{
"datetime": "2023-06-20T09:00:00+00:00",
"precipitation_probability": 0,
"wind_bearing": 146.16,
"condition": "sunny",
"temperature": 22.9,
"wind_speed": 11.45,
"precipitation": 0
},
{... },
]
If you add more properties to the forecast I would expect them to show up in the dict :)
Ok, sorry this took some time, but just pushed v1.2.1 live which includes this! Let me know if it works for you, and then we can add additional parameters from there
Awesome!
I think the property name should be slightly changed, it should be cloud_coverage
according to core/entity/weather/#properties. I see the pirateweather integration named it cloud_cover
:)
Good catch, I missed this! I'll fix that pronto.
Are the other ones working/ anything else I should add in there?
Please add wind_speed
, wind_bearing
, wind_speed_unit
, pressure
and pressure_unit
to the hourly weather entity.
Thank you.
Ok, just pushed this live, and let me know what you think!
Just wanted to say that uv_index
would be very useful too!
Thanks for this neat component - I wish I'd discovered it and the Pirate Weather API a long time ago!
Great idea with UV, I'll add it to the list for the next update
I'd love to have dewpoint added if possible! It's useful for comparing indoor vs outdoor absolute humidity.
Quick update here. I pushed a v1.3 pre-release this morning that moves Pirate Weather over to the new approach Home Assistant uses for this, and as part of that, added in the uv index and dewpoint! Let me know if you have a chance to try it out
I'm going to close this issue for cleanup but if there are still properties you'd like added to the integration feel free to create a new issue using the 'enhancement' template.
I'm going to close this issue for cleanup but if there are still properties you'd like added to the integration feel free to create a new issue using the 'enhancement' template.
Thanks a lot for the work you guys have done 😁