Migrate attribution attribute for Zestimate (#58854)

This commit is contained in:
Franck Nijhof 2021-11-01 04:43:42 +01:00 committed by GitHub
parent 9aaa92f366
commit a02055441a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -7,14 +7,12 @@ import voluptuous as vol
import xmltodict
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
from homeassistant.const import ATTR_ATTRIBUTION, CONF_API_KEY, CONF_NAME
from homeassistant.const import CONF_API_KEY, CONF_NAME
import homeassistant.helpers.config_validation as cv
_LOGGER = logging.getLogger(__name__)
_RESOURCE = "http://www.zillow.com/webservice/GetZestimate.htm"
ATTRIBUTION = "Data provided by Zillow.com"
CONF_ZPID = "zpid"
DEFAULT_NAME = "Zestimate"
@ -58,6 +56,8 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
class ZestimateDataSensor(SensorEntity):
"""Implementation of a Zestimate sensor."""
_attr_attribution = "Data provided by Zillow.com"
def __init__(self, name, params):
"""Initialize the sensor."""
self._name = name
@ -91,7 +91,6 @@ class ZestimateDataSensor(SensorEntity):
if self.data is not None:
attributes = self.data
attributes["address"] = self.address
attributes[ATTR_ATTRIBUTION] = ATTRIBUTION
return attributes
@property