pirate-weather-ha icon indicating copy to clipboard operation
pirate-weather-ha copied to clipboard

Auto update forecast based on HA Home location (for use in RV's and other mobile applications)

Open JeffyBeepBoop opened this issue 1 year ago • 1 comments

Hello! Thanks so much for creating this.

I use HA in a van and travel around the country and want my weather to reflect wherever I am. I've already made it so HA updates it's home location automatically, is there a way for the PirateWeather integration to update it's lat-long dynamically from HA's "home" location? Or does it do this already?

The config seems to require adding latitude and longitude for the desired forecast. When I clear it and update the config, when I go back it shows a lat and longitude again. I can see how to do it in yaml configuration, but your ocs indicate that's deprecated and on it's way out.

JeffyBeepBoop avatar Nov 26 '23 22:11 JeffyBeepBoop

Thanks for using this integration, and appreciate filing the issue! I love hearing about how people are using the service, and this is such a cool application. Long story short, as far as I can tell, there's no way within Home Assistant to create a weather entity that can change. It has to be linked to a "data update coordinator", which seems to be attached to one specific lat lon.

However, there is a slightly more elaborate way that I worked out a while ago that might address your issue here: https://github.com/Pirate-Weather/pirate-weather-ha/issues/46#issuecomment-1549907340. By creating a new weather entity from a template, you HA can just make regular GET requests to the API and put everything in the right spot, letting it update dynamically. It's not the first option since it requires editing the YAML, but since you're already in there, it should work for you.

I haven't had a chance to try it with hourly forecasts, but it should work the same way. Let me know if you have a chance to try implementing it and how it goes/ if it works for you

alexander0042 avatar Nov 28 '23 01:11 alexander0042

I and several other folks in a smart RV group have been looking for a solution to this dynamic weather use case. Regarding what you posted above:

Long story short, as far as I can tell, there's no way within Home Assistant to create a weather entity that can change. It has to be linked to a "data update coordinator", which seems to be attached to one specific lat lon.

Does this preclude changing the YAML implementation of your integration to allow for a template to be used in place of the literal latitude and longitude values? It would look something like this:

weather:
  - platform: pirateweather
    api_key: <API KEY>
    latitude: "{{states('sensor.home_latitude')}}"
    longitude: "{{states('sensor.home_longitude')}}"
    mode: "hourly"
    name: PW_YAML

Some other process would then update the Home Assistant location which would be used when weather is updated.

phurth avatar Apr 04 '24 14:04 phurth

Duplicate of #46

cloneofghosts avatar May 15 '24 20:05 cloneofghosts