Skip to content

Commit

Permalink
fix device classes [#46]
Browse files Browse the repository at this point in the history
2024.10.0
  • Loading branch information
marq24 committed Oct 5, 2024
1 parent 95dba4d commit 460fa6e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
26 changes: 12 additions & 14 deletions custom_components/tibber_local/const.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
from typing import Final
from dataclasses import dataclass
from typing import Final

from homeassistant.components.sensor import (
SensorDeviceClass,
SensorEntityDescription,
SensorStateClass,
)

from homeassistant.const import (
UnitOfElectricPotential,
UnitOfElectricCurrent,
Expand All @@ -15,7 +14,6 @@
UnitOfPower,
DEGREE,
)
from homeassistant.helpers.entity import EntityCategory

DOMAIN: Final = "tibber_local"
MANUFACTURE: Final = "Tibber"
Expand Down Expand Up @@ -133,7 +131,7 @@ class ExtSensorEntityDescription(SensorEntityDescription):
name="Potential L1",
native_unit_of_measurement=UnitOfElectricPotential.VOLT,
icon="mdi:lightning-bolt",
device_class=SensorDeviceClass.ENERGY,
device_class=SensorDeviceClass.VOLTAGE,
state_class=SensorStateClass.MEASUREMENT,
),
# Spannung L2
Expand All @@ -142,7 +140,7 @@ class ExtSensorEntityDescription(SensorEntityDescription):
name="Potential L2",
native_unit_of_measurement=UnitOfElectricPotential.VOLT,
icon="mdi:lightning-bolt",
device_class=SensorDeviceClass.ENERGY,
device_class=SensorDeviceClass.VOLTAGE,
state_class=SensorStateClass.MEASUREMENT,
),
# Spannung L3
Expand All @@ -151,7 +149,7 @@ class ExtSensorEntityDescription(SensorEntityDescription):
name="Potential L3",
native_unit_of_measurement=UnitOfElectricPotential.VOLT,
icon="mdi:lightning-bolt",
device_class=SensorDeviceClass.ENERGY,
device_class=SensorDeviceClass.VOLTAGE,
state_class=SensorStateClass.MEASUREMENT,
),

Expand All @@ -161,7 +159,7 @@ class ExtSensorEntityDescription(SensorEntityDescription):
name="Current L1",
native_unit_of_measurement=UnitOfElectricCurrent.AMPERE,
icon="mdi:current-ac",
device_class=SensorDeviceClass.ENERGY,
device_class=SensorDeviceClass.CURRENT,
state_class=SensorStateClass.MEASUREMENT,
),
# Strom L2
Expand All @@ -170,7 +168,7 @@ class ExtSensorEntityDescription(SensorEntityDescription):
name="Current L2",
native_unit_of_measurement=UnitOfElectricCurrent.AMPERE,
icon="mdi:current-ac",
device_class=SensorDeviceClass.ENERGY,
device_class=SensorDeviceClass.CURRENT,
state_class=SensorStateClass.MEASUREMENT,
),
# Strom L3
Expand All @@ -179,7 +177,7 @@ class ExtSensorEntityDescription(SensorEntityDescription):
name="Current L3",
native_unit_of_measurement=UnitOfElectricCurrent.AMPERE,
icon="mdi:current-ac",
device_class=SensorDeviceClass.ENERGY,
device_class=SensorDeviceClass.CURRENT,
state_class=SensorStateClass.MEASUREMENT,
),

Expand All @@ -200,7 +198,7 @@ class ExtSensorEntityDescription(SensorEntityDescription):
suggested_display_precision=1,
native_unit_of_measurement=DEGREE,
icon="mdi:sine-wave",
device_class=SensorDeviceClass.POWER,
device_class=None,
state_class=SensorStateClass.MEASUREMENT,
),
# Phasenabweichung Spannungen L1/L3
Expand All @@ -210,7 +208,7 @@ class ExtSensorEntityDescription(SensorEntityDescription):
suggested_display_precision=1,
native_unit_of_measurement=DEGREE,
icon="mdi:sine-wave",
device_class=SensorDeviceClass.POWER,
device_class=None,
state_class=SensorStateClass.MEASUREMENT,
),

Expand All @@ -221,7 +219,7 @@ class ExtSensorEntityDescription(SensorEntityDescription):
suggested_display_precision=1,
native_unit_of_measurement=DEGREE,
icon="mdi:sine-wave",
device_class=SensorDeviceClass.ENERGY,
device_class=None,
state_class=SensorStateClass.MEASUREMENT,
),
# Phasenabweichung Strom/Spannung L2
Expand All @@ -231,7 +229,7 @@ class ExtSensorEntityDescription(SensorEntityDescription):
suggested_display_precision=1,
native_unit_of_measurement=DEGREE,
icon="mdi:sine-wave",
device_class=SensorDeviceClass.ENERGY,
device_class=None,
state_class=SensorStateClass.MEASUREMENT,
),
# Phasenabweichung Strom/Spannung L3
Expand All @@ -241,7 +239,7 @@ class ExtSensorEntityDescription(SensorEntityDescription):
suggested_display_precision=1,
native_unit_of_measurement=DEGREE,
icon="mdi:sine-wave",
device_class=SensorDeviceClass.ENERGY,
device_class=None,
state_class=SensorStateClass.MEASUREMENT,
),
]
2 changes: 1 addition & 1 deletion custom_components/tibber_local/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
"iot_class": "local_polling",
"issue_tracker": "https://github.com/marq24/ha-tibber-pulse-local/issues",
"requirements": ["smllib==1.4"],
"version": "2024.9.0"
"version": "2024.10.0"
}

0 comments on commit 460fa6e

Please sign in to comment.