This repository has been archived on 2026-11-06. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
hassble-config/config.yaml
T
Piotr TrzcinskiandClaude Opus 5.5 fb97346806
Validate YAML Configs / Validate YAML Schema (push) Successful in 10s
fix: read PSA DPF values big-endian, add fuel level candidates
OBDb marks D52F/D519/D525/D530 as little-endian, which showed 425 %
soot and 1632 km since regeneration next to 0.32 g/L soot load.
Big-endian gives 1.7 % and 6.4 km, consistent with the soot load.

The ECU does not answer 01 2F, so add OBDb's three PSA fuel level
sources on the engine ECU (22 0227, 22 040F, 21 A8).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 12:05:30 +02:00

487 lines
15 KiB
YAML

# HassBle configuration — Toyota Proace City (PSA K9 platform, 2019+)
# Adapter: Vgate iCar Pro ELM327 V2.3, Bluetooth 4.0 (BLE) variant
#
# Served from https://gitea.trzcinski.pro/czcionka/hassble-config (branch main).
# The app accepts config only from gitea.trzcinski.pro over HTTPS.
#
# Do NOT put any Home Assistant credentials (URL/Token) in this file. Enter them in the app.
version: 1
defaults:
publish:
on_change_only: true
min_interval: 10s
devices:
- id: proace_city_obd
name: "Toyota Proace City"
source: obd
obd:
# Bind the adapter MAC in the app (Sensors tab) instead of committing it here.
# The adapter advertises as "IOS-Vlink" with service 0x18F0 (checked with nRF Connect).
service_uuid: "18F0"
tx_char_uuid: "2AF1"
rx_char_uuid: "2AF0"
tx_delay: 50ms
init_commands:
- "ATSP6" # ISO 15765-4 CAN 11-bit 500 kbps, confirmed by Car Scanner
# PSA sensors below talk to the engine ECU at 6A8 (answers from 688);
# standard PIDs need the functional header and automatic receive filter back.
default_commands: ["ATSH7DF", "ATCRA"]
sensors:
# Standard SAE J1979 mode 01 PIDs. A PID the ECU does not support answers NO DATA —
# disable such sensors in the app.
- { key: rpm, preset: rpm, update_interval: 2s }
- { key: speed, preset: speed, update_interval: 2s }
- { key: engine_load, preset: engine_load, update_interval: 5s }
- { key: coolant_temp, preset: coolant_temp, update_interval: 30s }
- { key: intake_temp, preset: intake_air_temp, update_interval: 30s }
- { key: ambient_temp, preset: ambient_temp, update_interval: 60s }
- { key: battery, preset: battery_voltage, update_interval: 10s }
- { key: run_time, preset: run_time, update_interval: 10s }
# The ECU does not answer 01 2F; see the psa_fuel_level_* candidates below.
- key: fuel_level
preset: fuel_level
update_interval: 30s
publish:
deadband: 0.5
min_interval: 60s
# PID A6 is mandatory only on newer (Euro 6d) ECUs.
- { key: odometer, preset: odometer, update_interval: 60s }
- key: intake_map
mode: "01"
pid: "0B"
formula: "a"
unit: "kPa"
device_class: pressure
state_class: measurement
accuracy_decimals: 0
update_interval: 5s
- key: barometric_pressure
mode: "01"
pid: "33"
formula: "a"
unit: "kPa"
device_class: pressure
state_class: measurement
accuracy_decimals: 0
update_interval: 120s
# Diesel (1.5 BlueHDi) common-rail pressure; petrol engines answer NO DATA.
- key: fuel_rail_pressure
mode: "01"
pid: "23"
formula: "(a*256+b)*10"
unit: "kPa"
device_class: pressure
state_class: measurement
accuracy_decimals: 0
update_interval: 5s
- key: distance_since_dtc_clear
mode: "01"
pid: "31"
formula: "a*256+b"
unit: "km"
device_class: distance
state_class: total_increasing
accuracy_decimals: 0
update_interval: 300s
- key: distance_with_mil_on
mode: "01"
pid: "21"
formula: "a*256+b"
unit: "km"
device_class: distance
state_class: measurement
accuracy_decimals: 0
icon: mdi:engine-off
update_interval: 300s
# ── DPF / exhaust aftertreatment (SAE J1979 diesel PIDs) ──
# Byte a is the PID's "supported" bitmask, so values start at byte b.
# Car Scanner lists DPF data only from the PSA profile, so these may answer NO DATA;
# the PSA section below reads the same values from the engine ECU directly.
- key: dpf_inlet_temp
mode: "01"
pid: "7C"
formula: "(b*256+c)/10-40"
unit: "°C"
device_class: temperature
state_class: measurement
accuracy_decimals: 0
icon: mdi:thermometer-chevron-up
update_interval: 10s
- key: dpf_outlet_temp
mode: "01"
pid: "7C"
formula: "(d*256+e)/10-40"
unit: "°C"
device_class: temperature
state_class: measurement
accuracy_decimals: 0
icon: mdi:thermometer-chevron-down
update_interval: 10s
# Signed 16-bit: rising differential pressure means soot is building up.
- key: dpf_differential_pressure
mode: "01"
pid: "7A"
formula: "(b*256+c-floor(b/128)*65536)/100"
unit: "kPa"
device_class: pressure
state_class: measurement
accuracy_decimals: 2
update_interval: 10s
# 100 % means the ECU wants a regeneration.
- key: dpf_regen_trigger
mode: "01"
pid: "8B"
formula: "c*100/255"
unit: "%"
state_class: measurement
accuracy_decimals: 0
icon: mdi:air-filter
update_interval: 30s
- key: dpf_regen_required
platform: binary_sensor
mode: "01"
pid: "8B"
formula: "floor(c/255)"
icon: mdi:air-filter
update_interval: 30s
- key: dpf_regen_active
platform: binary_sensor
mode: "01"
pid: "8B"
formula: "b%2"
icon: mdi:fire
update_interval: 10s
- key: dpf_avg_distance_between_regens
mode: "01"
pid: "8B"
formula: "f*256+g"
unit: "km"
device_class: distance
state_class: measurement
accuracy_decimals: 0
update_interval: 300s
- key: egt_bank1_sensor1
mode: "01"
pid: "78"
formula: "(b*256+c)/10-40"
unit: "°C"
device_class: temperature
state_class: measurement
accuracy_decimals: 0
update_interval: 10s
- key: egt_bank1_sensor2
mode: "01"
pid: "78"
formula: "(d*256+e)/10-40"
unit: "°C"
device_class: temperature
state_class: measurement
accuracy_decimals: 0
update_interval: 10s
# ── PSA engine ECU (Bosch MD1CS003, 1.5 BlueHDi), UDS mode 22 ──
# DIDs and scaling from OBDb (github.com/OBDb/Citroen, header 6A8 → 688).
# Names match what Car Scanner's "Citroen 1.5 BlueHDI" profile shows.
# Byte a is the first byte after the "62 Dxxx" echo. OBDb marks some of these DIDs as
# little-endian (blsb), but on this ECU that gave 425 % soot, so all values are read big-endian.
- key: psa_dpf_soot_level
mode: "22"
pid: "D52F"
pre_commands: ["ATSH6A8", "ATCRA688"]
formula: "(a*256+b)/10.24"
unit: "%"
state_class: measurement
accuracy_decimals: 0
icon: mdi:air-filter
update_interval: 60s
- key: psa_dpf_soot_load
mode: "22"
pid: "D54B"
pre_commands: ["ATSH6A8", "ATCRA688"]
formula: "(a*256+b)/1024"
unit: "g/L"
state_class: measurement
accuracy_decimals: 2
icon: mdi:air-filter
update_interval: 60s
- key: psa_dpf_regen_status
mode: "22"
pid: "D521"
pre_commands: ["ATSH6A8", "ATCRA688"]
formula: "a"
accuracy_decimals: 0
icon: mdi:fire
update_interval: 15s
- key: psa_dpf_distance_since_regen
mode: "22"
pid: "D519"
pre_commands: ["ATSH6A8", "ATCRA688"]
formula: "(a*256+b)/16"
unit: "km"
device_class: distance
state_class: measurement
accuracy_decimals: 0
update_interval: 120s
- key: psa_dpf_avg_regen_interval
mode: "22"
pid: "D525"
pre_commands: ["ATSH6A8", "ATCRA688"]
formula: "(a*256+b)/16"
unit: "km"
device_class: distance
state_class: measurement
accuracy_decimals: 0
update_interval: 600s
- key: psa_dpf_remaining_life
mode: "22"
pid: "D530"
pre_commands: ["ATSH6A8", "ATCRA688"]
formula: "(a*256+b-floor(a/128)*65536)*16"
unit: "km"
device_class: distance
state_class: measurement
accuracy_decimals: 0
entity_category: diagnostic
update_interval: 3600s
# Car Scanner shows this deviation in mbar.
- key: psa_dpf_diff_pressure_deviation
mode: "22"
pid: "D518"
pre_commands: ["ATSH6A8", "ATCRA688"]
formula: "a*256+b-floor(a/128)*65536"
unit: "mbar"
device_class: pressure
state_class: measurement
accuracy_decimals: 0
update_interval: 15s
- key: psa_egt_before_catalyst
mode: "22"
pid: "D52E"
pre_commands: ["ATSH6A8", "ATCRA688"]
formula: "(a*256+b-floor(a/128)*65536)/10-273.14"
unit: "°C"
device_class: temperature
state_class: measurement
accuracy_decimals: 0
update_interval: 10s
- key: psa_egt_after_catalyst
mode: "22"
pid: "D555"
pre_commands: ["ATSH6A8", "ATCRA688"]
formula: "(a*256+b-floor(a/128)*65536)/10-273.14"
unit: "°C"
device_class: temperature
state_class: measurement
accuracy_decimals: 0
update_interval: 10s
- key: psa_adblue_range
mode: "22"
pid: "D513"
pre_commands: ["ATSH6A8", "ATCRA688"]
formula: "a*50"
unit: "km"
device_class: distance
state_class: measurement
accuracy_decimals: 0
icon: mdi:water
update_interval: 600s
- key: psa_adblue_volume
mode: "22"
pid: "D558"
pre_commands: ["ATSH6A8", "ATCRA688"]
formula: "a/10"
unit: "L"
device_class: volume_storage
state_class: measurement
accuracy_decimals: 1
icon: mdi:water
update_interval: 600s
- key: psa_adblue_temp
mode: "22"
pid: "D56D"
pre_commands: ["ATSH6A8", "ATCRA688"]
formula: "a-floor(a/128)*256"
unit: "°C"
device_class: temperature
state_class: measurement
accuracy_decimals: 0
entity_category: diagnostic
update_interval: 600s
- key: psa_oil_temp
mode: "22"
pid: "D47D"
pre_commands: ["ATSH6A8", "ATCRA688"]
formula: "(a*256+b-floor(a/128)*65536)/10-273.14"
unit: "°C"
device_class: temperature
state_class: measurement
accuracy_decimals: 0
icon: mdi:oil-temperature
update_interval: 30s
- key: psa_oil_pressure
mode: "22"
pid: "D429"
pre_commands: ["ATSH6A8", "ATCRA688"]
formula: "(a*256+b)/1000"
unit: "bar"
device_class: pressure
state_class: measurement
accuracy_decimals: 2
update_interval: 15s
- key: psa_km_since_oil_change
mode: "22"
pid: "D43F"
pre_commands: ["ATSH6A8", "ATCRA688"]
formula: "a*256+b"
unit: "km"
device_class: distance
state_class: measurement
accuracy_decimals: 0
icon: mdi:oil
update_interval: 3600s
- key: psa_odometer
mode: "22"
pid: "D49C"
pre_commands: ["ATSH6A8", "ATCRA688"]
formula: "a*16777216+b*65536+c*256+d"
unit: "km"
device_class: distance
state_class: total_increasing
accuracy_decimals: 0
icon: mdi:counter
update_interval: 300s
- key: psa_fuel_rail_pressure
mode: "22"
pid: "D446"
pre_commands: ["ATSH6A8", "ATCRA688"]
formula: "(a*256+b)/10"
unit: "bar"
device_class: pressure
state_class: measurement
accuracy_decimals: 0
update_interval: 10s
- key: psa_fuel_temp
mode: "22"
pid: "D42A"
pre_commands: ["ATSH6A8", "ATCRA688"]
formula: "(a*256+b)/10-273.14"
unit: "°C"
device_class: temperature
state_class: measurement
accuracy_decimals: 0
update_interval: 60s
- key: psa_boost_air_temp
mode: "22"
pid: "D411"
pre_commands: ["ATSH6A8", "ATCRA688"]
formula: "(a*256+b-floor(a/128)*65536)/10-273.14"
unit: "°C"
device_class: temperature
state_class: measurement
accuracy_decimals: 0
update_interval: 30s
- key: psa_engaged_gear
mode: "22"
pid: "D43D"
pre_commands: ["ATSH6A8", "ATCRA688"]
formula: "a"
accuracy_decimals: 0
icon: mdi:car-shift-pattern
update_interval: 5s
- key: psa_water_in_diesel
platform: binary_sensor
mode: "22"
pid: "D52C"
pre_commands: ["ATSH6A8", "ATCRA688"]
formula: "signum(a)"
icon: mdi:water-alert
update_interval: 300s
- key: psa_battery_voltage
mode: "22"
pid: "D78A"
pre_commands: ["ATSH6A8", "ATCRA688"]
formula: "(a*256+b)/128"
unit: "V"
device_class: voltage
state_class: measurement
accuracy_decimals: 2
update_interval: 30s
- key: psa_battery_current
mode: "22"
pid: "D497"
pre_commands: ["ATSH6A8", "ATCRA688"]
formula: "(a*16777216+b*65536+c*256+d-floor(a/128)*4294967296)/1024"
unit: "A"
device_class: current
state_class: measurement
accuracy_decimals: 1
update_interval: 30s
# Raw BSI codes; meaning not documented in OBDb.
- key: psa_battery_charge_state
mode: "22"
pid: "D742"
pre_commands: ["ATSH6A8", "ATCRA688"]
formula: "a"
accuracy_decimals: 0
entity_category: diagnostic
update_interval: 600s
- key: psa_battery_wear
mode: "22"
pid: "D741"
pre_commands: ["ATSH6A8", "ATCRA688"]
formula: "a"
accuracy_decimals: 0
entity_category: diagnostic
update_interval: 3600s
- key: psa_stop_start_restarts
mode: "22"
pid: "D71B"
pre_commands: ["ATSH6A8", "ATCRA688"]
formula: "a*16777216+b*65536+c*256+d"
accuracy_decimals: 0
entity_category: diagnostic
update_interval: 3600s
# ── PSA fuel level candidates (engine ECU 7E0 → 7E8, OBDb) ──
# OBDb lists three sources; keep whichever answers on this car and disable the rest.
- key: psa_fuel_level_pct
mode: "22"
pid: "0227"
pre_commands: ["ATSH7E0", "ATCRA"]
formula: "a*100/255"
unit: "%"
state_class: measurement
accuracy_decimals: 0
icon: mdi:gas-station
update_interval: 60s
publish:
deadband: 0.5
min_interval: 60s
- key: psa_fuel_level_l
mode: "22"
pid: "040F"
pre_commands: ["ATSH7E0", "ATCRA"]
formula: "(a*256+b-floor(a/128)*65536)*711/1250"
unit: "L"
device_class: volume_storage
state_class: measurement
accuracy_decimals: 1
icon: mdi:gas-station
update_interval: 60s
publish:
deadband: 0.3
min_interval: 60s
- key: psa_fuel_level_21
mode: "21"
pid: "A8"
pre_commands: ["ATSH7E0", "ATCRA"]
formula: "(m*256+n)/256"
unit: "%"
state_class: measurement
accuracy_decimals: 0
icon: mdi:gas-station
update_interval: 60s