From 7858b599449d1aa90c4f6a10c62c098a2e66deb7 Mon Sep 17 00:00:00 2001 From: Maciej Bieniek Date: Fri, 19 Mar 2021 10:25:17 +0100 Subject: [PATCH] Use device class voltage in NUT integration (#48096) --- homeassistant/components/nut/const.py | 36 +++++++++++++++++++-------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/homeassistant/components/nut/const.py b/homeassistant/components/nut/const.py index b8b315df59e..890ac3697dd 100644 --- a/homeassistant/components/nut/const.py +++ b/homeassistant/components/nut/const.py @@ -4,6 +4,7 @@ from homeassistant.components.sensor import ( DEVICE_CLASS_HUMIDITY, DEVICE_CLASS_POWER, DEVICE_CLASS_TEMPERATURE, + DEVICE_CLASS_VOLTAGE, ) from homeassistant.const import ( ELECTRICAL_CURRENT_AMPERE, @@ -120,10 +121,15 @@ SENSOR_TYPES = { None, ], "battery.charger.status": ["Charging Status", "", "mdi:information-outline", None], - "battery.voltage": ["Battery Voltage", VOLT, "mdi:flash", None], - "battery.voltage.nominal": ["Nominal Battery Voltage", VOLT, "mdi:flash", None], - "battery.voltage.low": ["Low Battery Voltage", VOLT, "mdi:flash", None], - "battery.voltage.high": ["High Battery Voltage", VOLT, "mdi:flash", None], + "battery.voltage": ["Battery Voltage", VOLT, None, DEVICE_CLASS_VOLTAGE], + "battery.voltage.nominal": [ + "Nominal Battery Voltage", + VOLT, + None, + DEVICE_CLASS_VOLTAGE, + ], + "battery.voltage.low": ["Low Battery Voltage", VOLT, None, DEVICE_CLASS_VOLTAGE], + "battery.voltage.high": ["High Battery Voltage", VOLT, None, DEVICE_CLASS_VOLTAGE], "battery.capacity": ["Battery Capacity", "Ah", "mdi:flash", None], "battery.current": [ "Battery Current", @@ -178,16 +184,21 @@ SENSOR_TYPES = { "mdi:information-outline", None, ], - "input.transfer.low": ["Low Voltage Transfer", VOLT, "mdi:flash", None], - "input.transfer.high": ["High Voltage Transfer", VOLT, "mdi:flash", None], + "input.transfer.low": ["Low Voltage Transfer", VOLT, None, DEVICE_CLASS_VOLTAGE], + "input.transfer.high": ["High Voltage Transfer", VOLT, None, DEVICE_CLASS_VOLTAGE], "input.transfer.reason": [ "Voltage Transfer Reason", "", "mdi:information-outline", None, ], - "input.voltage": ["Input Voltage", VOLT, "mdi:flash", None], - "input.voltage.nominal": ["Nominal Input Voltage", VOLT, "mdi:flash", None], + "input.voltage": ["Input Voltage", VOLT, None, DEVICE_CLASS_VOLTAGE], + "input.voltage.nominal": [ + "Nominal Input Voltage", + VOLT, + None, + DEVICE_CLASS_VOLTAGE, + ], "input.frequency": ["Input Line Frequency", FREQUENCY_HERTZ, "mdi:flash", None], "input.frequency.nominal": [ "Nominal Input Line Frequency", @@ -208,8 +219,13 @@ SENSOR_TYPES = { "mdi:flash", None, ], - "output.voltage": ["Output Voltage", VOLT, "mdi:flash", None], - "output.voltage.nominal": ["Nominal Output Voltage", VOLT, "mdi:flash", None], + "output.voltage": ["Output Voltage", VOLT, None, DEVICE_CLASS_VOLTAGE], + "output.voltage.nominal": [ + "Nominal Output Voltage", + VOLT, + None, + DEVICE_CLASS_VOLTAGE, + ], "output.frequency": ["Output Frequency", FREQUENCY_HERTZ, "mdi:flash", None], "output.frequency.nominal": [ "Nominal Output Frequency",