Add device info for Aemet (#120243)

* Update sensor.py

* Update weather.py

* Update sensor.py

* ruff

* add device info to entity

* remove info from sensor

* remove info from weather

* ruff

* amend entity

* Update sensor.py

* Update weather.py

* ruff again

* add DOMAIN

* type unique_id

* Update entity.py

* Update entity.py

* assert

* update tests

* change snapshot
This commit is contained in:
Luca Angemi 2024-06-24 08:20:34 +02:00 committed by GitHub
parent fe3027f7de
commit fdade67211
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 25 additions and 4 deletions

View file

@ -392,10 +392,12 @@ class AemetSensor(AemetEntity, SensorEntity):
config_entry: ConfigEntry,
) -> None:
"""Initialize the sensor."""
super().__init__(coordinator)
assert config_entry.unique_id is not None
unique_id = config_entry.unique_id
super().__init__(coordinator, name, unique_id)
self.entity_description = description
self._attr_name = f"{name} {description.name}"
self._attr_unique_id = f"{config_entry.unique_id}-{description.key}"
self._attr_unique_id = f"{unique_id}-{description.key}"
@property
def native_value(self):