mirror of https://github.com/home-assistant/core
Migrate attribution attribute for Picnic (#57507)
This commit is contained in:
parent
580b5fb812
commit
e94bebdf7b
|
@ -5,7 +5,6 @@ from typing import Any
|
|||
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import ATTR_ATTRIBUTION
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.typing import StateType
|
||||
from homeassistant.helpers.update_coordinator import (
|
||||
|
@ -41,8 +40,8 @@ async def async_setup_entry(
|
|||
class PicnicSensor(SensorEntity, CoordinatorEntity):
|
||||
"""The CoordinatorEntity subclass representing Picnic sensors."""
|
||||
|
||||
_attr_attribution = ATTRIBUTION
|
||||
entity_description: PicnicSensorEntityDescription
|
||||
_attr_extra_state_attributes = {ATTR_ATTRIBUTION: ATTRIBUTION}
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
|
|
|
@ -138,6 +138,8 @@ class TestPicnicSensor(unittest.IsolatedAsyncioTestCase):
|
|||
if unit:
|
||||
assert sensor.attributes["unit_of_measurement"] == unit
|
||||
|
||||
assert sensor.attributes["attribution"] == "Data provided by Picnic"
|
||||
|
||||
async def _setup_platform(
|
||||
self, use_default_responses=False, enable_all_sensors=True
|
||||
):
|
||||
|
|
Loading…
Reference in New Issue