kia_uvo: Missing Range (Petrol only)

Looks great so far, I’m currently using NR and Bluelinky so this is a great progression

There is a missing entity for me, the fuel range, signified in the vehicle data as dte: value: unit: 3 is miles. Also would it be possible for an option for the odometer to be in miles also ? No problem if not, I’ll just create a template sensor.

vehicle_data: 
vehicleLocation:
  coord:
    lat: xxxxxxxxx
    lon: -xxxxxxxxx
    alt: 0
    type: 0
  head: 2
  speed:
    value: 0
    unit: 1
  accuracy:
    hdop: 10
    pdop: 10
  time: '20210410224324'
vehicleStatus:
  airCtrlOn: false
  engine: false
  doorLock: true
  doorOpen:
    frontLeft: 0
    frontRight: 0
    backLeft: 0
    backRight: 0
  trunkOpen: false
  airTemp:
    value: 01H
    unit: 0
    hvacTempType: 1
  defrost: false
  lowFuelLight: false
  acc: false
  hoodOpen: false
  steerWheelHeat: 0
  sideBackWindowHeat: 0
  dte:
    value: 106
    unit: 3
  tirePressureLamp:
    tirePressureLampAll: 0
    tirePressureLampFL: 0
    tirePressureLampFR: 0
    tirePressureLampRL: 0
    tirePressureLampRR: 0
  battery:
    batSoc: 61
    batState: 0
  time: '20210410224323'
odometer:
  value: 4175.7
  unit: 1

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 16 (12 by maintainers)

Most upvoted comments

It looks good to me. If it works, I’m good with the solution - many ways to get the same end result.

I’d probably import the “km” and “mi” strings from homeassistant.const but that’s just because I prefer importing the strings from there if they exist, and then have the following just after the imports in the file - DISTANCE_UNITS = {1: LENGTH_KILOMETERS, 3: LENGTH_MILES}

and then instead of lines 93-96 I think you can just have: self._unit = DISTANCE_UNITS[found_unit] in a similar way to what was in my PR, but I’m fine with the way you’ve done it too.