Additional parameters for devices of type 'Battery'

Hi
I have a Victron inverter with battery storage. I am monitoring various battery parameters including % charge, voltage, current, and power in/out.

I’ve started getting warnings as follows:

Sensor with invalid unit of measurement

Warning ⸱ Reported by MQTT

This stops working in version 2025.7.0. Please address before upgrading.

Manual configured Sensor entity sensor.cerbo_gx_battery_power has a configured unit of measurement W which is not valid with configured device class battery. Make sure a valid unit of measurement is configured or remove the device class, and [reload]

Manual configured Sensor entity sensor.cerbo_gx_battery_voltage has a configured unit of measurement V which is not valid with configured device class battery . Make sure a valid unit of measurement is configured or remove the device class,

Manual configured Sensor entity sensor.cerbo_gx_battery_current has a configured unit of measurement A which is not valid with configured device class battery .

All the above parameters seem to be very much part of a battery’s monitoring requirements, but the battery definition in HA only supports % Charge as a parameter
Questions:
Am I doing anything wrong?
Have I mis-understood anything?
How do I resolve this error?

Many thanks
Tim R

What integration is providing these sensors? Each of those should have a different device class, just as the warning says.

Hi Ben
Thanks for looking at this.

These values are coming from the Victron inverter via MQTT. Here’s the code snippet:



#Battery Parameters
    - state_topic: "victron/N/48e7da885427/system/0/Dc/Battery/Soc"
      name: "Battery SOC"
      unique_id: 70074556-d423-483a-b136-755b07ad1758
      icon: mdi:lightning-bolt
      device_class: battery
      state_class: measurement
      unit_of_measurement: "%"
      value_template: '{{ value_json.value | round }}'
      device: {
        identifiers: [
          "Cerbo GX"
        ],
        manufacturer: "Victron Energy",
        model: "Cerbo GX",
        name: "Cerbo GX"}

    - state_topic: "victron/N/48e7da885427/system/0/Dc/Battery/Power"
      name: "Battery Power"
      unique_id: d503cf25-70ca-4c7a-9738-616cd88e7301
      icon: mdi:lightning-bolt
      device_class: battery
      state_class: measurement
      unit_of_measurement: "W"
      value_template: '{{ value_json.value | round }}'
      device: {
        identifiers: [
          "Cerbo GX"
        ],
        manufacturer: "Victron Energy",
        model: "Cerbo GX",
        name: "Cerbo GX"}

    - state_topic: "victron/N/48e7da885427/system/0/Dc/Battery/Voltage"
      name: "Battery Voltage"
      unique_id: 8c479c17-6742-407f-97c9-d7240517945c
      icon: mdi:lightning-bolt
      device_class: battery
      state_class: measurement
      unit_of_measurement: "V"
      value_template: '{{ value_json.value | round }}'
      device: {
        identifiers: [
          "Cerbo GX"
        ],
        manufacturer: "Victron Energy",
        model: "Cerbo GX",
        name: "Cerbo GX"}

    - state_topic: "victron/N/48e7da885427/system/0/Dc/Battery/Current"
      name: "Battery Current"
      unique_id: 603de3be-c7e7-413f-ac95-58120d016308
      icon: mdi:lightning-bolt
      device_class: battery
      state_class: measurement
      unit_of_measurement: "A"
      value_template: '{{ value_json.value | round }}'
      device: {
        identifiers: [
          "Cerbo GX"
        ],
        manufacturer: "Victron Energy",
        model: "Cerbo GX",
        name: "Cerbo GX"}

Like I said, change the device class for each of those sensors to power, voltage and current as appropriate.

That was it! Many thanks for your help. I knew it had to be easy and was down to my lack of understanding.
Cheers
Tim