mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 18:57:06 +00:00
Add device_info property for AccuWeather integration (#38480)
This commit is contained in:
parent
d47900473e
commit
56f8ced267
@ -25,6 +25,8 @@ CONCENTRATION_PARTS_PER_CUBIC_METER = f"p/{VOLUME_CUBIC_METERS}"
|
|||||||
COORDINATOR = "coordinator"
|
COORDINATOR = "coordinator"
|
||||||
DOMAIN = "accuweather"
|
DOMAIN = "accuweather"
|
||||||
LENGTH_MILIMETERS = "mm"
|
LENGTH_MILIMETERS = "mm"
|
||||||
|
MANUFACTURER = "AccuWeather, Inc."
|
||||||
|
NAME = "AccuWeather"
|
||||||
UNDO_UPDATE_LISTENER = "undo_update_listener"
|
UNDO_UPDATE_LISTENER = "undo_update_listener"
|
||||||
|
|
||||||
CONDITION_CLASSES = {
|
CONDITION_CLASSES = {
|
||||||
|
@ -16,6 +16,8 @@ from .const import (
|
|||||||
DOMAIN,
|
DOMAIN,
|
||||||
FORECAST_DAYS,
|
FORECAST_DAYS,
|
||||||
FORECAST_SENSOR_TYPES,
|
FORECAST_SENSOR_TYPES,
|
||||||
|
MANUFACTURER,
|
||||||
|
NAME,
|
||||||
OPTIONAL_SENSORS,
|
OPTIONAL_SENSORS,
|
||||||
SENSOR_TYPES,
|
SENSOR_TYPES,
|
||||||
)
|
)
|
||||||
@ -73,6 +75,16 @@ class AccuWeatherSensor(Entity):
|
|||||||
return f"{self.coordinator.location_key}-{self.kind}-{self.forecast_day}".lower()
|
return f"{self.coordinator.location_key}-{self.kind}-{self.forecast_day}".lower()
|
||||||
return f"{self.coordinator.location_key}-{self.kind}".lower()
|
return f"{self.coordinator.location_key}-{self.kind}".lower()
|
||||||
|
|
||||||
|
@property
|
||||||
|
def device_info(self):
|
||||||
|
"""Return the device info."""
|
||||||
|
return {
|
||||||
|
"identifiers": {(DOMAIN, self.coordinator.location_key)},
|
||||||
|
"name": NAME,
|
||||||
|
"manufacturer": MANUFACTURER,
|
||||||
|
"entry_type": "service",
|
||||||
|
}
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def should_poll(self):
|
def should_poll(self):
|
||||||
"""Return the polling requirement of the entity."""
|
"""Return the polling requirement of the entity."""
|
||||||
|
@ -15,7 +15,15 @@ from homeassistant.components.weather import (
|
|||||||
from homeassistant.const import CONF_NAME, TEMP_CELSIUS, TEMP_FAHRENHEIT
|
from homeassistant.const import CONF_NAME, TEMP_CELSIUS, TEMP_FAHRENHEIT
|
||||||
from homeassistant.util.dt import utc_from_timestamp
|
from homeassistant.util.dt import utc_from_timestamp
|
||||||
|
|
||||||
from .const import ATTR_FORECAST, ATTRIBUTION, CONDITION_CLASSES, COORDINATOR, DOMAIN
|
from .const import (
|
||||||
|
ATTR_FORECAST,
|
||||||
|
ATTRIBUTION,
|
||||||
|
CONDITION_CLASSES,
|
||||||
|
COORDINATOR,
|
||||||
|
DOMAIN,
|
||||||
|
MANUFACTURER,
|
||||||
|
NAME,
|
||||||
|
)
|
||||||
|
|
||||||
PARALLEL_UPDATES = 1
|
PARALLEL_UPDATES = 1
|
||||||
|
|
||||||
@ -54,6 +62,16 @@ class AccuWeatherEntity(WeatherEntity):
|
|||||||
"""Return a unique_id for this entity."""
|
"""Return a unique_id for this entity."""
|
||||||
return self.coordinator.location_key
|
return self.coordinator.location_key
|
||||||
|
|
||||||
|
@property
|
||||||
|
def device_info(self):
|
||||||
|
"""Return the device info."""
|
||||||
|
return {
|
||||||
|
"identifiers": {(DOMAIN, self.coordinator.location_key)},
|
||||||
|
"name": NAME,
|
||||||
|
"manufacturer": MANUFACTURER,
|
||||||
|
"entry_type": "service",
|
||||||
|
}
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def should_poll(self):
|
def should_poll(self):
|
||||||
"""Return the polling requirement of the entity."""
|
"""Return the polling requirement of the entity."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user