Hyundai-Kia-Connect / kia_uvo

A Home Assistant HACS integration that supports Kia Connect(Uvo) and Hyundai Bluelink. The integration supports the EU, Canada and the USA.
MIT License
413 stars 85 forks source link

feat: add window status #593

Closed hmmbob closed 1 year ago

hmmbob commented 1 year ago

Is your feature request related to a problem? Please describe. The integration doesn't show the window status, whilst the app is bugging me that the windows are open.

Describe the solution you'd like Window status (open/closed) to be avail in the sensors.

Include the logs of the end point from Data in HA if this is a sensor Data is already available:

  windowOpen:
    frontLeft: 1
    frontRight: 1
    backLeft: 1
    backRight: 1

# 1 is open, 0 is closed.

Dumping complete sensor.tucson_data (windowOpen is at the bottom more or less):

vehicle_data: 
vehicleLocation:
  coord:
    lat: 51.redacted
    lon: 5.redacted
    alt: 0
    type: 0
  head: 165
  speed:
    value: 0
    unit: 0
  accuracy:
    hdop: 0
    pdop: 0
  time: '20230210153314'
vehicleStatus:
  airCtrlOn: false
  engine: false
  doorLock: true
  doorOpen:
    frontLeft: 0
    frontRight: 0
    backLeft: 0
    backRight: 0
  trunkOpen: false
  airTemp:
    value: 00H
    unit: 0
    hvacTempType: 1
  defrost: false
  lowFuelLight: false
  acc: false
  evStatus:
    batteryCharge: false
    batteryStatus: 93
    batteryPlugin: 0
    remainTime2:
      etc2:
        value: 30
        unit: 1
      etc3:
        value: 15
        unit: 1
      atc:
        value: 15
        unit: 1
    drvDistance:
      - rangeByFuel:
          gasModeRange:
            value: 219
            unit: 1
          evModeRange:
            value: 55
            unit: 1
          totalAvailableRange:
            value: 274
            unit: 1
        type: 2
    reservChargeInfos:
      reservChargeInfo:
        reservChargeInfoDetail:
          reservInfo:
            day:
              - 9
            time:
              time: '1200'
              timeSection: 0
          reservChargeSet: false
      offpeakPowerInfo:
        offPeakPowerTime1:
          starttime:
            time: '1200'
            timeSection: 0
          endtime:
            time: '1200'
            timeSection: 0
        offPeakPowerFlag: 0
      reserveChargeInfo2:
        reservChargeInfoDetail:
          reservInfo:
            day:
              - 9
            time:
              time: '1200'
              timeSection: 0
          reservChargeSet: false
      reservFlag: 0
      ect:
        start:
          day: 0
          time:
            time: '0000'
            timeSection: 0
        end:
          day: 0
          time:
            time: '0000'
            timeSection: 0
  ign3: true
  hoodOpen: false
  transCond: true
  steerWheelHeat: 0
  sideBackWindowHeat: 0
  tirePressureLamp:
    tirePressureLampAll: 0
    tirePressureLampFL: 0
    tirePressureLampFR: 0
    tirePressureLampRL: 0
    tirePressureLampRR: 0
  seatHeaterVentState:
    frSeatHeatState: 2
    flSeatHeatState: 2
    rlSeatHeatState: 2
    rrSeatHeatState: 2
  battery:
    batSoc: 77
    batState: 0
    sjbDeliveryMode: 1
    batSignalReferenceValue:
      batWarning: 65
    powerAutoCutMode: 2
  lampWireStatus:
    stopLamp:
      stopLampStatus: false
      leftLamp: false
      rightLamp: false
    headLamp:
      headLampStatus: false
      leftLowLamp: false
      rightLowLamp: false
      leftHighLamp: false
      rightHighLamp: false
      leftBifuncLamp: false
      rightBifuncLamp: false
    turnSignalLamp:
      turnSignalLampStatus: false
      leftFrontLamp: false
      rightFrontLamp: false
      leftRearLamp: false
      rightRearLamp: false
  windowOpen:
    frontLeft: 1
    frontRight: 1
    backLeft: 1
    backRight: 1
  smartKeyBatteryWarning: false
  fuelLevel: 42
  washerFluidStatus: false
  breakOilStatus: false
  sleepModeCheck: false
  time: '20230210153304'
  remoteWaitingTimeAlert:
    remoteControlAvailable: 1
    remoteControlWaitingTime: 168
    elapsedTime: '00:07:53'
  systemCutOffAlert: 0
  tailLampStatus: 0
  hazardStatus: 0
odometer:
  value: 4706.7
  unit: 1

vehicle_name: TUCSON
friendly_name: TUCSON Data
hmmbob commented 1 year ago

I can probably draft a PR this weekend to fix this

hmmbob commented 1 year ago

Question:

Back left door and Rear left seat are used in a mixed way - should we settle on either back or rear for all sensors?

https://github.com/Hyundai-Kia-Connect/kia_uvo/blob/0450c0cd1c6398eba543672f8ef6a56b1f2b5da3/custom_components/kia_uvo/binary_sensor.py#L88-L95

https://github.com/Hyundai-Kia-Connect/kia_uvo/blob/0450c0cd1c6398eba543672f8ef6a56b1f2b5da3/custom_components/kia_uvo/binary_sensor.py#L163-L170

Relevant for how I should name the windows 😄

cdnninja commented 1 year ago

Good catch. We followed the data coming in the API which also isn't consistent. I'm good with either naming convention.

hmmbob commented 1 year ago

I've remained with the naming from the API.