Sorry @timwelch - That was meant to be following the same steps to setup the Ioniq5. There are indeed a few differences.
Here is what I have setup.
configuration.yaml
#Note there is a related *_last_known trigger sensor for each of these to give continuity over a reboot
#These are hidden in the UI as those are better for use
mqtt:
sensor:
#An alert configiured inside WiCAN
- name: "Electra WiCAN Aux Battery Alert"
unique_id: "electra_wican_aux_battery_alert"
state_topic: "Electra/aux_voltage"
unit_of_measurement: "V"
state_class: "measurement"
value_template: "{{ value_json.battery_voltage }}"
#The rest of these are triggered responses from messages sent from HA automations
- name: "Electra WiCAN BattPackRemain"
unique_id: "electra_wican_battpackremain"
state_topic: "wican/XXXXXXXXXXXXXX/can/rx"
unit_of_measurement: "%"
state_class: "measurement"
value_template: "{{ value_json.BattPackRemain }}"
- name: "Electra WiCAN CumChargeEnergy"
unique_id: "electra_wican_cumchargeenergy"
state_topic: "wican/XXXXXXXXXXXXXX/can/rx"
unit_of_measurement: "kWh"
state_class: "measurement"
value_template: "{{ value_json.CumChargeEnergy }}"
- name: "Electra WiCAN AuxBattVoltage"
unique_id: "electra_wican_auxbattvoltage"
state_topic: "wican/XXXXXXXXXXXXXX/can/rx"
unit_of_measurement: "V"
state_class: "measurement"
value_template: "{{ value_json.AuxBattVoltage }}"
- name: "Electra WiCAN BattPackCurrent (Uncalculated)"
unique_id: "electra_wican_battpackcurrent"
state_topic: "wican/XXXXXXXXXXXXXX/can/rx"
unit_of_measurement: "A"
state_class: "measurement"
value_template: "{{ (value_json.BattPackCurrent) | int(0) }}"
and
#Only keep properly retrieved values (as WiCAN MQTT is only reported when the car is on/charging and on the home wifi and those values ar lost on a reboot)
- trigger:
- platform: state
entity_id: sensor.electra_wican_battpackremain
not_to:
- unknown
- unavailable
sensor:
- name: Electra WiCAN BattPackRemain (Last Known)
unique_id: "electra_wican_battpackremain_last_known"
state: '{{ trigger.to_state.state }}'
unit_of_measurement: '%'
- trigger:
- platform: state
entity_id: sensor.electra_wican_aux_battery_alert
not_to:
- unknown
- unavailable
sensor:
- name: Electra WiCAN Aux Battery Alert (Last Known)
unique_id: "electra_wican_aux_battery_alert_last_known"
state: '{{ trigger.to_state.state }}'
unit_of_measurement: 'V'
- trigger:
- platform: state
entity_id: sensor.electra_wican_cumchargeenergy
not_to:
- unknown
- unavailable
sensor:
- name: Electra WiCAN Aux CumChargeEnergy (Last Known)
unique_id: "electra_wican_cumchargeenergy_last_known"
state: '{{ trigger.to_state.state }}'
unit_of_measurement: 'kWh'
- trigger:
- platform: state
entity_id: sensor.electra_wican_auxbattvoltage
not_to:
- unknown
- unavailable
sensor:
- name: Electra WiCAN AuxBattVoltage (Last Known)
unique_id: "electra_wican_auxbattvoltage_last_known"
state: '{{ trigger.to_state.state }}'
unit_of_measurement: 'V'
Automation (setup in the UI) but here is the yaml
alias: OBD Request (by sending a TX) to WiCAN in Electra
description: ""
trigger:
- platform: time_pattern
seconds: / 30
condition: []
action:
- alias: Send Tx CANID:2015 PID:91 (Rx BattPackRemain CANID:2028 PID:91)
service: mqtt.publish
metadata: {}
data:
topic: wican/XXXXXXXXXXXXXX/can/tx
payload_template: >-
{"bus":"0","type":"tx","ts":33149,"frame":[{"id":2015,"dlc":8,"rtr":false,"extd":false,"data":[2,1,91,170,170,170,170,170]}]}
qos: "0"
- alias: Send Tx - CANID:2020 PID:1 (To Trigger 2101)
service: mqtt.publish
metadata: {}
data:
topic: wican/XXXXXXXXXXXXXX/can/tx
payload_template: >-
{"bus":"0","type":"tx","ts":26517,"frame":[{"id":2020,"dlc":8,"rtr":false,"extd":false,"data":[3,34,1,1,170,170,170,170]}]}
qos: "0"
enabled: true
- delay:
hours: 0
minutes: 0
seconds: 0
milliseconds: 7
- alias: >-
(After Receiving the ack Rx....) Send Tx - CANID:2020 PID:? (To Trigger
"real" 2101)
service: mqtt.publish
metadata: {}
data:
topic: wican/XXXXXXXXXXXXXX/can/tx
payload_template: >-
{"bus":"0","type":"tx","ts":26532,"frame":[{"id":2020,"dlc":8,"rtr":false,"extd":false,"data":[48,0,0,170,170,170,170,170]}]}
qos: "0"
enabled: true
mode: single
Then in WiCAN the following settings:
You will mainly be interested in the BattPackRemain value which is a “normal” PID (91). My WiCAN firmware is a newer version and allows setting of a PID offset. If that index/offset is 2, like the case for the 91/BattPackRemain, then the older firmware will just use that 2 (3rd byte) by default.
The other values I am obtaining are from a two message request that is used to trigger the sending of a 2101 dataframe. I used some details that someone pulled from an OG ioniq a few years back to help me there. There were some bytes that had shifted a few places though so there was a bit of trial and error and using car scanner lots.
You can ignore the RxResponse2101 – Originally I was thinking i’d need to respond to the first message accurately. Instead a wait worked just as well for my purposes.
Hopefully that makes sense for you and is helpful. Feel free to ask any questions. I will be tidying it up in the future and also extracting a few other measures (like battery power, reamaing energy, some termperatures and accumulated quick and normal charging energy). I also hope to get the odometer reading out.