Skip to content

Commit

Permalink
Merge pull request #25 from CJNE/CJNE-patch-units
Browse files Browse the repository at this point in the history
New unit names, fixes #24
  • Loading branch information
CJNE authored Aug 4, 2021
2 parents e7f43c3 + 6a43f1b commit 1228946
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions custom_components/sunspec/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
from homeassistant.const import DEVICE_CLASS_POWER
from homeassistant.const import DEVICE_CLASS_TEMPERATURE
from homeassistant.const import DEVICE_CLASS_VOLTAGE
from homeassistant.const import ELECTRICAL_CURRENT_AMPERE
from homeassistant.const import ELECTRICAL_VOLT_AMPERE
from homeassistant.const import ELECTRIC_CURRENT_AMPERE
from homeassistant.const import POWER_VOLT_AMPERE
from homeassistant.const import ENERGY_KILO_WATT_HOUR
from homeassistant.const import ENERGY_WATT_HOUR
from homeassistant.const import FREQUENCY_HERTZ
Expand Down Expand Up @@ -43,12 +43,12 @@
ICON_TEMP = "mdi:thermometer"

HA_META = {
"A": [ELECTRICAL_CURRENT_AMPERE, ICON_AC_AMPS, DEVICE_CLASS_CURRENT],
"A": [ELECTRIC_CURRENT_AMPERE, ICON_AC_AMPS, DEVICE_CLASS_CURRENT],
"HPa": [PRESSURE_HPA, ICON_DEFAULT, DEVICE_CLASS_TEMPERATURE],
"Hz": [FREQUENCY_HERTZ, ICON_FREQ, None],
"Mbps": [DATA_RATE_MEGABITS_PER_SECOND, ICON_DEFAULT, None],
"V": [VOLT, ICON_VOLT, DEVICE_CLASS_VOLTAGE],
"VA": [ELECTRICAL_VOLT_AMPERE, ICON_POWER, DEVICE_CLASS_POWER],
"VA": [POWER_VOLT_AMPERE, ICON_POWER, DEVICE_CLASS_POWER],
"W": [POWER_WATT, ICON_POWER, DEVICE_CLASS_POWER],
"W/m2": [IRRADIATION_WATTS_PER_SQUARE_METER, ICON_DEFAULT, None],
"Wh": [ENERGY_WATT_HOUR, ICON_ENERGY, DEVICE_CLASS_ENERGY],
Expand Down Expand Up @@ -119,7 +119,7 @@ def __init__(self, coordinator, config_entry, data):
name = f"{name} {key_parts[0]} {key_parts[1]}"

desc = self._meta.get("desc", self._meta.get("label", self.key))
if self.unit == ELECTRICAL_CURRENT_AMPERE and "DC" in desc:
if self.unit == ELECTRIC_CURRENT_AMPERE and "DC" in desc:
self.use_icon = ICON_DC_AMPS

if data["prefix"] != "":
Expand Down

0 comments on commit 1228946

Please sign in to comment.