autohuttli/id3pids.yaml
Michael Hope e1a4ca8329
All checks were successful
/ esphome (push) Successful in 15m15s
autohuttli: v1 of the ID.3 monitor
2025-08-29 12:21:02 +02:00

384 lines
7.5 KiB
YAML

canbus:
- id: !extend can0
on_frame:
- can_id: 402522235
can_id_mask: 536870911
then:
- if:
condition:
lambda: return id(pid_index) == 0;
then:
- lambda: '// B4*0.4425-6.1947
float value = static_cast<float>(x[4])*0.4425-6.1947;
id(car_soc).publish_state(value);'
use_extended_id: true
- can_id: 402522235
can_id_mask: 536870911
then:
- if:
condition:
lambda: return id(pid_index) == 1;
then:
- lambda: '// B4
float value = static_cast<float>(x[4]);
id(car_operation_mode).publish_state(value);'
use_extended_id: true
- can_id: 402522235
can_id_mask: 536870911
then:
- if:
condition:
lambda: return id(pid_index) == 2;
then:
- lambda: '// ([B5:B7]*256-150000)/100
float value = (static_cast<float>(0| (x[5] << 16)| (x[6] << 8)| (x[7]
<< 0))*256-150000)/100;
id(car_hv_battery_current).publish_state(value);'
use_extended_id: true
- can_id: 402522235
can_id_mask: 536870911
then:
- if:
condition:
lambda: return id(pid_index) == 3;
then:
- lambda: '// [B4:B5]/4
float value = static_cast<float>(0| (x[4] << 8)| (x[5] << 0))/4;
id(car_hv_battery_voltage).publish_state(value);'
use_extended_id: true
- can_id: 402522235
can_id_mask: 536870911
then:
- if:
condition:
lambda: return id(pid_index) == 4;
then:
- lambda: '// B4/2-40
float value = static_cast<float>(x[4])/2-40;
id(car_hv_battery_temperature).publish_state(value);'
use_extended_id: true
- can_id: 402522235
can_id_mask: 536870911
then:
- if:
condition:
lambda: return id(pid_index) == 5;
then:
- lambda: '// B4
float value = static_cast<float>(x[4]);
id(car_speed).publish_state(value);'
use_extended_id: true
- can_id: 1914
can_id_mask: 2047
then:
- if:
condition:
lambda: return id(pid_index) == 6;
then:
- lambda: '// (B5*256)+B6
float value = (static_cast<float>(x[5])*256)+static_cast<float>(x[6]);
id(car_range).publish_state(value);'
use_extended_id: false
- can_id: 402522230
can_id_mask: 536870911
then:
- if:
condition:
lambda: return id(pid_index) == 7;
then:
- lambda: '// [B4:B6]
float value = static_cast<float>(0| (x[4] << 16)| (x[5] << 8)| (x[6] <<
0));
id(car_odometer).publish_state(value);'
use_extended_id: true
- can_id: 1968
can_id_mask: 2047
then:
- if:
condition:
lambda: return id(pid_index) == 8;
then:
- lambda: '// B4/2-50
float value = static_cast<float>(x[4])/2-50;
id(car_outdoor_temperature).publish_state(value);'
use_extended_id: false
- can_id: 1968
can_id_mask: 2047
then:
- if:
condition:
lambda: return id(pid_index) == 9;
then:
- lambda: '// [B4:B5]/5-40
float value = static_cast<float>(0| (x[4] << 8)| (x[5] << 0))/5-40;
id(car_indoor_temperature).publish_state(value);'
use_extended_id: false
- can_id: 1914
can_id_mask: 2047
then:
- if:
condition:
lambda: return id(pid_index) == 10;
then:
- lambda: '// [B4:B5]*50/1000
float value = static_cast<float>(0| (x[4] << 8)| (x[5] << 0))*50/1000;
id(car_hv_capacity).publish_state(value);'
use_extended_id: false
platform: esp32_can
script:
- id: poll_car
mode: single
then:
- globals.set:
id: pid_index
value: '0'
- canbus.send:
can_id: 402391163
data:
- 3
- 34
- 2
- 140
- 1
- 85
- 85
- 85
use_extended_id: true
- delay: 100ms
- globals.set:
id: pid_index
value: '1'
- canbus.send:
can_id: 402391163
data:
- 3
- 34
- 116
- 72
- 85
- 85
- 85
- 85
use_extended_id: true
- delay: 100ms
- globals.set:
id: pid_index
value: '2'
- canbus.send:
can_id: 402391163
data:
- 3
- 34
- 30
- 61
- 85
- 85
- 85
- 85
use_extended_id: true
- delay: 100ms
- globals.set:
id: pid_index
value: '3'
- canbus.send:
can_id: 402391163
data:
- 3
- 34
- 30
- 59
- 85
- 85
- 85
- 85
use_extended_id: true
- delay: 100ms
- globals.set:
id: pid_index
value: '4'
- canbus.send:
can_id: 402391163
data:
- 3
- 34
- 42
- 11
- 85
- 85
- 85
- 85
use_extended_id: true
- delay: 100ms
- globals.set:
id: pid_index
value: '5'
- canbus.send:
can_id: 402391163
data:
- 3
- 34
- 244
- 13
- 85
- 85
- 85
- 85
use_extended_id: true
- delay: 100ms
- globals.set:
id: pid_index
value: '6'
- canbus.send:
can_id: 1808
data:
- 3
- 34
- 42
- 182
- 2
- 85
- 85
- 85
use_extended_id: false
- delay: 100ms
- globals.set:
id: pid_index
value: '7'
- canbus.send:
can_id: 402391158
data:
- 3
- 34
- 41
- 90
- 85
- 85
- 85
- 85
use_extended_id: true
- delay: 100ms
- globals.set:
id: pid_index
value: '8'
- canbus.send:
can_id: 1862
data:
- 3
- 34
- 38
- 9
- 85
- 85
- 85
- 85
use_extended_id: false
- delay: 100ms
- globals.set:
id: pid_index
value: '9'
- canbus.send:
can_id: 1862
data:
- 3
- 34
- 38
- 19
- 85
- 85
- 85
- 85
use_extended_id: false
- delay: 100ms
- globals.set:
id: pid_index
value: '10'
- canbus.send:
can_id: 1808
data:
- 3
- 34
- 42
- 178
- 85
- 85
- 85
- 85
use_extended_id: false
- delay: 100ms
sensor:
- device_class: battery
id: car_soc
name: SOC
platform: template
unit_of_measurement: '%'
- id: car_operation_mode
name: Operation mode
platform: template
- device_class: current
id: car_hv_battery_current
name: HV battery current
platform: template
unit_of_measurement: A
- device_class: voltage
id: car_hv_battery_voltage
name: HV battery voltage
platform: template
unit_of_measurement: V
- device_class: temperature
id: car_hv_battery_temperature
name: HV battery temperature
platform: template
unit_of_measurement: "\xB0C"
- device_class: speed
id: car_speed
name: Speed
platform: template
unit_of_measurement: km/h
- device_class: distance
id: car_range
name: Range
platform: template
unit_of_measurement: km
- device_class: distance
id: car_odometer
name: Odometer
platform: template
unit_of_measurement: km
- device_class: temperature
id: car_outdoor_temperature
name: Outdoor temperature
platform: template
unit_of_measurement: "\xB0C"
- device_class: temperature
id: car_indoor_temperature
name: Indoor temperature
platform: template
unit_of_measurement: "\xB0C"
- device_class: energy
id: car_hv_capacity
name: HV capacity
platform: template
unit_of_measurement: kWh