Depricated NumberEntity Features

Hi,
I am getting the following errors from an Intergration since one of the recent updates:

 Logger: homeassistant.components.number
Source: components/number/__init__.py:462
Integration: Nummer (documentation, issues)
First occurred: 14. Juli 2022 um 16:10:04 (10 occurrences)
Last logged: 08:54:14

    Entity number.openWB-Mindestladestrom (Modus Min+PV-Laden) (<class 'custom_components.openwbmqtt.number.openWBNumber'>) is using deprecated NumberEntity features which will be unsupported from Home Assistant Core 2022.10, please report it to the custom component author.
    Entity number.openWB-CP1-Ladestromvorgabe (Modus Sofortladen) (<class 'custom_components.openwbmqtt.number.openWBNumber'>) is using deprecated NumberEntity features which will be unsupported from Home Assistant Core 2022.10, please report it to the custom component author.
    Entity number.openWB-CP1-Energiebegrenzung (Modus Sofortladen) (<class 'custom_components.openwbmqtt.number.openWBNumber'>) is using deprecated NumberEntity features which will be unsupported from Home Assistant Core 2022.10, please report it to the custom component author.
    Entity number.openWB-CP1-SoC-Begrenzung (Modus Sofortladen) (<class 'custom_components.openwbmqtt.number.openWBNumber'>) is using deprecated NumberEntity features which will be unsupported from Home Assistant Core 2022.10, please report it to the custom component author.
    Entity number.openWB-CP1-Aktueller SoC (Manuelles SoC Modul) (<class 'custom_components.openwbmqtt.number.openWBNumber'>) is using deprecated NumberEntity features which will be unsupported from Home Assistant Core 2022.10, please report it to the custom component author.

My main issue is, that I am trying to fix this integration on my own - since the developer reported, he does not have the time to continue developing at the moment.

Now I am trying to figure out, which “features” were depricated - and need some further feedback on this…
My major issue atm is that I don’t find a clear description where / what I need to change / remove… :frowning:

this is one of my “number entities” for example:

NUMBERS_GLOBAL = [
    openWBNumberEntityDescription(
        key="minCurrentMinPv",
        name="Mindestladestrom (Modus Min+PV-Laden)",
        unit_of_measurement=ELECTRIC_CURRENT_AMPERE,
        device_class="Power",
        min_value=6.0,
        max_value=16.0,
        step=1.0,
        entity_category=EntityCategory.CONFIG,
        # icon=
        mqttTopicCommand="minCurrentMinPv",
        mqttTopicCurrentValue="minCurrentMinPv",
        mqttTopicChargeMode="pv",
        icon="mdi:current-ac",
    ),
]

while the code behind it is this:

 def __init__(
        self,
        unique_id: str,
        device_friendly_name: str,
        mqtt_root: str,
        description: openWBNumberEntityDescription,
        state: float | None = None,
        currentChargePoint: int | None = None,
        nChargePoints: int | None = None,
        min_value: float | None = None,
        max_value: float | None = None,
        step: float | None = None,
        mode: NumberMode = NumberMode.AUTO,
    ) -> None:
        """Initialize the sensor and the openWB device."""
        super().__init__(
            device_friendly_name=device_friendly_name,
            mqtt_root=mqtt_root,
        )

...
        if min_value is not None:
            self._attr_min_value = min_value
        if max_value is not None:
            self._attr_max_value = max_value
        if step is not None:
            self._attr_step = step

I am trying to follow this documentation:

But can someone please let me know, what features exactly were removed?
Or what exactly has changed?

That would help me a lot in trying to fix this.

And sorry - I don’t have much development experience - and even less in case of HomeAssistant or this integration :frowning:

Basically you need to rename the following:

unit_of_measurement - native_unit_of_measurement
min_value - native_min_value
max_value - native_max_value
step - native_step
value - native_value

1 Like

Check here, you will see where it is originated from.

self.max_value is not None
            or self.min_value is not None
            or self.step is not None
            or self.unit_of_measurement is not None

core/homeassistant/components/number at f31f2cca07135d7b20452cfc5db59f92dc4fa9a2 · home-assistant/core · GitHubinit.py#L147

1 Like

Thansk :slight_smile: (y)

This is on openwbmqtt?
Did anyone already fix it?

Hi, I haven’t yet fixed this on my fork - since I am facing other issues with the integration for which I have no Idea how to fix them…

The Integration - or at least the fact that the OpenWB is using MQTT is causing some issues whenever the Wallbox will be rebooted.
Then, HomeAssistant is receiving some old values from the meters - which aren’t valid anymore (this is, because the Wallbox does only update some of the MQTT Topics whenever there are changes…

If a sensor has not changed for some time (because you haven’t charged your car for a few days) - and reboot the wallbox, MQTT is resending one of the previous values - which will then be added to the previous sensors state.

So maybe - the whole architecture of the integration needs to be reviewed… which I can’t do.
But I will try to get the above issue fixed before 2022.10 will be released

Hi, is there any news on this topic? I fear the Integration will break with 2022.10.

Should be fixed with release v0.4 of my fork which is available in HACS

Thank you so much, Christoph!