WiCAN ESP32 based open source OBD2/OBD-II Car Diagnostics CAN Bus to WIFi/BLE/USB adapter Home Assistant integration?

It is detectable on arrival.

It does depend on your use case and how quickly you want it to be detected.

Mine is detected within 30 second of arrival (coming in to range of my wifi). All of my car stats get updated whenever the car gets back home.

I could make that check more frequently and get that down to 10 seconds.

As it is just wifi, you could also just check if your router has a connection to that IP (of your router supports that in HA).

Or you could just try to open the web page. If you get a 200 OK then you know the car is back.

Now, when the car is off you can tell the WiCAN to not go to sleep. So you could have constant details of the car being present. That will drain your 12v battery some though. No worries for an EV that auto-tops up the 12v battery but a problem for an ICE car.

The device’s sleep mode is still pretty good for tracking presence though. It wakes up every hour and does some checks. That will show as present on the network. It will also send an mqtt message if certain conditions are met.

You could ask for the developer to add a shorter sleep period for your use case also (like 15 mins) or do a custom esp32 firmware yourself.

I think you can make it work pretty well. A very nifty little device.

Oh and you can probably do some logic on a “departure check” pretty easily.

If you had the WiCAN send back details from the car like speed then you could transition a state from at home to “not home” if the device comes on and has speed zero and then has a real speed and dropped off your network.

If you do write such an automation then please consider making it into a sharable Blueprint available on Home Assistant’s Blueprints exchange.

Regardless it would be nice to see all types of WiCAN related Blueprint automations on Home Assistant’s Blueprints exchange.

Thanks!
So as I understand it I should be able to configure the CAN to JSON filters and then any time I send an MQTT tx with the correct PID request the WiCAN should respond with a formatted JSON response, correct?

I seem to be able to get the BattPackRemain with PID 91 but the other two never show up in MQTT. Any ideas as to what I might be doing wrong?

That is correct for a normal PID (which is a simple request/response like the 91 PID).

That is my automation/request task named “Send Tx CANID:2015 PID:91” which you have already gotten working.

The more challenging ones are the multi request with multiple frame response. Essentially, if you properly trigger that request you get a large number of responses sequentially.

Those are my automation with names “Send Tx - CANID:2020 PID:1” and “(After Receiving the ack Rx…) Send Tx…”.

Now that second message is meant to come after you get a response to the first one. However I just added a sleep and that seems fine for faking receiving the response.

The “real” 2101 response is sent over about 10 responses. These each start with an index/PID. That is why I check on index 0 for that PID. Then the bytes coming back are part of a byte stream that makes up the values.

Another way of putting it is this is a mechanism to trigger a response of a large number of values in one go (rather than one at time).

The WiCAN users that requested the index change explain this over in the WiCAN forum in more precise detail than I have done here.

The map of the 2101 byte stream from an original Ioniq is also in that thread. That is a rough map for what the ioniq5 sends as some bytes are moved around a little.

Does that make sense?

If you really want to get a feel for it though get “car scanner” for your phone and “MQTT explorer” on a computer and set the WiCAN to the elm to mqtt logging mode and you can see it in real time. Details on that are in the WiCAN forum/examples.

Let me know if you have any more questions. It is certainly a pretty weird format and spec and took me a while to get my head around it (especially as the basic PID is so straightforward).

1 Like

I work in IT and it’s the weirdest comms I’ve ever dealt with.

Cheers for the assistance.

2 Likes

Thanks very much for this, I’ve successfully reproduced all of this in my Home Assistant. The next thing I’m trying to retrieve is determining if the high voltage battery is charging or not, I found “Battery Power” in the Torque Pro PIDs github, and I can see the requests over MQTT when I turn logging on and read it in Car Scanner but I haven’t yet figured out how read that data. I don’t quite understand how to determine where in the responses the data I need is (or how to translate the Torque Pro file format). If I manage to get it working I’ll post it here.

1 Like

An easier path to check on charging might be to get the bitfield in the same row as the BMS SoC.

One of those bits indicates charging as above.

so what are the steps to getting this working with HA? Im trying to figure out that part out?

Is it compatible with BYD EVs? anyone tried this with BYD Seal ?

The WiCAN will work physically with the car. The extraction of the metrics will be a little different to what is documented above as that is Hyundai specific/custom.

The walk-through using car scanner is relatively straightforward to setup so if your car config is supported by CarScanner (very likely) then it will be pretty quick to follow the walk-through. A couple of hours perhaps.

2 Likes

Hey, this is a very interessting solution for my Mokka-e, becacuse

  • PSA changes the Login-procedure
  • the PSACC-Addon works in a new Version with this procedure, but now I have new Problems
  • Torque did not works with my car, also evnotify
  • car scanner works fine, but there is no interface

I need a stable interface for evcc, maybe only for the SOC.

In Car scanner I did not found a Pid, only a ID, and no further information

So you think it must be easy for me.

@smarthoo yes i did :wink:
look at the page from wican: LINK

1 Like

I know it’s been a while, but for completeness and conservation of this information:
I have it running with a BYD Atto 3

I also wrote about it there (in german): SOC über OBD per WLAN auslesen um Wallbox zu steuern - Seite 6 - Private Lade-Infrastruktur - Elektroauto Forum

Though, I only focused on the SoC and no other data by now since this is enough for me.

For any Atto 3 Owner:

SoC Can Messages

  • Request (e.g. with HA like described on the MeatPi Documentation):
{"bus":"0","type":"tx","ts":51109,"frame":[{"id":2023,"dlc":8,"rtr":false,"extd":false,"data":[3,34,0,5,170,170,170,170]}]}
  • The Car (and ultimately the Wican) will reply with:
{"bus":"0","type":"rx","ts":37872,"frame":[{"id":2031,"dlc":8,"rtr":false,"extd":false,"data":[7,98,31,254,44,26,152,58]}]}
{"bus":"0","type":"rx","ts":38043,"frame":[{"id":2031,"dlc":8,"rtr":false,"extd":false,"data":[4,98,0,5,57,170,170,170]}]}

Since SoC is the fith Value of the Frame where Data starts with “4”, I set a filter in Wican to get the SoC shorthanded:

* CAN ID=2031 
* Name=SoC 
* PID=4 
* Index=0 
* Start Bit=32 
* Bit length=8 
* Expression=V 
* Cycle ms=1000

This results in MQTT Messages with the follwoing JSON Payload: e.g. for 57% SoC from the above frame.
{"SoC": 57.000000}

@manzn what is your long term experience with auto sleep of the Wican? I observed, it was online like forever with powered off car being unplugged. In contrast, when the car is plugged in but not charging, it reliably goes to sleep after a few minutes. I am asking, because I have concerns draining my 12V battery or triggering the high power contactor of the high voltage system too often to recharge the 12V battery internally…

i got it in my car for about 2 month now - no problems - the WiCan fall in sleep after 3-5 minutes after i turn off my car

image

is from yesterday evening - since then the car is standing outside and not plugged in

1 Like

I need to further inspect this… Parked my car, turned it off and did not plug it in.
WiCan is still online after 21 Minutes

Edit: still online after 1h

look at you settings of the battery sleep mode:

image

The sleep Voltage was to high on default at my wican - maybe will this solve your problem …

sorry for the noob question - am I right in assuming that to gather the fuel tank level the car need to switched on? there is no way to be able to read the tank level if the vehicle is switched off (providing that WiCAN is on)?

There is a beta firmware online:
It comes with a new feature: AutoPID → PID request can now automated. It makes things easier now.

I was not able to read my car’s SOC by the elm237 protocol. now with AutoPID it work’s like a charme.

Found some PIDs requests over here and put it into the Automate tap.

Edit: Odo was wrong, it’s: (((B4x65536)+(Bx256))+B6)