Weather based on location

Hi All,
I have a suggestion that would help out people using home assistant in RVs, boats, etc.

Being able to have your weather location updated to match your home zone location. That way an automation can be used to update the zone location from GPS, and the weather will automatically reconfigure it to your location.

If you are US based then I’ve got a custom integration that can do this right now for severe weather alerts from the NWS.

it doesn’t provide actual weather data for your location tho. Just severe alerts.

1 Like

Aren’t the “normal” weather integrations already doing this? At least AccuWeather takes the lat/lng from the config as location. As long as the update cycles for the weather provider are small enough, the weather should adjust to the current location.

But I obviously haven’t tested it, as my HA installation isn’t mobile. :rofl:

I’m pretty sure it only checks the location when you configure it originally. It does update itself if the location of the HA server changes.

So it will only ever give you the weather for the original location not the current location unless you update it manually.

I solved this problem by implementing a Restful interface to OpenWeatherMap. But, I would agree, it would be nice is the weather providers got their location from the zone’s location.

Any chance you could share your config YAML for this? Rather not have to make it from scratch. :slight_smile:

Thanks!

Here is something I use:

sensor:
  - platform: rest
    name: OWM Current Location Report
    json_attributes:
      - main
      - weather
    value_template: "{{ value_json['weather'][0]['description'].title() }}"
    resource_template: >
      {% if is_state('person.me', 'home') %}
        https://api.openweathermap.org/data/2.5/weather?lat=41.367100&lon=-85.059825&appid=your_app_id
      {% else %}
        https://api.openweathermap.org/data/2.5/weather?lat={{ state_attr('person.me', 'latitude') }}&lon={{ state_attr('person.me', 'longitude') }}&appid=your_app_id
      {% endif %}
  - platform: template
    sensors:
      owm_current_location_weather:
        friendly_name: "Current Location Weather"
        value_template: "{{ state_attr('sensor.owm_current_location_report', 'weather')[0]['description'].title() }}"
        entity_picture_template: "{{ 'https://openweathermap.org/img/w/' + state_attr('sensor.owm_current_location_report', 'weather')[0]['icon'].lower() + '.png' }}"
      owm_current_location_temp:
        friendly_name: "Current Location Temperature"
        value_template: "{{ ((state_attr('sensor.owm_current_location_report', 'main')['temp'] - 273.15) * 9/5 + 32) | round(2)}}"
        unit_of_measurement: "°F"
      owm_current_location_pressure:
        friendly_name: "Current Location Pressure"
        value_template: "{{ (state_attr('sensor.owm_current_location_report', 'main')['pressure'] * 0.02953) | round(2) }}"
        unit_of_measurement: "inHg"
      owm_current_location_humidity:
        friendly_name: "Current Location Humidity"
        value_template: "{{ state_attr('sensor.owm_current_location_report', 'main')['humidity'] }}"
        unit_of_measurement: "%"

This really does suck I’ve been through four different weather integrations and not one of them will keep the location up-to-date when I move. Also how come the product’s been around for so long and I can’t put a variable like a sensor value or an attribute in a URL its ridiculous