I am using the KIA_UVO integration to provide data from my car.
It queries the servers and retrieves a bunch of data which it stores in a sensor named sensor.tucson_data (in my case). It then helpfully creates many sensors with the data it has obtained - but understandably not for every individual data point.
I want to create a sensor for “fuelLevel” that I can display on the dashboard, so I believe I should use a template sensor for it. My problem is that it seems like the data was saved in YAML format (not JSON). There are plenty of guides and examples that show how to use a value_template to extract data from JSON - but none that I can find explain how to do it from YAML.
Here’s what the data looks like. The path to the attribute I want is: vehicle_data.status.fuelLevel
How do I get that using a value_template for a template sensor?
vehicle_data:
status:
lastStatusDate: '20230326195752'
airCtrlOn: false
engine: false
doorLock: true
doorOpen:
frontLeft: 0
frontRight: 0
backLeft: 0
backRight: 0
trunkOpen: false
airTempUnit: C
airTemp:
value: 14
unit: 0
defrost: false
lowFuelLight: false
acc: false
evStatus:
batteryCharge: false
batteryStatus: 74
batteryPlugin: 2
remainTime2:
etc1:
value: 65535
unit: 1
etc2:
value: 0
unit: 1
etc3:
value: 0
unit: 1
atc:
value: 0
unit: 1
drvDistance:
- rangeByFuel:
gasModeRange:
value: 298
unit: 1
evModeRange:
value: 34
unit: 1
totalAvailableRange:
value: 332
unit: 1
type: 2
hoodOpen: false
transCond: true
steerWheelHeat: 0
sideBackWindowHeat: 0
dte: {}
tirePressureLamp:
tirePressureLampAll: 0
battery:
batSoc: 75
sjbDeliveryMode: 1
batSignalReferenceValue: {}
remoteIgnition: true
seatHeaterVentInfo:
drvSeatHeatState: 2
astSeatHeatState: 2
rlSeatHeatState: 2
rrSeatHeatState: 2
sleepModeCheck: false
lampWireStatus:
headLamp:
headLampStatus: false
leftLowLamp: false
rightLowLamp: false
leftHighLamp: false
rightHighLamp: false
leftBifuncLamp: false
rightBifuncLamp: false
stopLamp:
leftLamp: false
rightLamp: false
turnSignalLamp:
leftFrontLamp: false
rightFrontLamp: false
leftRearLamp: false
rightRearLamp: false
windowOpen: {}
smartKeyBatteryWarning: false
fuelLevel: 60
washerFluidStatus: false
breakOilStatus: false
engineRuntime: {}
vehicleLocation:
head: 225
coord:
lat: 40.12345111
lon: -70.12345888888889
alt: 313
type: 0
accuracy:
hdop: 9
pdop: 15
time: '20230326213412'
speed:
value: 0
unit: 0
service:
msopServiceOdometer: 5133
msopServiceOdometerUnit: 1
mtspServiceDate: '20221011'
imatServiceOdometer: 13133
imatServiceOdometerUnit: 1
mtitServiceDate: '20230411'
currentOdometer: 6818.6
currentOdometerUnit: 1
serviceOdometerDuration: 8000
serviceDaysDuration: 182
serviceMonthsThreshold: 6
vehicle_name: Tucson
friendly_name: Tucson Data
Thanks in advance.