Open MrSaiclops opened 3 months ago
@MrSaiclops sorry for the late reply.
Does anyone know what calculation I need to use with these responses to get the milage?
it's hard to tell from a single data point can you please get another read, it would make it easier to guess.
Does anyone know why these frame ids are so much longer than the typical ones?
This is an extended frame id.
Will I need to build a combo transmission that sends two messages, as seen in the elm327 log?
What are the rx and tx frame before this frame:
{"bus":"0","type":"tx","frame":[{"id":402391163,"dlc":8,"rtr":false,"extd":true,"data":[48,0,0,170,170,170,170,170]}]}
Hello! I'm so pleased with this product and feel like I'm just scraping the surface of it's usefulness so far. I'm successfully able to pull the SoC from my vehicle while its charging which is essential for reminding myself and others to plug it in if forgotten.
The other stat I would like to pull is the odometer reading, for basic charting and insights into usage. CarScanner wasn't able to provide this for either profile tuned towards the e-golf, but it did get a perfect readout by using their profile for the newest gen (EV MEB ID.3, ID.4, etc.). By perfect I mean my dash showed 44353 mi and CarScanner reads: 44353.48 mi
Parsing the MQTT elm327 log when only querying this information yielded these messages:
{"bus":"0","type":"tx","frame":[{"id":402391163,"dlc":8,"rtr":false,"extd":true,"data":[48,0,0,170,170,170,170,170]}]} {"bus":"0","type":"tx","frame":[{"id":402391163,"dlc":8,"rtr":false,"extd":true,"data":[3,34,2,189,170,170,170,170]}]} {"bus":"0","type":"rx","frame":[{"id":402522235,"dlc":8,"rtr":false,"extd":true,"data":[16,13,98,2,189,147,1,22]}]} {"bus":"0","type":"rx","frame":[{"id":402522235,"dlc":8,"rtr":false,"extd":true,"data":[33,212,1,88,96,234,116,52]}]}
I've tried a variety of parsing methods and can't determine how these responses show 71380 km (Assuming it's converted)
So here are the questions:
- Does anyone know what calculation I need to use with these responses to get the milage?
- Does anyone know why these frame ids are so much longer than the typical ones?
- Will I need to build a combo transmission that sends two messages, as seen in the elm327 log?
For reference, here are codes I know work with my car:
Hello, i would like to readout data from my egolf 2018 using wican. Could i ask you about help with codes for reading SOC, odometer, etc? Tomas
it's hard to tell from a single data point can you please get another read, it would make it easier to guess. What are the rx and tx frame before this frame: {"bus":"0","type":"tx","frame":[{"id":402391163,"dlc":8,"rtr":false,"extd":true,"data":[48,0,0,170,170,170,170,170]}]}
Here you go:
Hello! I'm so pleased with this product and feel like I'm just scraping the surface of it's usefulness so far. I'm successfully able to pull the SoC from my vehicle while its charging which is essential for reminding myself and others to plug it in if forgotten.
The other stat I would like to pull is the odometer reading, for basic charting and insights into usage. CarScanner wasn't able to provide this for either profile tuned towards the e-golf, but it did get a perfect readout by using their profile for the newest gen (EV MEB ID.3, ID.4, etc.). By perfect I mean my dash showed 44353 mi and CarScanner reads: 44353.48 mi
Parsing the MQTT elm327 log when only querying this information yielded these messages:
{"bus":"0","type":"tx","frame":[{"id":402391163,"dlc":8,"rtr":false,"extd":true,"data":[48,0,0,170,170,170,170,170]}]} {"bus":"0","type":"tx","frame":[{"id":402391163,"dlc":8,"rtr":false,"extd":true,"data":[3,34,2,189,170,170,170,170]}]} {"bus":"0","type":"rx","frame":[{"id":402522235,"dlc":8,"rtr":false,"extd":true,"data":[16,13,98,2,189,147,1,22]}]} {"bus":"0","type":"rx","frame":[{"id":402522235,"dlc":8,"rtr":false,"extd":true,"data":[33,212,1,88,96,234,116,52]}]}
I've tried a variety of parsing methods and can't determine how these responses show 71380 km (Assuming it's converted)
So here are the questions:
- Does anyone know what calculation I need to use with these responses to get the milage?
- Does anyone know why these frame ids are so much longer than the typical ones?
- Will I need to build a combo transmission that sends two messages, as seen in the elm327 log?
For reference, here are codes I know work with my car:
SoC
{ "bus": "0", "type": "tx", "frame": [{ "id": 2021, "dlc": 8, "rtr": false, "extd": false, "data": [3, 34, 2, 140, 170, 170, 170, 170] }] };
var obj = Object(); for (let i = 0; i < msg.payload.frame.length; i++) { if (msg.payload.frame[i].id === 2029 && msg.payload.frame[i].data[1] === 98 && msg.payload.frame[i].data[2] === 2) { obj.soc = (msg.payload.frame[0].data[4] / 2.55).toFixed(2); msg.payload = obj; msg.topic = "CAR1/SoC"; return msg; } }
Ambient Temp (In Fahrenheit)
{ "bus": "0", "type": "tx", "frame": [{ "id": 1862, "dlc": 8, "rtr": false, "extd": false, "data": [3, 34, 38, 19, 170, 170, 170, 170] }] };
var obj = Object(); for (let i = 0; i < msg.payload.frame.length; i++) { if (msg.payload.frame[i].id === 1968 && msg.payload.frame[i].data[1] === 98 && msg.payload.frame[i].data[2] === 38) { obj.int_temp = (msg.payload.frame[0].data[4] * 1.8) + 32; msg.payload = obj; msg.topic = "CAR1/Interior_Temp"; return msg; } }
Could i ask you about sharing code for node-red reaind data from egolf? If there are some sensitive data, you could exchange it, of course... If not, could you share PID codes for e-golf. Thank you Tomas
Could i ask you about sharing code for node-red reaind data from egolf? If there are some sensitive data, you could exchange it, of course... If not, could you share PID codes for e-golf. Thank you Tomas
You should be able to use all of the code from my original post. I included the messages that need to be sent and how I'm parsing the responses with the function nodes. It's even visible in the quoted section of your reply.
{"bus":"0","type":"tx","frame":[{"id":402391163,"dlc":8,"rtr":false,"extd":true,"data":[48,0,0,170,170,170,170,170]}]}
I understand, but if you could share json, it should be great, i am not able to program it. thank you
I understand, but if you could share json, it should be great, i am not able to program it. thank you
Alright, here it is: flows.json
I understand, but if you could share json, it should be great, i am not able to program it. thank you
Alright, here it is: flows.json
Thank you so much. i am lost in making flow in node-red... Actually i have connected wican. so hopefully, that it will go easly. Tomas
Hmmmm. In all of the MQTT nodes, sure you've changed the middle section of the topic: wican/xxxxxxxxxxxx/can/
to match your model, not mine.
My config.yml has this to create the sensors:
mqtt:
sensor:
- name: "Amb Temp"
state_topic: "CAR1/Interior_Temp"
unit_of_measurement: "F"
value_template: "{{ value_json.int_temp | round(1) }}"
- name: "Plug Voltage"
state_topic: "CAR1/Plug-Voltage"
unit_of_measurement: "V"
value_template: "{{ value_json.plug_volt }}"
- name: "Battery SoC"
state_topic: "CAR1/SoC"
unit_of_measurement: "%"
value_template: "{{ value_json.soc }}"
- name: "Plug Inserted"
state_topic: "CAR1/Plug-Inserted"
value_template: "{{ value_json.plug }}"
Please keep in mind my configuration is far from perfect and I didn't intend to share it. But if it's able to work for you, I'm glad.
Thank you so much. still not working, i am not sure why... How you see i am connected, so i was change my id wican, i was change to my adress of mqtt. I was looking over [MQTT Explorer] and there was tx and rx mesages... so HA is sending requests and wican reply, but, why i not see in HA i dont understand. I was add sensor according your config. I saw them in entities, but data are not recorded there. I am close, some minor mistake somewhere separated me from the data from egolf :-) Thank you again, i really apriciate it.
here is the tx and rx
Hmmmm. In all of the MQTT nodes, sure you've changed the middle section of the topic:
wican/xxxxxxxxxxxx/can/
to match your model, not mine. My config.yml has this to create the sensors:mqtt: sensor: - name: "Amb Temp" state_topic: "CAR1/Interior_Temp" unit_of_measurement: "F" value_template: "{{ value_json.int_temp | round(1) }}" - name: "Plug Voltage" state_topic: "CAR1/Plug-Voltage" unit_of_measurement: "V" value_template: "{{ value_json.plug_volt }}" - name: "Battery SoC" state_topic: "CAR1/SoC" unit_of_measurement: "%" value_template: "{{ value_json.soc }}" - name: "Plug Inserted" state_topic: "CAR1/Plug-Inserted" value_template: "{{ value_json.plug }}"
Please keep in mind my configuration is far from perfect and I didn't intend to share it. But if it's able to work for you, I'm glad.
Hey man, it is working... it just need to be car engine on... So it is bad, that it is not possible to monitor all time, but even this functionality will be nice... I will now add some more measurments... i could share, if will work... Thank you very much for your help... Tomas
It is nice, that during charging is refresh of soc every 2 minutes...
@pyrousg, Can you please start your own issue to request help? This one is now cluttered with numerous messages that mostly pertain to your vehicle which is not a 2019. My original question has still not been answered by @meatpiHQ and I suspect that it's because the conversation is difficult to track with all of your messages.
@pyrousg, Can you please start your own issue to request help? This one is now cluttered with numerous messages that mostly pertain to your vehicle which is not a 2019. My original question has still not been answered by @meatpiHQ and I suspect that it's because the conversation is difficult to track with all of your messages.
I am appologize, should i reduce my post? to clarify your thread? Tomas
@pyrousg please open a new "GitHub issue". It's easier to keep track of things this way.
@MrSaiclops I went through your issue again, and im still unable to find right bytes for the odometer.
Usually odometer PID is 166.
@MrSaiclops: Regarding ODOmeter - Could you try the request / response from the e-up? the e-Golf could be similar; at least raw SOC is identical.
The request 32,2,189 with id 2021 triggers a multipart response (here 2) from the BCU. After receiving the first part it is necessary to request the remaining messages with ID 2021, data ([48,0,0,170,170,170,170,170]). The combined payload of first and second part of the ODO-response is [98, 2, 189, xx, bb, cc, dd, xx, xx, xx, xx, xx, xx]. kilometer ist bb2^16+cc256+dd
If you understand german, you can find my tool unter https://forum.openwb.de/viewtopic.php?p=91886#p91886
I would very much appreciate your feedback.
@DerHerrW Thank you for reaching out! I'm a bit confused about how to execute your suggestions.
{ "bus": "0", "type": "tx", "frame": [{ "id": 2021, "dlc": 8, "rtr": false, "extd": false, "data": [32, 2, 189, 170, 170, 170, 170, 170] }] };
[98, 2, 189, xx, bb, cc, dd, xx]
{ "bus": "0", "type": "tx", "frame": [{ "id": 2021, "dlc": 8, "rtr": false, "extd": false, "data": [48, 0, 0, 0, 170, 170, 170, 170] }] };
This is where I'm lost, how do I combine the second response with the first?
Is there any chance you could look at my original post to see how the information is formatted in NodeRed and give me instructions in a similar manner?
I do not use node red but i can show you how I coded (quit&dirty) an OBD2 communication in python. A great help was this wiki page: https://en.m.wikipedia.org/wiki/ISO_15765-2. Here is the code I use in a callback function that gets called if the wican receives an answer to a obd2 request. The code is under the apache license 2.0:
Test if message is multipart (4 higher bytes of data byte 0): 1 - part one of a multipart message 2 - follow part of a multipart message; 0 - single part message. if 1: the number of bytes to receive is in the lower nibble of byte 0 and byte 1. The payload is the last 6 bytes. if we are interested in the following part we send the continue message (the 100 ist a requested pause of 100ms between each of the parts, does not matter as there will be only one) if 2: a follow up message is received (tpType==2). The first data byte is the index of the message (message 3 may be received before 2 etc). I simply ignore this. The remaining 7 data bytes are simply attached at the end of the payload from the first message.
tpType = data[0] // 16 # Oberen Nibble von Byte 0 extrahieren
cb_rx.messageComplete = False
if tpType == 1:
# Erster Teil einer mehrteiligen Botschaft
# Anzahl zu empfangenen Bytes: 12 Bit aus unterem Nibble Byte 0 und ganzes Byte 1
cb_rx.bytesToReceive = (data[0] & 15)*256 + data[1]
cb_rx.payload = [id]
cb_rx.payload.extend(data[2:8])
cb_rx.bytesReceived = 6
logging.debug(f'Ersten Teil einer mehrteiligen Botschaft empfangen: {cb_rx.payload}')
# zu Sende-ID des Senders die passende Empfänger-ID suchen:
if id == configuration.ODO_RESP_ID:
flowCtrl = messageFromData(configuration.ODO_REQ_ID, [48,0,100,170,170,170,170,170])
elif id == configuration.SOC_RESP_ID:
flowCtrl = messageFromData(configuration.SOC_REQ_ID, [48,0,100,170,170,170,170,170])
# Fordere alle weitere Botschaften an mit 100ms Pause zwischen den Frames
logging.debug(f'Aufforderung für Folgeteile absetzen: {flowCtrl}')
client.publish(wican_topicTx, flowCtrl)
elif tpType == 2:
# Botschaft ist ein Folgeteil einer mehrteiligen Botschaft. Der Index sollte im unteren Nibble von Byte 0 stehen
# hier wird einfach gehofft, daß die Botschaften in der richtigen Reihenfolge ankommen. Sie werden stumpf angehängt.
cb_rx.payload.extend(data[1:8]) # Je Nachfolger sollten 7 Nutzbytes kommen
cb_rx.bytesReceived += 7
if cb_rx.bytesReceived >= cb_rx.bytesToReceive:
cb_rx.messageComplete = True
logging.debug(f'Mehrteilige Botschaft komplett: {cb_rx.payload}')
elif tpType == 0:
# Einteilige Botschaft
cb_rx.payload = [id]
cb_rx.payload.extend(data[1:8])
cb_rx.bytesReceived = 7
cb_rx.messageComplete = True
logging.debug(f'Einteilige Botschaft: {cb_rx.payload}')
else:
logging.warning('Botschaft mit unbekanntem CAN-TP-Botschaftstyp oder FlowControl empfangen.')
Im also seeking for odometer reading. Got these messages.
{
"bus": "0",
"type": "tx",
"ts": 22534,
"frame": [
{
"id": 2015,
"dlc": 8,
"rtr": false,
"extd": false,
"data": [
2,
1,
166,
170,
170,
170,
170,
170
]
}
]
}
{
"bus": "0",
"type": "rx",
"ts": 22544,
"frame": [
{
"id": 2024,
"dlc": 8,
"rtr": false,
"extd": false,
"data": [
6,
65,
166,
0,
11,
79,
36,
0
]
}
]
}
How should i parse message to get readable message? Car scanner shows 74115.6km
(1165536+79256+36*1)/10=74 115.6
19.06.2024 12:55:07 JabeBRD @.***>:
Im also seeking for odometer reading. Got these messages.
*{ "bus": "0", "type": "tx", "ts": 22534, "frame": [ { "id": 2015, "dlc": 8, "rtr": false, "extd": false, "data": [ 2, 1, 166, 170, 170, 170, 170, 170 ] } ] } *{ "bus": "0", "type": "rx", "ts": 22544, "frame": [ { "id": 2024, "dlc": 8, "rtr": false, "extd": false, "data": [ 6, 65, 166, 0, 11, 79, 36, 0 ] } ] } How should i parse message to get readable message? Car scanner shows 74115.6km
— Reply to this email directly, view it on GitHub[https://github.com/meatpiHQ/wican-fw/issues/108#issuecomment-2178378928], or unsubscribe[https://github.com/notifications/unsubscribe-auth/A66YMENRKIWWYRURXITRQFTZIFPQTAVCNFSM6AAAAABFBZRKHOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNZYGM3TQOJSHA]. You are receiving this because you were mentioned. [Verfolgungsbild][https://github.com/notifications/beacon/A66YMEPBQHWWDYT2NWEFM43ZIFPQTA5CNFSM6AAAAABFBZRKHOWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTUB25WLA.gif]
What im doing wrong, cant get RX message as return for odometer, battery soc is returning as expected??
Im sending two messages, with 5s interval
{"bus":"0","type":"tx","frame":[{"id":2015,"dlc":8,"rtr":false,"extd":false,"data":[2,1,91,170,170,170,170,170]}]}
{"bus":"0","type":"tx","frame":[{"id":2015,"dlc":8,"rtr":false,"extd":false,"data":[2,1,166,170,170,170,170,170]}]}
Start bit is 32, length is 24 Bits. I wonder why SoC works with start bit 0 and length 1.
Thank you, its working now. But should it be readable when charging? Now its readable only when ignition is turned on (from "key"). Should i use some different address?
Same with my eUp. Some time after charge start the DC/DC Converter is shut down and my wican hibernates. Maybe the ECU is also shut down.
Interesting that PID 2015 works with the older golf. my eUp does not react on a 166 request on PID 2015.
Its actualy 2020 Passat GTE, but very close to golf in parts. I have also e-Up, but my car scanner didnt find odometer reading, or it was not listed by default for that car, and that 166 request didnt work, do you have working request address?
A couple of posts before: https://github.com/meatpiHQ/wican-fw/issues/108#issuecomment-2122237514
I can confirm that Passat GTE uses same messages as e-golf for odometer readings, same RX and TX messages as in first post. Odometer reading just like in e-Up like DerHerrW said, and this can be read when car is charging, no need for ignition on from key. First send
{
"bus": "0",
"type": "tx",
"frame": [
{
"id": 402391163,
"dlc": 8,
"rtr": false,
"extd": true,
"data": [ 3, 34, 2, 189, 170, 170, 170, 170 ]
}
]
}
receive message with PID 189
{
"bus": "0",
"type": "rx",
"ts": 25020,
"frame": [
{
"id": 402522235,
"dlc": 8,
"rtr": false,
"extd": true,
"data": [ 16, 13, 98, 2, 189, 171, 1, 34 ]
}
]
}
after that send second message
{
"bus": "0",
"type": "tx",
"frame": [
{
"id": 402391163,
"dlc": 8,
"rtr": false,
"extd": true,
"data": [ 48, 0, 0, 170, 170, 170, 170, 170 ]
}
]
}
then receive final message with PID 33
{
"bus": "0",
"type": "rx",
"ts": 25023,
"frame": [
{
"id": 402522235,
"dlc": 8,
"rtr": false,
"extd": true,
"data": [ 33, 148, 30, 224, 97, 175, 76, 192 ]
}
]
}
Settings for WiCan
Im using Home Assistant, so i just set up helper to combine odo1 + odo2 and get complete odometer reading.
Hope this helps someone. That odometer with CAN id 2024 and PID 166 works only when ignition on from key, just ignore it, it is not needed.
Hello! I'm so pleased with this product and feel like I'm just scraping the surface of it's usefulness so far. I'm successfully able to pull the SoC from my vehicle while its charging which is essential for reminding myself and others to plug it in if forgotten.
The other stat I would like to pull is the odometer reading, for basic charting and insights into usage. CarScanner wasn't able to provide this for either profile tuned towards the e-golf, but it did get a perfect readout by using their profile for the newest gen (EV MEB ID.3, ID.4, etc.). By perfect I mean my dash showed 44353 mi and CarScanner reads: 44353.48 mi
Parsing the MQTT elm327 log when only querying this information yielded these messages:
{"bus":"0","type":"tx","frame":[{"id":402391163,"dlc":8,"rtr":false,"extd":true,"data":[48,0,0,170,170,170,170,170]}]} {"bus":"0","type":"tx","frame":[{"id":402391163,"dlc":8,"rtr":false,"extd":true,"data":[3,34,2,189,170,170,170,170]}]} {"bus":"0","type":"rx","frame":[{"id":402522235,"dlc":8,"rtr":false,"extd":true,"data":[16,13,98,2,189,147,1,22]}]} {"bus":"0","type":"rx","frame":[{"id":402522235,"dlc":8,"rtr":false,"extd":true,"data":[33,212,1,88,96,234,116,52]}]}
I've tried a variety of parsing methods and can't determine how these responses show 71380 km (Assuming it's converted)
So here are the questions:
For reference, here are codes I know work with my car:
### SoC `{ "bus": "0", "type": "tx", "frame": [{ "id": 2021, "dlc": 8, "rtr": false, "extd": false, "data": [3, 34, 2, 140, 170, 170, 170, 170] }] };` ```js var obj = Object(); for (let i = 0; i < msg.payload.frame.length; i++) { if (msg.payload.frame[i].id === 2029 && msg.payload.frame[i].data[1] === 98 && msg.payload.frame[i].data[2] === 2) { obj.soc = (msg.payload.frame[0].data[4] / 2.55).toFixed(2); msg.payload = obj; msg.topic = "CAR1/SoC"; return msg; } } ``` ### Ambient Temp (In Fahrenheit) `{ "bus": "0", "type": "tx", "frame": [{ "id": 1862, "dlc": 8, "rtr": false, "extd": false, "data": [3, 34, 38, 19, 170, 170, 170, 170] }] };` ```js var obj = Object(); for (let i = 0; i < msg.payload.frame.length; i++) { if (msg.payload.frame[i].id === 1968 && msg.payload.frame[i].data[1] === 98 && msg.payload.frame[i].data[2] === 38) { obj.int_temp = (msg.payload.frame[0].data[4] * 1.8) + 32; msg.payload = obj; msg.topic = "CAR1/Interior_Temp"; return msg; } } ``` ![image](https://github.com/meatpiHQ/wican-fw/assets/88596884/a6339748-4e13-419a-b780-00e273905fb6)