Remove unnecessary extra attribute from NUT sensors (#56078)

pull/56095/head
Michael 2021-09-11 04:17:46 +02:00 committed by GitHub
parent bd18bc9f3a
commit b11db0b1d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 14 deletions

View File

@ -5,7 +5,7 @@ import logging
from homeassistant.components.nut import PyNUTData
from homeassistant.components.sensor import SensorEntity, SensorEntityDescription
from homeassistant.const import ATTR_STATE, CONF_RESOURCES, STATE_UNKNOWN
from homeassistant.const import CONF_RESOURCES, STATE_UNKNOWN
from homeassistant.helpers.update_coordinator import (
CoordinatorEntity,
DataUpdateCoordinator,
@ -133,11 +133,6 @@ class NUTSensor(CoordinatorEntity, SensorEntity):
return _format_display_state(self._data.status)
return self._data.status.get(self.entity_description.key)
@property
def extra_state_attributes(self):
"""Return the sensor attributes."""
return {ATTR_STATE: _format_display_state(self._data.status)}
def _format_display_state(status):
"""Return UPS display state."""

View File

@ -21,7 +21,6 @@ async def test_pr3000rt2u(hass):
expected_attributes = {
"device_class": "battery",
"friendly_name": "Ups1 Battery Charge",
"state": "Online",
"unit_of_measurement": PERCENTAGE,
}
# Only test for a subset of attributes in case
@ -47,7 +46,6 @@ async def test_cp1350c(hass):
expected_attributes = {
"device_class": "battery",
"friendly_name": "Ups1 Battery Charge",
"state": "Online",
"unit_of_measurement": PERCENTAGE,
}
# Only test for a subset of attributes in case
@ -72,7 +70,6 @@ async def test_5e850i(hass):
expected_attributes = {
"device_class": "battery",
"friendly_name": "Ups1 Battery Charge",
"state": "Online",
"unit_of_measurement": PERCENTAGE,
}
# Only test for a subset of attributes in case
@ -97,7 +94,6 @@ async def test_5e650i(hass):
expected_attributes = {
"device_class": "battery",
"friendly_name": "Ups1 Battery Charge",
"state": "Online Battery Charging",
"unit_of_measurement": PERCENTAGE,
}
# Only test for a subset of attributes in case
@ -125,7 +121,6 @@ async def test_backupsses600m1(hass):
expected_attributes = {
"device_class": "battery",
"friendly_name": "Ups1 Battery Charge",
"state": "Online",
"unit_of_measurement": PERCENTAGE,
}
# Only test for a subset of attributes in case
@ -152,7 +147,6 @@ async def test_cp1500pfclcd(hass):
expected_attributes = {
"device_class": "battery",
"friendly_name": "Ups1 Battery Charge",
"state": "Online",
"unit_of_measurement": PERCENTAGE,
}
# Only test for a subset of attributes in case
@ -177,7 +171,6 @@ async def test_dl650elcd(hass):
expected_attributes = {
"device_class": "battery",
"friendly_name": "Ups1 Battery Charge",
"state": "Online",
"unit_of_measurement": PERCENTAGE,
}
# Only test for a subset of attributes in case
@ -202,7 +195,6 @@ async def test_blazer_usb(hass):
expected_attributes = {
"device_class": "battery",
"friendly_name": "Ups1 Battery Charge",
"state": "Online",
"unit_of_measurement": PERCENTAGE,
}
# Only test for a subset of attributes in case