Add device_info to GIOS integration (#38503)

This commit is contained in:
Maciej Bieniek 2020-08-05 12:47:33 +02:00 committed by GitHub
parent a91f5b7192
commit d47900473e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View file

@ -10,7 +10,7 @@ from homeassistant.components.air_quality import (
)
from homeassistant.const import CONF_NAME
from .const import ATTR_STATION, DOMAIN, ICONS_MAP
from .const import ATTR_STATION, DEFAULT_NAME, DOMAIN, ICONS_MAP, MANUFACTURER
ATTRIBUTION = "Data provided by GIOŚ"
@ -117,6 +117,16 @@ class GiosAirQuality(AirQualityEntity):
"""Return a unique_id for this entity."""
return self.coordinator.gios.station_id
@property
def device_info(self):
"""Return the device info."""
return {
"identifiers": {(DOMAIN, self.coordinator.gios.station_id)},
"name": DEFAULT_NAME,
"manufacturer": MANUFACTURER,
"entry_type": "service",
}
@property
def should_poll(self):
"""Return the polling requirement of the entity."""

View file

@ -8,6 +8,7 @@ DEFAULT_NAME = "GIOŚ"
# Term of service GIOŚ allow downloading data no more than twice an hour.
SCAN_INTERVAL = timedelta(minutes=30)
DOMAIN = "gios"
MANUFACTURER = "Główny Inspektorat Ochrony Środowiska"
AQI_GOOD = "dobry"
AQI_MODERATE = "umiarkowany"