diff --git a/custom_components/openwbmqtt/const.py b/custom_components/openwbmqtt/const.py index 67bed48..8743656 100644 --- a/custom_components/openwbmqtt/const.py +++ b/custom_components/openwbmqtt/const.py @@ -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, @@ -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( @@ -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( @@ -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( @@ -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( @@ -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( @@ -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( @@ -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( @@ -374,14 +373,14 @@ 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( @@ -389,7 +388,7 @@ class openWBNumberEntityDescription(NumberEntityDescription): 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( @@ -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", @@ -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", @@ -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", @@ -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", @@ -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", @@ -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", @@ -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", @@ -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,