Dynamic Weather and Reverse Geocoding
So, since I’ve only been camping locally over the last year, I had no idea that the stock weather integration (met.no) did not update dynamically based on the dynamic home location. After further research, it seems none of the weather integrations support dynamic locations out of the box. After several hours of searching online, I was convinced I’d have to create my own weather template device and populate forecast data the (really) hard way. Finally, I stumbled upon one reddit post that mentioned the very hidden (top secret) “track_home” setting in the met.no integration.
Steps to make met.no dynamic:
- I deleted the met.no service instance that came stock with my HAOS install (not sure if this is necessary)
- Re-added the met.no integration (again not sure if this is necessary if step 1 wasn’t taken)
- Restart HA in safe mode
- Go into the terminal addon and edit .storage/core.config_entries
- Locate the line that includes “domain”:“met”
- Locate the “data:” entry, which should include elevation, latitude and longitude
- Replace the data entry with “data”:{“name”:“Home”,“track_home”:true}
- Restart home assistant
Now met.no service/entity will dynamically update based on the home location/coordinate.
Reverse Geocoding:
I only ended up discovering the above problem/solution because I was trying to get the weather entity to update its “friendly_name” attribute based on the current location. That’s when I found the places integration which creates a sensor that takes the current gps coordinates and converts that to the nearest city/county, state, and country. I then discovered the Config Template Card which allows me to override the weather entity’s friendly_name.
Here is my yaml for that card as well as the card itself.
type: custom:config-template-card
entities: weather.forecast_home
card:
type: weather-forecast
entity: weather.forecast_home
show_current: true
show_forecast: true
forecast_type: daily
forecast_slots: 7
name: >-
${(states['sensor.location'].attributes.city ?
states['sensor.location'].attributes.city :
states['sensor.location'].attributes.county)+',
'+(states['sensor.location'].attributes.state_abbr)}
So now, I do actually have dynamic weather, and better yet, the weather card shows the current locale.
Note, the dynamic weather updates immediately upon a location change, but the reverse geocode (city name) takes up to a minute to update (based on my testing).
Edit: I scrapped the Config Template Card approach - it required a page refresh if the location changes. Instead I am now using Card Mod to add the city/state to the weather card.
