mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Remove unnecessary extra attribute from NUT sensors (#56078)
This commit is contained in:
parent
bd18bc9f3a
commit
b11db0b1d7
@ -5,7 +5,7 @@ import logging
|
|||||||
|
|
||||||
from homeassistant.components.nut import PyNUTData
|
from homeassistant.components.nut import PyNUTData
|
||||||
from homeassistant.components.sensor import SensorEntity, SensorEntityDescription
|
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 (
|
from homeassistant.helpers.update_coordinator import (
|
||||||
CoordinatorEntity,
|
CoordinatorEntity,
|
||||||
DataUpdateCoordinator,
|
DataUpdateCoordinator,
|
||||||
@ -133,11 +133,6 @@ class NUTSensor(CoordinatorEntity, SensorEntity):
|
|||||||
return _format_display_state(self._data.status)
|
return _format_display_state(self._data.status)
|
||||||
return self._data.status.get(self.entity_description.key)
|
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):
|
def _format_display_state(status):
|
||||||
"""Return UPS display state."""
|
"""Return UPS display state."""
|
||||||
|
@ -21,7 +21,6 @@ async def test_pr3000rt2u(hass):
|
|||||||
expected_attributes = {
|
expected_attributes = {
|
||||||
"device_class": "battery",
|
"device_class": "battery",
|
||||||
"friendly_name": "Ups1 Battery Charge",
|
"friendly_name": "Ups1 Battery Charge",
|
||||||
"state": "Online",
|
|
||||||
"unit_of_measurement": PERCENTAGE,
|
"unit_of_measurement": PERCENTAGE,
|
||||||
}
|
}
|
||||||
# Only test for a subset of attributes in case
|
# Only test for a subset of attributes in case
|
||||||
@ -47,7 +46,6 @@ async def test_cp1350c(hass):
|
|||||||
expected_attributes = {
|
expected_attributes = {
|
||||||
"device_class": "battery",
|
"device_class": "battery",
|
||||||
"friendly_name": "Ups1 Battery Charge",
|
"friendly_name": "Ups1 Battery Charge",
|
||||||
"state": "Online",
|
|
||||||
"unit_of_measurement": PERCENTAGE,
|
"unit_of_measurement": PERCENTAGE,
|
||||||
}
|
}
|
||||||
# Only test for a subset of attributes in case
|
# Only test for a subset of attributes in case
|
||||||
@ -72,7 +70,6 @@ async def test_5e850i(hass):
|
|||||||
expected_attributes = {
|
expected_attributes = {
|
||||||
"device_class": "battery",
|
"device_class": "battery",
|
||||||
"friendly_name": "Ups1 Battery Charge",
|
"friendly_name": "Ups1 Battery Charge",
|
||||||
"state": "Online",
|
|
||||||
"unit_of_measurement": PERCENTAGE,
|
"unit_of_measurement": PERCENTAGE,
|
||||||
}
|
}
|
||||||
# Only test for a subset of attributes in case
|
# Only test for a subset of attributes in case
|
||||||
@ -97,7 +94,6 @@ async def test_5e650i(hass):
|
|||||||
expected_attributes = {
|
expected_attributes = {
|
||||||
"device_class": "battery",
|
"device_class": "battery",
|
||||||
"friendly_name": "Ups1 Battery Charge",
|
"friendly_name": "Ups1 Battery Charge",
|
||||||
"state": "Online Battery Charging",
|
|
||||||
"unit_of_measurement": PERCENTAGE,
|
"unit_of_measurement": PERCENTAGE,
|
||||||
}
|
}
|
||||||
# Only test for a subset of attributes in case
|
# Only test for a subset of attributes in case
|
||||||
@ -125,7 +121,6 @@ async def test_backupsses600m1(hass):
|
|||||||
expected_attributes = {
|
expected_attributes = {
|
||||||
"device_class": "battery",
|
"device_class": "battery",
|
||||||
"friendly_name": "Ups1 Battery Charge",
|
"friendly_name": "Ups1 Battery Charge",
|
||||||
"state": "Online",
|
|
||||||
"unit_of_measurement": PERCENTAGE,
|
"unit_of_measurement": PERCENTAGE,
|
||||||
}
|
}
|
||||||
# Only test for a subset of attributes in case
|
# Only test for a subset of attributes in case
|
||||||
@ -152,7 +147,6 @@ async def test_cp1500pfclcd(hass):
|
|||||||
expected_attributes = {
|
expected_attributes = {
|
||||||
"device_class": "battery",
|
"device_class": "battery",
|
||||||
"friendly_name": "Ups1 Battery Charge",
|
"friendly_name": "Ups1 Battery Charge",
|
||||||
"state": "Online",
|
|
||||||
"unit_of_measurement": PERCENTAGE,
|
"unit_of_measurement": PERCENTAGE,
|
||||||
}
|
}
|
||||||
# Only test for a subset of attributes in case
|
# Only test for a subset of attributes in case
|
||||||
@ -177,7 +171,6 @@ async def test_dl650elcd(hass):
|
|||||||
expected_attributes = {
|
expected_attributes = {
|
||||||
"device_class": "battery",
|
"device_class": "battery",
|
||||||
"friendly_name": "Ups1 Battery Charge",
|
"friendly_name": "Ups1 Battery Charge",
|
||||||
"state": "Online",
|
|
||||||
"unit_of_measurement": PERCENTAGE,
|
"unit_of_measurement": PERCENTAGE,
|
||||||
}
|
}
|
||||||
# Only test for a subset of attributes in case
|
# Only test for a subset of attributes in case
|
||||||
@ -202,7 +195,6 @@ async def test_blazer_usb(hass):
|
|||||||
expected_attributes = {
|
expected_attributes = {
|
||||||
"device_class": "battery",
|
"device_class": "battery",
|
||||||
"friendly_name": "Ups1 Battery Charge",
|
"friendly_name": "Ups1 Battery Charge",
|
||||||
"state": "Online",
|
|
||||||
"unit_of_measurement": PERCENTAGE,
|
"unit_of_measurement": PERCENTAGE,
|
||||||
}
|
}
|
||||||
# Only test for a subset of attributes in case
|
# Only test for a subset of attributes in case
|
||||||
|
Loading…
x
Reference in New Issue
Block a user