Skip to content

Commit

Permalink
Fix: Incorrect data type used for EntityCategory
Browse files Browse the repository at this point in the history
  • Loading branch information
a529987659852 committed Apr 3, 2022
1 parent ef4df42 commit f84e58c
Showing 1 changed file with 20 additions and 21 deletions.
41 changes: 20 additions & 21 deletions custom_components/openwbmqtt/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@
SwitchEntityDescription)
from homeassistant.const import (ELECTRIC_CURRENT_AMPERE,
ELECTRIC_POTENTIAL_VOLT,
ENERGY_KILO_WATT_HOUR, ENERGY_WATT_HOUR,
ENTITY_CATEGORY_CONFIG,
ENTITY_CATEGORY_DIAGNOSTIC, LENGTH_KILOMETERS,
ENERGY_KILO_WATT_HOUR, LENGTH_KILOMETERS,
PERCENTAGE, POWER_WATT, Platform)
from homeassistant.helpers.entity import EntityCategory

PLATFORMS = [Platform.SELECT,
Platform.SENSOR,
Expand Down Expand Up @@ -91,7 +90,7 @@ class openWBNumberEntityDescription(NumberEntityDescription):
device_class=None,
native_unit_of_measurement=None,
state_class=SensorStateClass.MEASUREMENT,
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
entity_category=EntityCategory.DIAGNOSTIC,
icon='mdi:earth',
),
openwbSensorEntityDescription(
Expand All @@ -100,7 +99,7 @@ class openWBNumberEntityDescription(NumberEntityDescription):
device_class=None,
native_unit_of_measurement=None,
state_class=SensorStateClass.MEASUREMENT,
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
entity_category=EntityCategory.DIAGNOSTIC,
icon='mdi:folder-clock',
),
openwbSensorEntityDescription(
Expand Down Expand Up @@ -199,7 +198,7 @@ class openWBNumberEntityDescription(NumberEntityDescription):
device_class=SensorDeviceClass.ENERGY,
native_unit_of_measurement=ENERGY_KILO_WATT_HOUR,
state_class=SensorStateClass.MEASUREMENT,
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
entity_category=EntityCategory.DIAGNOSTIC,
entity_registry_enabled_default=False,
),
openwbSensorEntityDescription(
Expand Down Expand Up @@ -282,7 +281,7 @@ class openWBNumberEntityDescription(NumberEntityDescription):
native_unit_of_measurement=None,
state_class=SensorStateClass.MEASUREMENT,
icon="mdi:form-textbox",
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
entity_category=EntityCategory.DIAGNOSTIC,
entity_registry_enabled_default=False,
),
openwbSensorEntityDescription(
Expand All @@ -291,7 +290,7 @@ class openWBNumberEntityDescription(NumberEntityDescription):
device_class=SensorDeviceClass.BATTERY,
native_unit_of_measurement=None,
state_class=PERCENTAGE,
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
entity_category=EntityCategory.DIAGNOSTIC,
entity_registry_enabled_default=False,
),
openwbSensorEntityDescription(
Expand All @@ -300,7 +299,7 @@ class openWBNumberEntityDescription(NumberEntityDescription):
device_class=SensorDeviceClass.BATTERY,
native_unit_of_measurement=None,
state_class=PERCENTAGE,
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
entity_category=EntityCategory.DIAGNOSTIC,
entity_registry_enabled_default=False,
),
openwbSensorEntityDescription(
Expand All @@ -309,7 +308,7 @@ class openWBNumberEntityDescription(NumberEntityDescription):
device_class=SensorDeviceClass.BATTERY,
native_unit_of_measurement=None,
state_class=PERCENTAGE,
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
entity_category=EntityCategory.DIAGNOSTIC,
entity_registry_enabled_default=False,
),
openwbSensorEntityDescription(
Expand Down Expand Up @@ -374,22 +373,22 @@ class openWBNumberEntityDescription(NumberEntityDescription):
key="boolDirectModeChargekWh",
name="Begrenzung Energie (Modus Sofortladen)",
device_class=None,
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
entity_category=EntityCategory.DIAGNOSTIC,
icon="mdi:battery-charging",
),
openwbBinarySensorEntityDescription(
key="boolDirectChargeModeSoc",
name="Begrenzung SoC (Modus Sofortladen)",
device_class=None,
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
entity_category=EntityCategory.DIAGNOSTIC,
icon="mdi:battery-unknown",
),
openwbBinarySensorEntityDescription(
key="boolChargeAtNight",
name="Nachtladen aktiv",
device_class=None,
icon="mdi:weather-night",
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
entity_category=EntityCategory.DIAGNOSTIC,
entity_registry_enabled_default=False,
),
openwbBinarySensorEntityDescription(
Expand All @@ -407,7 +406,7 @@ class openWBNumberEntityDescription(NumberEntityDescription):
SELECTS_GLOBAL = [
openwbSelectEntityDescription(
key="global/ChargeMode",
entity_category=ENTITY_CATEGORY_CONFIG,
entity_category=EntityCategory.CONFIG,
name="Lademodus",
valueMapCurrentValue={
0: "Sofortladen",
Expand Down Expand Up @@ -438,7 +437,7 @@ class openWBNumberEntityDescription(NumberEntityDescription):
SELECTS_PER_LP = [
openwbSelectEntityDescription(
key="chargeLimitation",
entity_category=ENTITY_CATEGORY_CONFIG,
entity_category=EntityCategory.CONFIG,
name="Ladebegrenzung (Modus Sofortladen)",
valueMapCurrentValue={
0: "Keine",
Expand All @@ -463,7 +462,7 @@ class openWBNumberEntityDescription(NumberEntityDescription):
SWITCHES_PER_LP = [
openwbSwitchEntityDescription(
key="ChargePointEnabled",
entity_category=ENTITY_CATEGORY_CONFIG,
entity_category=EntityCategory.CONFIG,
name = "Ladepunkt aktiv",
mqttTopicCommand="ChargePointEnabled",
mqttTopicCurrentValue="ChargePointEnabled",
Expand All @@ -481,7 +480,7 @@ class openWBNumberEntityDescription(NumberEntityDescription):
min_value=6.0,
max_value=16.0,
step=1.0,
entity_category=ENTITY_CATEGORY_CONFIG,
entity_category=EntityCategory.CONFIG,
# icon=
mqttTopicCommand="minCurrentMinPv",
mqttTopicCurrentValue="minCurrentMinPv",
Expand All @@ -499,7 +498,7 @@ class openWBNumberEntityDescription(NumberEntityDescription):
min_value=6.0,
max_value=16.0,
step=1.0,
entity_category=ENTITY_CATEGORY_CONFIG,
entity_category=EntityCategory.CONFIG,
# icon=
mqttTopicCommand="current",
mqttTopicCurrentValue="current",
Expand All @@ -514,7 +513,7 @@ class openWBNumberEntityDescription(NumberEntityDescription):
min_value=2.0,
max_value=100.0,
step=2.0,
entity_category=ENTITY_CATEGORY_CONFIG,
entity_category=EntityCategory.CONFIG,
icon="mdi:battery-charging",
mqttTopicCommand="energyToCharge",
mqttTopicCurrentValue="energyToCharge",
Expand All @@ -529,7 +528,7 @@ class openWBNumberEntityDescription(NumberEntityDescription):
min_value=5.0,
max_value=100.0,
step=5.0,
entity_category=ENTITY_CATEGORY_CONFIG,
entity_category=EntityCategory.CONFIG,
# icon=
mqttTopicCommand="socToChargeTo",
mqttTopicCurrentValue="socToChargeTo",
Expand All @@ -544,7 +543,7 @@ class openWBNumberEntityDescription(NumberEntityDescription):
min_value=0.0,
max_value=100.0,
step=1.0,
entity_category=ENTITY_CATEGORY_CONFIG,
entity_category=EntityCategory.CONFIG,
mqttTopicCommand="manualSoc",
mqttTopicCurrentValue="manualSoc",
mqttTopicChargeMode = None,
Expand Down

0 comments on commit f84e58c

Please sign in to comment.