mirror of
https://github.com/home-assistant/core.git
synced 2025-07-08 05:47:10 +00:00
Migrate attribution attribute for Aftership (#57649)
This commit is contained in:
parent
f43bba8cfd
commit
2ec352ce96
@ -11,7 +11,7 @@ from homeassistant.components.sensor import (
|
|||||||
PLATFORM_SCHEMA as BASE_PLATFORM_SCHEMA,
|
PLATFORM_SCHEMA as BASE_PLATFORM_SCHEMA,
|
||||||
SensorEntity,
|
SensorEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.const import ATTR_ATTRIBUTION, CONF_API_KEY, CONF_NAME, HTTP_OK
|
from homeassistant.const import CONF_API_KEY, CONF_NAME, HTTP_OK
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
@ -109,6 +109,7 @@ async def async_setup_platform(
|
|||||||
class AfterShipSensor(SensorEntity):
|
class AfterShipSensor(SensorEntity):
|
||||||
"""Representation of a AfterShip sensor."""
|
"""Representation of a AfterShip sensor."""
|
||||||
|
|
||||||
|
_attr_attribution = ATTRIBUTION
|
||||||
_attr_native_unit_of_measurement: str = "packages"
|
_attr_native_unit_of_measurement: str = "packages"
|
||||||
_attr_icon: str = ICON
|
_attr_icon: str = ICON
|
||||||
|
|
||||||
@ -191,7 +192,6 @@ class AfterShipSensor(SensorEntity):
|
|||||||
_LOGGER.debug("Ignoring %s as it has status: %s", name, status)
|
_LOGGER.debug("Ignoring %s as it has status: %s", name, status)
|
||||||
|
|
||||||
self._attributes = {
|
self._attributes = {
|
||||||
ATTR_ATTRIBUTION: ATTRIBUTION,
|
|
||||||
**status_counts,
|
**status_counts,
|
||||||
ATTR_TRACKINGS: trackings,
|
ATTR_TRACKINGS: trackings,
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user