Weather integration ipma generating new entities for same location/device
See original GitHub issueThe problem
Every now and then (not clearly exactly when), my weather integration IPMA generates 2 entities for the same location, one of which is kept unavailable (the old one).


It seems the integration is generating a new entity but instead of replacing the existing one, is actually generating a new one.
I can manually delete the unavailable entity and rename the available one to remove the _2 at the end (and make sure any entity-ID based automations still work), but it seems like a never-ending cat and mouse chase…
As per below information (from file core.entity_registry), it seems that the meteorological station ID GPS coordinates are being used to generate the entity unique ID (along with the observation periodicity: in the case daily). Possibly a change in the closest station used for the weather data (due to unavailability?), causes this issue to happen in the integration.
Please let me know if there’s any other useful information I can provide.
What version of Home Assistant Core has the issue?
core-2022.3.5
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant Supervised
Integration causing the issue
IPMA
Link to integration documentation on our website
https://www.home-assistant.io/integrations/ipma
Diagnostics information
Integration does not support diagnostics
Example YAML snippet
NA
Anything in the logs that might be useful for us?
Nothing relevant...
Additional information
First entity (weather.guimaraes - now unavailable) seems to point at meteorological station ID-1210622 (Braga, Merelim) while the second entity (weather.guimaraes_2) seems to point at station ID-6212124 (Braga (CIM)) – as per info in https://api.ipma.pt/open-data/observation/meteorology/stations/stations.json.
Relevant contents of file core.entity_registry:
            {
                "area_id": null,
                "capabilities": null,
                "config_entry_id": "c2ae74c75a2c44499a1c935e91e8b301",
                "device_class": null,
                "device_id": null,
                "disabled_by": null,
                "entity_category": null,
                "entity_id": "weather.guimaraes",
                "icon": null,
                "id": "9c1653e27e05d1abb7c552d0904f12df",
                "name": null,
                "options": {},
                "original_device_class": null,
                "original_icon": null,
                "original_name": "Guimar\u00e3es",
                "platform": "ipma",
                "supported_features": 0,
                "unique_id": "41.56678056, -8.45003056, daily",
                "unit_of_measurement": null
            },
            {
                "area_id": null,
                "capabilities": null,
                "config_entry_id": "c2ae74c75a2c44499a1c935e91e8b301",
                "device_class": null,
                "device_id": null,
                "disabled_by": null,
                "entity_category": null,
                "entity_id": "weather.guimaraes_2",
                "icon": null,
                "id": "4966c7617f29087d0b4a20602a1d3d81",
                "name": null,
                "options": {},
                "original_device_class": null,
                "original_icon": null,
                "original_name": "Guimar\u00e3es",
                "platform": "ipma",
                "supported_features": 0,
                "unique_id": "41.53568333, -8.42514722, daily",
                "unit_of_measurement": null
            },
Issue Analytics
- State:
 - Created 2 years ago
 - Comments:9 (3 by maintainers)
 

Top Related StackOverflow Question
https://github.com/home-assistant/core/pull/76332
Station might change on each update now, but surely fixes this situation
Still valid and not fixed yet.