mbapi2020 icon indicating copy to clipboard operation
mbapi2020 copied to clipboard

Units not correct

Open DanDon opened this issue 3 years ago • 4 comments

Units are showing 'km' on odometer readings but the readings are in miles.

There is no way to change the unit shown. The number shown in the odometer sensor is correct but should be in miles not kilometers.

DanDon avatar Jul 09 '22 13:07 DanDon

Hi, please share some more details:

  • what is your unit configuration in the MB IOS/android app
  • What is your unit configuration in HA
  • Please share the attributes of the odometer

ReneNulschDE avatar Jul 10 '22 07:07 ReneNulschDE

I encounter the same issue. To answer the questions:

  • What is your unit configuration in the MB IOS/android app

It's miles in the Android app

  • What is your unit configuration in HA

The unit system I use is metric (Celsius, kilogram). I can't find anything about km/miles anywhere in the settings.

  • Please share the attributes of the odometer

Is it also okay to only share the ones that I think should be relevant for this issue (to not expose to much information about my car)? Let me know if you need more information.

Original value 8514
Distance unit MILES
Unit MILES
DistanceReset 5286.7
DrivenTimeReset 9657

Note that for me it shows as 5,290 km in the interface, where it should be 5,290 miles.

Tirzono avatar Oct 20 '22 10:10 Tirzono

Hi, mi is shown when you switch to the imperial system in HA. Is this an option?

ReneNulschDE avatar Oct 20 '22 10:10 ReneNulschDE

I tried switching to the imperial system, but it would not show me miles (although I didn't restart my home assistant, not sure if that would be required for it to show). However, I live in the UK but I am from the EU, so I prefer the metric system. Switching to imperial would also mess up with other things such as Fahrenheit/Celcius.

Ideally I would like to see the miles, but I could live with km's as well. However, the km's are now showing wrong.

Happy to try to make a PR for it myself if you want to?

Tirzono avatar Oct 20 '22 12:10 Tirzono

Hi,

I have rewritten the Unit Handling of this component. With the current master branch, you can define your unit-settings in the MB-me app and these settings are used in the component in HA too.

Would be good if you could test this in your instance before I publish a new version.

All changes compared to the last version 0.7.4

BREAKING CHANGES:

Units: - All units are based on the settings of the MB Me (Connect) App now.

Sensor SOC

  • added State Class measurement
  • removed attribute chargingpower (extra sensor now)

Sensor Odometer

  • removed attribute averageSpeedReset (extra sensor now)
  • removed attribute averageSpeedStart (extra sensor now)
  • removed attribute distanceReset (extra sensor now)
  • removed attribute distanceStart (extra sensor now)
  • removed attribute distanceZEReset (extra sensor now)
  • moved attribute drivenTimeZEReset to sensor distanceZEReset
  • moved attribute drivenTimeReset to sensor distanceReset
  • moved attribute drivenTimeZEReset to sensor distanceZEReset
  • removed attribute batteryState (extra sensor starterBatteryState now)
  • removed attribute ecoscoretotal (extra sensor ecoscoretotal now)
  • removed attribute ecoscorefreewhl (extra sensor ecoscorefreewhl now)
  • removed attribute ecoscorebonusrange (extra sensor ecoscorebonusrange now)
  • removed attribute ecoscoreconst (extra sensor ecoscoreconst now)
  • removed attribute ecoscoreaccel (extra sensor ecoscoreaccel now)
  • removed attribute ecoscorebonusrange (extra sensor ecoscorebonusrange now)
  • removed attribute liquidconsumptionstart (extra sensor liquidconsumptionstart now)
  • removed attribute liquidconsumptionreset (extra sensor liquidconsumptionreset now)
  • removed attribute rangeliquid (extra sensor rangeliquid now)
  • removed attribute tanklevelpercent (extra sensor tanklevelpercent exists already)

Sensor distanceZEReset

  • added attribute drivenTimeZEReset (from Odometer)

Sensor distanceStart

  • added attribute drivenTimeStart (from Odometer)

Sensor distanceReset

  • added attribute drivenTimeReset (from Odometer)

Sensor tanklevelpercent

    • added State Class measurement

ReneNulschDE avatar Dec 26 '22 15:12 ReneNulschDE

fixed with release v0.8.0b2

ReneNulschDE avatar Jan 04 '23 18:01 ReneNulschDE

I only see your message now. Thank you for fixing this. I just reinstalled the custom component and I can confirm it works!

Tirzono avatar Mar 16 '23 11:03 Tirzono