diff --git a/homeassistant/components/arlo/sensor.py b/homeassistant/components/arlo/sensor.py index 57c897cfd59..0cbb7c95f65 100644 --- a/homeassistant/components/arlo/sensor.py +++ b/homeassistant/components/arlo/sensor.py @@ -12,7 +12,6 @@ from homeassistant.components.sensor import ( SensorEntityDescription, ) from homeassistant.const import ( - ATTR_ATTRIBUTION, CONCENTRATION_PARTS_PER_MILLION, CONF_MONITORED_CONDITIONS, DEVICE_CLASS_BATTERY, @@ -123,6 +122,8 @@ def setup_platform(hass, config, add_entities, discovery_info=None): class ArloSensor(SensorEntity): """An implementation of a Netgear Arlo IP sensor.""" + _attr_attribution = ATTRIBUTION + def __init__(self, device, sensor_entry): """Initialize an Arlo sensor.""" self.entity_description = sensor_entry @@ -212,7 +213,6 @@ class ArloSensor(SensorEntity): """Return the device state attributes.""" attrs = {} - attrs[ATTR_ATTRIBUTION] = ATTRIBUTION attrs["brand"] = DEFAULT_BRAND if self.entity_description.key != "total_cameras": diff --git a/tests/components/arlo/test_sensor.py b/tests/components/arlo/test_sensor.py index 2c1f3e26b54..4d6e8f6f228 100644 --- a/tests/components/arlo/test_sensor.py +++ b/tests/components/arlo/test_sensor.py @@ -7,7 +7,6 @@ import pytest from homeassistant.components.arlo import DATA_ARLO, sensor as arlo from homeassistant.components.arlo.sensor import SENSOR_TYPES from homeassistant.const import ( - ATTR_ATTRIBUTION, DEVICE_CLASS_BATTERY, DEVICE_CLASS_HUMIDITY, DEVICE_CLASS_TEMPERATURE, @@ -179,6 +178,13 @@ def test_device_class(default_sensor, temperature_sensor, humidity_sensor): assert humidity_sensor.device_class == DEVICE_CLASS_HUMIDITY +def test_attribution(default_sensor, temperature_sensor, humidity_sensor): + """Test the device_class property.""" + assert default_sensor.attribution == "Data provided by arlo.netgear.com" + assert temperature_sensor.attribution == "Data provided by arlo.netgear.com" + assert humidity_sensor.attribution == "Data provided by arlo.netgear.com" + + def test_update_total_cameras(cameras_sensor): """Test update method for total_cameras sensor type.""" cameras_sensor.update() @@ -195,7 +201,6 @@ def _test_attributes(hass, sensor_type): data = _get_named_tuple({"model_id": "TEST123"}) sensor = _get_sensor(hass, "test", sensor_type, data) attrs = sensor.extra_state_attributes - assert attrs.get(ATTR_ATTRIBUTION) == "Data provided by arlo.netgear.com" assert attrs.get("brand") == "Netgear Arlo" assert attrs.get("model") == "TEST123" @@ -212,7 +217,6 @@ def test_state_attributes(hass): def test_attributes_total_cameras(cameras_sensor): """Test attributes for total cameras sensor type.""" attrs = cameras_sensor.extra_state_attributes - assert attrs.get(ATTR_ATTRIBUTION) == "Data provided by arlo.netgear.com" assert attrs.get("brand") == "Netgear Arlo" assert attrs.get("model") is None