Skip to content

Commit

Permalink
Merge pull request #584 from henricm/replace-deprecated-constants
Browse files Browse the repository at this point in the history
fix: replace deprecated constants
  • Loading branch information
argoyle authored Jul 2, 2024
2 parents f6ff69e + 1fd15f5 commit 49d2df0
Showing 1 changed file with 40 additions and 40 deletions.
80 changes: 40 additions & 40 deletions custom_components/ferroamp/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
from homeassistant.const import (
CONF_NAME,
CONF_PREFIX,
ELECTRIC_CURRENT_AMPERE,
ELECTRIC_POTENTIAL_VOLT,
FREQUENCY_HERTZ,
PERCENTAGE,
UnitOfElectricCurrent,
UnitOfElectricPotential,
UnitOfEnergy,
UnitOfFrequency,
UnitOfPower,
UnitOfTemperature,
)
Expand Down Expand Up @@ -597,9 +597,9 @@ def __init__(
self._attr_device_class = SensorDeviceClass.ENERGY
elif unit == UnitOfPower.WATT:
self._attr_device_class = SensorDeviceClass.POWER
elif unit == ELECTRIC_POTENTIAL_VOLT:
elif unit == UnitOfElectricPotential.VOLT:
self._attr_device_class = SensorDeviceClass.VOLTAGE
elif unit == ELECTRIC_CURRENT_AMPERE:
elif unit == UnitOfElectricCurrent.AMPERE:
self._attr_device_class = SensorDeviceClass.CURRENT
elif unit == UnitOfTemperature.CELSIUS:
self._attr_device_class = SensorDeviceClass.TEMPERATURE
Expand Down Expand Up @@ -853,7 +853,7 @@ def __init__(
name,
entity_prefix,
key,
ELECTRIC_POTENTIAL_VOLT,
UnitOfElectricPotential.VOLT,
icon,
device_id,
device_name,
Expand Down Expand Up @@ -993,7 +993,7 @@ def __init__(
name,
entity_prefix,
key,
ELECTRIC_CURRENT_AMPERE,
UnitOfElectricCurrent.AMPERE,
icon,
device_id,
device_name,
Expand Down Expand Up @@ -1021,7 +1021,7 @@ def __init__(
name,
entity_prefix,
key,
ELECTRIC_POTENTIAL_VOLT,
UnitOfElectricPotential.VOLT,
icon,
device_id,
device_name,
Expand Down Expand Up @@ -1707,7 +1707,7 @@ def ehub_sensors(
"Estimated Grid Frequency",
slug,
"gridfreq",
FREQUENCY_HERTZ,
UnitOfFrequency.HERTZ,
"mdi:sine-wave",
f"{slug}_{EHUB}",
EHUB_NAME,
Expand All @@ -1718,7 +1718,7 @@ def ehub_sensors(
"External Voltage",
slug,
"ul",
ELECTRIC_POTENTIAL_VOLT,
UnitOfElectricPotential.VOLT,
"mdi:current-ac",
f"{slug}_{EHUB}",
EHUB_NAME,
Expand All @@ -1730,7 +1730,7 @@ def ehub_sensors(
slug,
"ul",
"L1",
ELECTRIC_POTENTIAL_VOLT,
UnitOfElectricPotential.VOLT,
"mdi:current-ac",
f"{slug}_{EHUB}",
EHUB_NAME,
Expand All @@ -1742,7 +1742,7 @@ def ehub_sensors(
slug,
"ul",
"L2",
ELECTRIC_POTENTIAL_VOLT,
UnitOfElectricPotential.VOLT,
"mdi:current-ac",
f"{slug}_{EHUB}",
EHUB_NAME,
Expand All @@ -1754,7 +1754,7 @@ def ehub_sensors(
slug,
"ul",
"L3",
ELECTRIC_POTENTIAL_VOLT,
UnitOfElectricPotential.VOLT,
"mdi:current-ac",
f"{slug}_{EHUB}",
EHUB_NAME,
Expand All @@ -1765,7 +1765,7 @@ def ehub_sensors(
"Inverter RMS Current",
slug,
"il",
ELECTRIC_CURRENT_AMPERE,
UnitOfElectricCurrent.AMPERE,
"mdi:current-dc",
f"{slug}_{EHUB}",
EHUB_NAME,
Expand All @@ -1777,7 +1777,7 @@ def ehub_sensors(
slug,
"il",
"L1",
ELECTRIC_CURRENT_AMPERE,
UnitOfElectricCurrent.AMPERE,
"mdi:current-dc",
f"{slug}_{EHUB}",
EHUB_NAME,
Expand All @@ -1789,7 +1789,7 @@ def ehub_sensors(
slug,
"il",
"L2",
ELECTRIC_CURRENT_AMPERE,
UnitOfElectricCurrent.AMPERE,
"mdi:current-dc",
f"{slug}_{EHUB}",
EHUB_NAME,
Expand All @@ -1801,7 +1801,7 @@ def ehub_sensors(
slug,
"il",
"L3",
ELECTRIC_CURRENT_AMPERE,
UnitOfElectricCurrent.AMPERE,
"mdi:current-dc",
f"{slug}_{EHUB}",
EHUB_NAME,
Expand All @@ -1812,7 +1812,7 @@ def ehub_sensors(
"Inverter Reactive Current",
slug,
"ild",
ELECTRIC_CURRENT_AMPERE,
UnitOfElectricCurrent.AMPERE,
"mdi:current-dc",
f"{slug}_{EHUB}",
EHUB_NAME,
Expand All @@ -1824,7 +1824,7 @@ def ehub_sensors(
slug,
"ild",
"L1",
ELECTRIC_CURRENT_AMPERE,
UnitOfElectricCurrent.AMPERE,
"mdi:current-dc",
f"{slug}_{EHUB}",
EHUB_NAME,
Expand All @@ -1836,7 +1836,7 @@ def ehub_sensors(
slug,
"ild",
"L2",
ELECTRIC_CURRENT_AMPERE,
UnitOfElectricCurrent.AMPERE,
"mdi:current-dc",
f"{slug}_{EHUB}",
EHUB_NAME,
Expand All @@ -1848,7 +1848,7 @@ def ehub_sensors(
slug,
"ild",
"L3",
ELECTRIC_CURRENT_AMPERE,
UnitOfElectricCurrent.AMPERE,
"mdi:current-dc",
f"{slug}_{EHUB}",
EHUB_NAME,
Expand All @@ -1859,7 +1859,7 @@ def ehub_sensors(
"Grid Current",
slug,
"iext",
ELECTRIC_CURRENT_AMPERE,
UnitOfElectricCurrent.AMPERE,
"mdi:current-ac",
f"{slug}_{EHUB}",
EHUB_NAME,
Expand All @@ -1871,7 +1871,7 @@ def ehub_sensors(
slug,
"iext",
"L1",
ELECTRIC_CURRENT_AMPERE,
UnitOfElectricCurrent.AMPERE,
"mdi:current-ac",
f"{slug}_{EHUB}",
EHUB_NAME,
Expand All @@ -1883,7 +1883,7 @@ def ehub_sensors(
slug,
"iext",
"L2",
ELECTRIC_CURRENT_AMPERE,
UnitOfElectricCurrent.AMPERE,
"mdi:current-ac",
f"{slug}_{EHUB}",
EHUB_NAME,
Expand All @@ -1895,7 +1895,7 @@ def ehub_sensors(
slug,
"iext",
"L3",
ELECTRIC_CURRENT_AMPERE,
UnitOfElectricCurrent.AMPERE,
"mdi:current-ac",
f"{slug}_{EHUB}",
EHUB_NAME,
Expand All @@ -1906,7 +1906,7 @@ def ehub_sensors(
"Grid Reactive Current",
slug,
"iextd",
ELECTRIC_CURRENT_AMPERE,
UnitOfElectricCurrent.AMPERE,
"mdi:current-ac",
f"{slug}_{EHUB}",
EHUB_NAME,
Expand All @@ -1918,7 +1918,7 @@ def ehub_sensors(
slug,
"iextd",
"L1",
ELECTRIC_CURRENT_AMPERE,
UnitOfElectricCurrent.AMPERE,
"mdi:current-ac",
f"{slug}_{EHUB}",
EHUB_NAME,
Expand All @@ -1930,7 +1930,7 @@ def ehub_sensors(
slug,
"iextd",
"L2",
ELECTRIC_CURRENT_AMPERE,
UnitOfElectricCurrent.AMPERE,
"mdi:current-ac",
f"{slug}_{EHUB}",
EHUB_NAME,
Expand All @@ -1942,7 +1942,7 @@ def ehub_sensors(
slug,
"iextd",
"L3",
ELECTRIC_CURRENT_AMPERE,
UnitOfElectricCurrent.AMPERE,
"mdi:current-ac",
f"{slug}_{EHUB}",
EHUB_NAME,
Expand All @@ -1953,7 +1953,7 @@ def ehub_sensors(
"External Active Current",
slug,
"iextq",
ELECTRIC_CURRENT_AMPERE,
UnitOfElectricCurrent.AMPERE,
"mdi:current-ac",
f"{slug}_{EHUB}",
EHUB_NAME,
Expand All @@ -1965,7 +1965,7 @@ def ehub_sensors(
slug,
"iextq",
"L1",
ELECTRIC_CURRENT_AMPERE,
UnitOfElectricCurrent.AMPERE,
"mdi:current-ac",
f"{slug}_{EHUB}",
EHUB_NAME,
Expand All @@ -1977,7 +1977,7 @@ def ehub_sensors(
slug,
"iextq",
"L2",
ELECTRIC_CURRENT_AMPERE,
UnitOfElectricCurrent.AMPERE,
"mdi:current-ac",
f"{slug}_{EHUB}",
EHUB_NAME,
Expand All @@ -1989,7 +1989,7 @@ def ehub_sensors(
slug,
"iextq",
"L3",
ELECTRIC_CURRENT_AMPERE,
UnitOfElectricCurrent.AMPERE,
"mdi:current-ac",
f"{slug}_{EHUB}",
EHUB_NAME,
Expand All @@ -2000,7 +2000,7 @@ def ehub_sensors(
"Adaptive Current Equalization",
slug,
"iace",
ELECTRIC_CURRENT_AMPERE,
UnitOfElectricCurrent.AMPERE,
"mdi:current-ac",
f"{slug}_{EHUB}",
EHUB_NAME,
Expand All @@ -2012,7 +2012,7 @@ def ehub_sensors(
slug,
"iace",
"L1",
ELECTRIC_CURRENT_AMPERE,
UnitOfElectricCurrent.AMPERE,
"mdi:current-ac",
f"{slug}_{EHUB}",
EHUB_NAME,
Expand All @@ -2024,7 +2024,7 @@ def ehub_sensors(
slug,
"iace",
"L2",
ELECTRIC_CURRENT_AMPERE,
UnitOfElectricCurrent.AMPERE,
"mdi:current-ac",
f"{slug}_{EHUB}",
EHUB_NAME,
Expand All @@ -2036,7 +2036,7 @@ def ehub_sensors(
slug,
"iace",
"L3",
ELECTRIC_CURRENT_AMPERE,
UnitOfElectricCurrent.AMPERE,
"mdi:current-ac",
f"{slug}_{EHUB}",
EHUB_NAME,
Expand Down Expand Up @@ -2682,7 +2682,7 @@ def ehub_sensors(
"Available Three Phase Active Current For Load Balancing",
slug,
"iavblq_3p",
ELECTRIC_CURRENT_AMPERE,
UnitOfElectricCurrent.AMPERE,
"mdi:current-ac",
f"{slug}_{EHUB}",
EHUB_NAME,
Expand All @@ -2695,7 +2695,7 @@ def ehub_sensors(
"Available Active Current For Load Balancing",
slug,
"iavblq",
ELECTRIC_CURRENT_AMPERE,
UnitOfElectricCurrent.AMPERE,
"mdi:current-ac",
f"{slug}_{EHUB}",
EHUB_NAME,
Expand All @@ -2707,7 +2707,7 @@ def ehub_sensors(
"Available RMS Current For Load Balancing",
slug,
"iavbl",
ELECTRIC_CURRENT_AMPERE,
UnitOfElectricCurrent.AMPERE,
"mdi:current-ac",
f"{slug}_{EHUB}",
EHUB_NAME,
Expand Down

0 comments on commit 49d2df0

Please sign in to comment.