meatpiHQ / wican-fw

GNU General Public License v3.0
283 stars 52 forks source link

SoC auslesen Fiat 500e #95

Open michi741 opened 6 months ago

michi741 commented 6 months ago

Hallo.

Möchte gern den SoC eines Fiat 500e auslesen. Ich weiß nicht genau, was ich in den Filter des Wican eintragen muss.

image

Ich habe die Daten für tx und rx mit Car Scanner und MQTT Explorer ausgelesen. Diese Werte sind angekommen.

{"bus":"0","type":"rx","ts":53691,"frame":[{"id":417001794,"dlc":6,"rtr":false,"extd":true,"data":[5,98,1,158,3,93,0,0]}]} {"bus":"0","type":"tx","ts":53683,"frame":[{"id":416957169,"dlc":8,"rtr":false,"extd":true,"data":[3,34,1,158,170,170,170,170]}]}

{"bus":"0","type":"rx","ts":52793,"frame":[{"id":417001796,"dlc":8,"rtr":false,"extd":true,"data":[33,198,197,195,0,0,0,0]}]} {"bus":"0","type":"tx","ts":52788,"frame":[{"id":416957681,"dlc":8,"rtr":false,"extd":true,"data":[48,0,10,170,170,170,170,170]}]}

{"bus":"0","type":"rx","ts":52786,"frame":[{"id":417001796,"dlc":8,"rtr":false,"extd":true,"data":[16,9,98,160,16,197,198,197]}]} {"bus":"0","type":"tx","ts":52783,"frame":[{"id":416957681,"dlc":8,"rtr":false,"extd":true,"data":[3,34,160,16,170,170,170,170]}]}

Welchen TX Wert muss ich zum Abfragen verwenden und wie ist der Filter einzustellen?

Besten Dank und Grüße, Michael

meatpiHQ commented 6 months ago

@michi741 if you want to read the SoC, i suggest that in carscanner click on "All Sensors", then click on Battery SoC. This way it will continuously request the SoC. This will make it easier to find the tx and rx frame.

Post the frame here and ill will try to help you set the filter. You'll also need to note the SoC when you are doing the reading so we can try and find how to calculate it.

lmuser22 commented 6 months ago

Which "Car Scanner" App is the right one?

michi741 commented 6 months ago

Das ist angekommen. Aktueller SoC 77,25% Car Scanner SoC Fiat Anzeige im Auto 82%

image image image image image
lmuser22 commented 6 months ago

Das ist angekommen. Aktueller SoC 77,25%

image image image image image

womit liest Du die Daten aus? Handy App / Programm am PC? Habe den Dongle auch, er ist auch bereits im WLAN erreichbar aber mehr schaff ich noch nicht ohne Hilfe

michi741 commented 6 months ago

Schau dir die Anleitung in folgenden Link an. https://github.com/meatpiHQ/wican-fw/wiki/EV-Battery-SoC-in-Home-Assistant-%E2%80%90-Example

lmuser22 commented 6 months ago

bei 3. komm ich nicht weiter.

Using "Car Scanner" connect to WiCAN

Was für ein Car Scanner?

lmuser22 commented 6 months ago

Which "Car Scanner" App is the right one?

Diese App? https://play.google.com/store/apps/details?id=com.ovz.carscanner&hl=de&gl=US&pli=1

meatpiHQ commented 6 months ago

Ja, diese App.

Yes that's correct

michi741 commented 6 months ago

Is there any information about the filter settings for the Fiat 500e? I put the output of the Carscanner in MQTT Explorer and the current SoC in the forum.

michi741 commented 6 months ago

I've tried everything, but reading the SOC doesn't work,

meatpiHQ commented 6 months ago

@michi741 can you please capture more SoC data from car scanner ?

I can try to help you set up the filter.

michi741 commented 5 months ago

Is it possible that reading out the OBD data, such as the charge level, only works when the ignition is switched on? RX data only comes back when the ignition is switched on. Is there a way for it to work without ignition or send a tx command to wake up the vehicle? For example, when the battery starts charging, the vehicle stays awake for approx. 2 minutes and outputs rx data.

meatpiHQ commented 5 months ago

@michi741 It is possible on some cars, have you tried to leave the car unlocked?

michi741 commented 5 months ago

Yes. Doesn't work, go to sleep anyway.

meatpiHQ commented 5 months ago

@michi741 can you please try with car scanner, while unlocked and charging? See if you can get any data. Car scanner sends an init frame to the bus, if that works we can send the same frame from WiCAN.

michi741 commented 5 months ago

When I connect to the car scanner, this command is sent several times,

{"bus":"0","type":"tx","ts":5274,"frame":[{"id":416957169,"dlc":8,"rtr":false,"extd":true,"data":[3,34,1,158,170,170,170,170]}]}

nothing comes back from the car.

You have to unlock the vehicle again and again with the remote control key, then new data comes from the vehicle. No data comes when locking.

meatpiHQ commented 5 months ago

@michi741 How about when the car is charging?

puni2k commented 4 months ago

My Fiat 500e (Type 332) was delivered a few days ago and i just found some time to have look at making it work with the wican dongle.

When requesting the SoC values carscanner sends the following additional messages

{"bus":"0","type":"tx","ts":59058,"frame":[{"id":416957681,"dlc":8,"rtr":false,"extd":true,"data":[3,34,160,16,170,170,170,170]}]}

{"bus":"0","type":"tx","ts":38212,"frame":[{"id":416957681,"dlc":8,"rtr":false,"extd":true,"data":[48,0,10,170,170,170,170,170]}]}

When you transmit the messages individually you however only get a reply for the first message, so for now I'm ignoring the second.

So here's the reply for the first message:

{"bus":"0","type":"rx","ts":57681,"frame":[{"id":417001796,"dlc":8,"rtr":false,"extd":true,"data":[16,9,98,160,16,172,173,172]}]}

After driving a bit around the block I got:

{"bus":"0","type":"rx","ts":20303,"frame":[{"id":417001796,"dlc":8,"rtr":false,"extd":true,"data":[16,9,98,160,16,169,173,169]}]}

So Byte 6 and 8 look promising. Not 100% sure though since using Byte*100/255 is close to the value in carscanner but not identical. Also not the same as on the dash, but i didn't expect it to be. I adapted a Node-RED flow i've been previously using for my Citigo and will give the 500e a small charge today and check the results.

After successfully verification i can share my flow if anybody's interested. Just be warned that it contains some error handling and workarounds that were neccessary for the strange wakeup and sleep behaviour of the Citigo which might not be neccessary for the 500e

meatpiHQ commented 4 months ago

@puni2k please do share, I'm sure someone out there will find it very useful.

puni2k commented 4 months ago

Some good and some bad news.

My flow seems to be still good for the 500e. Once the charger is unlocked wican starts up and requests and receives can data. Also the above mentioned value increases as charging progresses.

Here comes the bad news: After 20 minutes the car stops responding to requests. I assume it goes back to sleep after this time. Have to think how i‘m gonna work around this issue.

Edit: it doesn't always seem to be 20 minutes. I disabled and re-enabled charging on my charger a few times with the plug connected (waited until the wican went back to sleep before re-enabling). After this the car will respond to can resquests but only for ~2 minutes. All in all rather disappointing.

My use-case is to stop charging at a custom level and I don't want to rely on some cloud service. Very bad experiences with the Citigo regarding availability. So i now created a small script on my openHab server that will guesstimate the stop time based on last reported charging state and observed charging rate. Let's see how this works, doesn't have to be 100% correct. Rough ball park would be fine

puni2k commented 4 months ago

As requested, my Node-RED flow:

[{"id":"24d2bae83e216617","type":"tab","label":"Wican 500e","disabled":false,"info":"","env":[]},{"id":"b315be78d912d7d5","type":"mqtt in","z":"24d2bae83e216617","name":"","topic":"wican/dc5475934095/can/status","qos":"2","datatype":"json","broker":"54787fa7a5e2bbba","nl":false,"rap":true,"rh":0,"inputs":0,"x":150,"y":60,"wires":[["1c03a269e59ce8e0"]]},{"id":"36442b567d9047e7","type":"inject","z":"24d2bae83e216617","name":"Timer","props":[],"repeat":"300","crontab":"","once":false,"onceDelay":"","topic":"","x":100,"y":380,"wires":[["c88fd84b155e98e3"]]},{"id":"9b993b42e1be27d3","type":"mqtt out","z":"24d2bae83e216617","name":"","topic":"wican/dc5475934095/status_retain","qos":"","retain":"true","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"54787fa7a5e2bbba","x":1160,"y":60,"wires":[]},{"id":"f786585b28a73fd5","type":"mqtt out","z":"24d2bae83e216617","name":"","topic":"wican/dc5475934095/can/tx","qos":"","retain":"false","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"54787fa7a5e2bbba","x":1140,"y":380,"wires":[]},{"id":"1e74e071190d8218","type":"mqtt in","z":"24d2bae83e216617","name":"","topic":"wican/dc5475934095/can/rx","qos":"2","datatype":"json","broker":"54787fa7a5e2bbba","nl":false,"rap":true,"rh":0,"inputs":0,"x":140,"y":620,"wires":[["a392908412e4838f","087f5335b1141ede"]]},{"id":"833ffd94d8dbbc87","type":"mqtt out","z":"24d2bae83e216617","name":"","topic":"wican/dc5475934095/SOC","qos":"","retain":"true","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"54787fa7a5e2bbba","x":1140,"y":620,"wires":[]},{"id":"3d15abae90b18fa5","type":"rbe","z":"24d2bae83e216617","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"payload","topi":"topic","x":370,"y":260,"wires":[["5d4aa57b53fd37d2"]]},{"id":"20631e93a0363f7f","type":"change","z":"24d2bae83e216617","name":"extract status","rules":[{"t":"set","p":"wicanStatus","pt":"flow","to":"payload.status","tot":"msg"},{"t":"set","p":"payload","pt":"msg","to":"payload.status","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":560,"y":60,"wires":[["9b993b42e1be27d3","3d15abae90b18fa5"]]},{"id":"1c03a269e59ce8e0","type":"trigger","z":"24d2bae83e216617","name":"debounce","op1":"","op2":"","op1type":"nul","op2type":"payl","duration":"10","extend":true,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":380,"y":60,"wires":[["20631e93a0363f7f"]]},{"id":"461b06505c8c81d8","type":"switch","z":"24d2bae83e216617","name":"if noAck","property":"receive","propertyType":"flow","rules":[{"t":"false"}],"checkall":"true","repair":false,"outputs":1,"x":540,"y":440,"wires":[["c88fd84b155e98e3"]]},{"id":"35693bd07e359962","type":"change","z":"24d2bae83e216617","name":"Ack","rules":[{"t":"set","p":"receive","pt":"flow","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":550,"y":620,"wires":[["ca9346ca9b0d0fd0"]]},{"id":"087f5335b1141ede","type":"trigger","z":"24d2bae83e216617","name":"","op1":"","op2":"","op1type":"nul","op2type":"date","duration":"15","extend":true,"overrideDelay":false,"units":"min","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":400,"y":540,"wires":[["a2a2e5a31cabfd11"]]},{"id":"a2a2e5a31cabfd11","type":"change","z":"24d2bae83e216617","name":"set unresponsive","rules":[{"t":"set","p":"unresponsive","pt":"flow","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":770,"y":540,"wires":[[]]},{"id":"c98d6965d5cfdaec","type":"mqtt out","z":"24d2bae83e216617","name":"","topic":"wican/dc5475934095/can/rx","qos":"","retain":"false","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"54787fa7a5e2bbba","x":1140,"y":260,"wires":[]},{"id":"11faa238a6eeee17","type":"change","z":"24d2bae83e216617","name":"initialize responsive","rules":[{"t":"set","p":"unresponsive","pt":"flow","to":"false","tot":"bool"},{"t":"set","p":"payload","pt":"msg","to":"{}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":750,"y":260,"wires":[["c98d6965d5cfdaec","c88fd84b155e98e3"]]},{"id":"5d4aa57b53fd37d2","type":"switch","z":"24d2bae83e216617","name":"if online","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"online","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":540,"y":260,"wires":[["11faa238a6eeee17"]]},{"id":"c88fd84b155e98e3","type":"function","z":"24d2bae83e216617","name":"query SOC","func":"msg.payload = \"\";\n\nif (flow.get(\"wicanStatus\") === \"online\" && flow.get(\"unresponsive\") === false) {\n    msg.payload = {\"bus\":\"0\",\"type\":\"tx\",\"ts\":59058,\"frame\":[{\"id\":416957681,\"dlc\":8,\"rtr\":false,\"extd\":true,\"data\":[3,34,160,16,170,170,170,170]}]};\n    flow.set(\"receive\", false);\n}\n\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":550,"y":380,"wires":[["9c5cedc68658d173"]]},{"id":"9c5cedc68658d173","type":"switch","z":"24d2bae83e216617","name":"hasPayload","property":"payload","propertyType":"msg","rules":[{"t":"nempty"}],"checkall":"true","repair":false,"outputs":1,"x":730,"y":380,"wires":[["f786585b28a73fd5","fae9b114cbf2c0e9"]]},{"id":"fae9b114cbf2c0e9","type":"trigger","z":"24d2bae83e216617","name":"","op1":"","op2":"","op1type":"nul","op2type":"payl","duration":"5","extend":false,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":920,"y":440,"wires":[["461b06505c8c81d8"]]},{"id":"c7883d89d43f5d57","type":"http in","z":"24d2bae83e216617","name":"","url":"/wicanreset","method":"get","upload":false,"swaggerDoc":"","x":100,"y":120,"wires":[["11faa238a6eeee17","4fe7774e294cb17c"]]},{"id":"4fe7774e294cb17c","type":"http response","z":"24d2bae83e216617","name":"","statusCode":"200","headers":{},"x":380,"y":120,"wires":[]},{"id":"ca9346ca9b0d0fd0","type":"function","z":"24d2bae83e216617","name":"get SOC","func":"const receive = msg.payload;\nmsg.payload = null;\n\nif(receive.frame[0].id == 417001796) {\n    const data = receive.frame[0].data;\n\n    if(data.length >= 6) {\n        if(data[0] == 16 && data[1] == 9 && data[2] == 98 && data[3] == 160) {\n            msg.payload = data[5] * 100 / 255;\n        }\n    }\n}\n\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":720,"y":620,"wires":[["61d03a0587d90eb5"]]},{"id":"61d03a0587d90eb5","type":"switch","z":"24d2bae83e216617","name":"hasPayload","property":"payload","propertyType":"msg","rules":[{"t":"nnull"}],"checkall":"true","repair":false,"outputs":1,"x":890,"y":620,"wires":[["833ffd94d8dbbc87"]]},{"id":"a392908412e4838f","type":"switch","z":"24d2bae83e216617","name":"not empty","property":"payload","propertyType":"msg","rules":[{"t":"nempty"}],"checkall":"true","repair":false,"outputs":1,"x":380,"y":620,"wires":[["35693bd07e359962"]]},{"id":"54787fa7a5e2bbba","type":"mqtt-broker","name":"home","broker":"mqtt.tsteger.org","port":"1883","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"autoUnsubscribe":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closeRetain":"false","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willRetain":"false","willPayload":"","willMsg":{},"userProps":"","sessionExpiry":""}]
DerHerrW commented 4 months ago

When requesting the SoC values car scanner sends the following additional messages {"bus":"0","type":"tx","ts":59058,"frame":[{"id":416957681,"dlc":8,"rtr":false,"extd":true,"data":[3,34,160,16,170,170,170,170]}]}

This here:

{"bus":"0","type":"tx","ts":38212,"frame":[{"id":416957681,"dlc":8,"rtr":false,"extd":true,"data":[48,0,10,170,170,170,170,170]}]}

is a "continue" command - a request to continue with data after receiving the first message of the answer. The answer

{"bus":"0","type":"rx","ts":57681,"frame":[{"id":417001796,"dlc":8,"rtr":false,"extd":true,"data":[16,9,98,160,16,172,173,172]}]}

says it is a first frame (Bit 4 of Byte 0 is 1) of a multi part message and the message contains a total of 9 data bytes (Bits 3..0 of byte 0 and byte 1 form a 12 bit length information). 98,160,16 is the answered request (34, offset +64 is added to the answer). After receiving the first part car scanner sends a "continue" request [48,0,10,170,170,170,170,170]. I think the second part of the message was also sent but not recognized by you.

I found this helpful: https://en.m.wikipedia.org/wiki/ISO_15765-2

puni2k commented 4 months ago

Thanks for the clarification. I might want to have a second look at it when I find some time.

puni2k commented 3 months ago

Just stumbled upon this: https://gist.github.com/MrPoofy/8450b725ec45988c27e5e59bb99be383

puni2k commented 3 months ago

I reformatted the data that was kindly provided by @MrPoofy and upload them to this spreadsheet: https://docs.google.com/spreadsheets/d/1JGLoPidFT_5bXdlT0SeV3P_QbHm-R1WkVDd2DqIv4vs

F1DD (Frame 1, Data Byte D), F1DF, F2DA, F2DB, F2DC all seem to represent Real SOC about equally. Note: F1DD is data[5] in the wican response in frame 1 F1DF is data[7] in the wican response for frame 1 F2DA is data[2] in the wican response for frame 2 ...

Also from the data I managed to come up with a formula to convert the Real SOC value to one that should match the one on the dash. First you convert your choosen HEX value to a percent value via this formula Dx / 255 * 100 You then take the result and put it into this MIN(100; [PERCENT] - (( 40 - [PERCENT] ) / 7))

With 40 and 7 being magical numbers. 40 because it seems to be the point where Real and dash SOC are equal, and 7 because of try-and-error until the lines in the graph matched.

I updated my Node-RED flow to make use of this and removed all the Skoda Citigo stuff that doesn't seem to be neccessary for the 500e

[{"id":"a5e59add4bb83757","type":"tab","label":"Wican 500e Test","disabled":false,"info":"","env":[]},{"id":"c4b58391981dd8e5","type":"mqtt in","z":"a5e59add4bb83757","name":"","topic":"wican/dc5475934095/can/status","qos":"2","datatype":"json","broker":"54787fa7a5e2bbba","nl":false,"rap":true,"rh":0,"inputs":0,"x":150,"y":60,"wires":[["d9db4d59ec0ee798"]]},{"id":"fcd7fa4ab088e265","type":"inject","z":"a5e59add4bb83757","name":"Timer","props":[],"repeat":"30","crontab":"","once":false,"onceDelay":"","topic":"","x":100,"y":180,"wires":[["1a86a7d1a3496857"]]},{"id":"271cdc051c767678","type":"mqtt out","z":"a5e59add4bb83757","name":"","topic":"wican/dc5475934095/status_retain","qos":"","retain":"true","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"54787fa7a5e2bbba","x":1400,"y":60,"wires":[]},{"id":"9a4eede45bed8871","type":"mqtt out","z":"a5e59add4bb83757","name":"","topic":"wican/dc5475934095/can/tx","qos":"","retain":"false","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"54787fa7a5e2bbba","x":1340,"y":180,"wires":[]},{"id":"278a7cf05feb346e","type":"mqtt in","z":"a5e59add4bb83757","name":"","topic":"wican/dc5475934095/can/rx","qos":"2","datatype":"json","broker":"54787fa7a5e2bbba","nl":false,"rap":true,"rh":0,"inputs":0,"x":140,"y":420,"wires":[["7d670ef6d4dca3b1"]]},{"id":"73c5c30ac57a2184","type":"mqtt out","z":"a5e59add4bb83757","name":"","topic":"wican/dc5475934095/SOC","qos":"","retain":"true","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"54787fa7a5e2bbba","x":1600,"y":440,"wires":[]},{"id":"f8238d73d71d774c","type":"change","z":"a5e59add4bb83757","name":"extract status","rules":[{"t":"set","p":"wicanStatus","pt":"flow","to":"payload.status","tot":"msg"},{"t":"set","p":"payload","pt":"msg","to":"payload.status","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":560,"y":60,"wires":[["271cdc051c767678"]]},{"id":"d9db4d59ec0ee798","type":"trigger","z":"a5e59add4bb83757","name":"debounce","op1":"","op2":"","op1type":"nul","op2type":"payl","duration":"10","extend":true,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":380,"y":60,"wires":[["f8238d73d71d774c"]]},{"id":"1a86a7d1a3496857","type":"function","z":"a5e59add4bb83757","name":"query SOC","func":"msg.payload = \"\";\n\nif (flow.get(\"wicanStatus\") === \"online\") {\n    msg.payload = {\"bus\":\"0\",\"type\":\"tx\",\"ts\":59058,\"frame\":[{\"id\":416957681,\"dlc\":8,\"rtr\":false,\"extd\":true,\"data\":[3,34,160,16,170,170,170,170]}]};\n}\n\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":570,"y":180,"wires":[["9a4eede45bed8871"]]},{"id":"7d670ef6d4dca3b1","type":"switch","z":"a5e59add4bb83757","name":"not empty","property":"payload","propertyType":"msg","rules":[{"t":"nempty"}],"checkall":"true","repair":false,"outputs":1,"x":360,"y":420,"wires":[["f889b6938c144cc0","ab15d387e5d78037"]]},{"id":"f889b6938c144cc0","type":"debug","z":"a5e59add4bb83757","name":"debug 18","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":560,"y":340,"wires":[]},{"id":"3d9f313a2594cebb","type":"trigger","z":"a5e59add4bb83757","name":"","op1":"","op2":"","op1type":"pay","op2type":"nul","duration":"5","extend":false,"overrideDelay":false,"units":"min","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":1370,"y":440,"wires":[["73c5c30ac57a2184"]]},{"id":"ab15d387e5d78037","type":"switch","z":"a5e59add4bb83757","name":"SOC response","property":"payload.frame[0].id","propertyType":"msg","rules":[{"t":"eq","v":"417001796","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":540,"y":420,"wires":[["b628a14d3822e34f"]]},{"id":"b628a14d3822e34f","type":"function","z":"a5e59add4bb83757","name":"get frameid","func":"msg.frameid = msg.payload.frame[0].data[0] >> 4;\n\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":730,"y":420,"wires":[["8345bdbba876b380"]]},{"id":"59d4131ec0321f78","type":"rbe","z":"a5e59add4bb83757","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"payload","topi":"topic","x":1210,"y":440,"wires":[["3d9f313a2594cebb"]]},{"id":"d36e41c1285517d6","type":"function","z":"a5e59add4bb83757","name":"CAN continue","func":"msg.payload = {\"bus\":\"0\",\"type\":\"tx\",\"ts\":38212,\"frame\":[{\"id\":416957681,\"dlc\":8,\"rtr\":false,\"extd\":true,\"data\":[48,0,10,170,170,170,170,170]}]};\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1080,"y":400,"wires":[["9a4eede45bed8871"]]},{"id":"807ba199ade078ee","type":"function","z":"a5e59add4bb83757","name":"get SOC","func":"const percent = msg.payload.frame[0].data[7] * 100 / 255;\nconst estimate = percent - (( 40 - percent ) / 7 );\n\nmsg.payload = Math.min(100, estimate);\n\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1060,"y":440,"wires":[["59d4131ec0321f78"]]},{"id":"8345bdbba876b380","type":"switch","z":"a5e59add4bb83757","name":"frameid","property":"frameid","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"},{"t":"eq","v":"2","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":900,"y":420,"wires":[["d36e41c1285517d6","807ba199ade078ee"],[]]},{"id":"54787fa7a5e2bbba","type":"mqtt-broker","name":"home","broker":"mqtt.tsteger.org","port":"1883","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"autoUnsubscribe":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closeRetain":"false","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willRetain":"false","willPayload":"","willMsg":{},"userProps":"","sessionExpiry":""}]

Much more compact. Also note: Query time is now down to thirty seconds, but MQTT update interval is limited to 5 minutes. Fits my use-case best, your mileage may vary.

DerHerrW commented 3 months ago

Maybe FIDD...F2DA are SoC values for 4 Battery blocks...

for soc_helper I will use the formula min(Dx*0.45-6.4;100)

puni2k commented 3 months ago

From my understanding the small battery consists of 5 packs and the large one of 9

https://www.researchgate.net/figure/Stellantis-Fiat-500e-MY-2022-Low-Range-LR-version-Samsung-SDI-battery-pack-before_fig1_372262493 https://evclinic.eu/2022/11/06/fiat-e500-2022-42kwh-battery/

MrPoofy commented 3 months ago

And the readings that I did on the file that @puni2k shared is for the big battery one (42kWh)