My Mitsubishi PHEV integration, via MQTT

Is there a chance to port this to esphome and ESP32 with ethernet?

+1 to the above question. Even without esphome but if there was a way to put the above code on an ESP device that would be great. I tried googling it and found that Go Tiny should be able to compile it for the ESP chip but without instructions Iā€™m completely lost.

Rpies are in a very short supply while my drawer has around 40 different ESP chips and dev boards sitting in it that could possibly be used for the above.

EDIT: I found a Raspberry Pico Zero laying around. Can anybody tell me if it would be possible use it to run the above code and connect to the car wifi?

EDIT 2: I tried compiling it for the Pico using TinyGo but it looks like thatā€™s going to be impossible as itā€™s using repositories not supported by TinyGo. So Iā€™m afraid it will be same story with ESP chips.

This is the error Iā€™m getting:

$ tinygo flash -target=pico main.go
# github.com/google/gopacket/pcap
../../go/pkg/mod/github.com/google/[email protected]/pcap/pcap_unix.go:26:6: not implemented: build constraints in #cgo line

Running on an ESP isnt going to work at the moment, as TinyGo does not (yet) support Wifi.

There is an issue to get it supported, but noone implementing yet.

The compilation failure around pcap can be worked around, as this isnā€™t required for core functionality.

Hi @buxtronix,

Iā€™m wondering whether it would be possible to run this on a pi pico w? It looks like itā€™s possible to get hold of a lan cable hat which would mean having the ability to connect to both the car and mqtt broker.

Iā€™m just starting out on HA and working with these sorts of boards so fogive me if Iā€™ve misunderstood.

Ah, Iā€™ve just reread the comment above and it sounds like tinygo is a no-go. Are there any other options?

Hi again. I just gave up on the ESP/tinygo option and stole rPi4B from another project. I installed Raspberry Pi OS with command line only, compiled the program, connected wifi to the car and got IP 192.168.8.47 assigned - all went smooth until this point.

The problem I canā€™t get over is the registration. Hereā€™s what happens:

  • I close car door, press ACC button, click lock-unlock 5 times, get a single ā€˜beepā€™
  • the above causes the Pi to disconnect from wifi. After maybe 10-20 seconds it reconnects and gets the IP assigned
  • I then execute the ā€˜registerā€™ command and I get this:
INFO[0000] %PHEV_TCP_CONNECTED%
Client connected and started!
  • Nothing happens for the next few minutes until eventually it times out and gives out about not receiving VIN number or something like that.

No idea why it doesnā€™t work. My only guess is that maybe I only have a very limited amount of time from when I activate the registration until I execute the client registration script and because the wifi disconnects and then reconnects, it is then too late to register. Any ideas?

Ok, since Iā€™m really eager to get this to work I decided to wipe the SD card and re-do the whole process to make sure everything is right. While doing that, I also wrote a little tutorial. Iā€™m not an expert by any means but I know the basics of networking and Linux and hopefully, it will help someone to save some time and frustration :wink:

Now keep in mind that the tutorial isnā€™t yet finished, as I canā€™t seem to get the car connected, but I really believe the steps are all correct. Iā€™m hoping somebody here can help me to get over this final (?) obstacle and then I will finish the tutorial.

Hereā€™s what I have so far:

===================================
In this tutorial Iā€™m using:

  • Raspberry Pi 4B (overkill, I know)
  • SD card
  • Ethernet socket and cable
  • Windows laptop
  • Outlander PHEV :wink:
  • SD card reader

Start with flashing the SD with Raspberry OS Lite 32bit using Raspberry Pi Imager.

Insert the card into rPi, connect a monitor and keyboard. Power on, select the keyboard layout and choose your username and password.

Enter:

sudo raspi-config

Give your Pi a sensible name, like phev2mqtt for example:
1 System Options -> S4 Hostname

Enable SSH:
3 Interface Options -> I2 SSH

Update the OS:
8 Update

Shutdown the Pi, use this command:

shutdown -h -t: now

Connect the Pi to your LAN with ethernet cable. Make sure itā€™s within the WiFi range of your car. From now on you shouldnā€™t need keyboard or monitor anymore.

Grab a laptop. Download, install and open PuTTY. Enter the hostname of your Pi and hit Enter, then Accept. If all is well, you should see linux terminal login screen. Login with your credentials you configured earlier.

Once successfully logged in, itā€™s time to install GoLang:

sudo apt-get install golang	
sudo apt-get install libpcap-dev

Then download phev2mqtt, unzip and compile:

wget https://github.com/buxtronix/phev2mqtt/archive/refs/heads/master.zip
unzip *
cd phev2mqtt-master
go build
Verify it runs with:
./phev2mqtt -h

Connect to car WiFi:

sudo raspi-config

1 System Options -> S1 Wireless LAN
Select your country code, enter car wifi SSID and password
Hit Finish

Restart the system so that the wifi drivers start with the country code you selected - otherwise rfkill might keep a soft block on the wifi card.

sudo shutdown -r -t: now

Putty will disconnect. Close the terminal and open Putty again. Give it about a minute until system fully restarts and reconnect via SSH.
Verify that WiFi has no blocks on it:

rfkill

and that it connecter to the car and got correct IP assigned:

iwconfig
ifconfig

Time for the exciting part. Grab your laptop and car keys and head to the car. Make sure laptop stays connected to home wifi and that you are still logged in to the terminal.
Close driverā€™s door, press ACC button and click lock-unlock on the car remote 5 times.

cd phev2mqtt-master
./phev2mqtt client register

===================================

So this is as far as I got. Iā€™m just getting this:

piotr@phev2mqtt:~/phev2mqtt-master $ ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.52  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::1b05:bce7:e60b:a21e  prefixlen 64  scopeid 0x20<link>
        ether e4:5f:01:53:43:50  txqueuelen 1000  (Ethernet)
        RX packets 4131  bytes 643279 (628.2 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 285  bytes 44963 (43.9 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 11  bytes 1647 (1.6 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 11  bytes 1647 (1.6 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.8.48  netmask 255.255.255.0  broadcast 192.168.8.255
        inet6 fe80::6997:5d04:dd85:b943  prefixlen 64  scopeid 0x20<link>
        ether e4:5f:01:53:43:51  txqueuelen 1000  (Ethernet)
        RX packets 139  bytes 8469 (8.2 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 236  bytes 25476 (24.8 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

piotr@phev2mqtt:~/phev2mqtt-master $ ./phev2mqtt client register
INFO[0000] %PHEV_TCP_CONNECTED%
Client connected and started!
^C
piotr@phev2mqtt:~/phev2mqtt-master $ ./phev2mqtt client register
INFO[0000] %PHEV_TCP_CONNECTED%
ERRO[0000] %PHEV_TCP_WRITER_ERROR%: write tcp 192.168.8.48:43028->192.168.8.46:8080: use of closed network connection
^C
piotr@phev2mqtt:~/phev2mqtt-master $ ./phev2mqtt client register
INFO[0000] %PHEV_TCP_CONNECTED%
Client connected and started!
^C
piotr@phev2mqtt:~/phev2mqtt-master $ ./phev2mqtt client register
INFO[0000] %PHEV_TCP_CONNECTED%
Client connected and started!

Is there a way to start the registration in Verbose mode to get some clues about whatā€™s going on? Or maybe there are some log files I could look into?

1 Like

Great guide, I may link to this from the Github page once more complete. Might want to mention which year models work (based on other comments in this thread, some donā€™t seem to).

You can add the flag -v=debug to show data to/from the car. Or -v=verbose for more detail to help debug the registration process.

Thank a lot buxtronix. I tried to register again few times but this time using the debug flag and each time Iā€™m just getting the following repeat in a loop:

piotr@phev2mqtt:~/phev2mqtt-master $ ./phev2mqtt client register -v=debug
INFO[0000] %PHEV_TCP_CONNECTED%
DEBU[0000] %%PHEV_START_AWAIT%%
DEBU[0000] %PHEV_TCP_SEND_MSG%: [00] PING REQ      (id a)
DEBU[0000] %PHEV_TCP_RECV_MSG%: [00] PING RESP     (id a)
DEBU[0000] %PHEV_TCP_SEND_MSG%: [00] PING REQ      (id b)
DEBU[0000] %PHEV_TCP_RECV_MSG%: [00] PING RESP     (id b)
DEBU[0001] %PHEV_SEC_KEY_UPDATE% Updated security key
DEBU[0001] %PHEV_TCP_RECV_MSG%: [00] START RECV 14 (orig 4e0c0001e11d046194fac769027e)
DEBU[0001] %%PHEV_START14_RECV%%
DEBU[0001] %%PHEV_START_DONE%%
Client connected and started!
DEBU[0001] %PHEV_TCP_SEND_MSG%: [7b] START SEND 14 (orig )
DEBU[0001] %PHEV_TCP_SEND_MSG%: [7b] PING REQ      (id c)
DEBU[0001] %PHEV_TCP_SEND_MSG%: [7b] PING REQ      (id d)
DEBU[0002] %PHEV_TCP_SEND_MSG%: [7b] PING REQ      (id e)
DEBU[0002] %PHEV_SEC_KEY_UPDATE% Updated security key
DEBU[0002] %PHEV_TCP_RECV_MSG%: [00] START RECV 14 (orig 4e0c000194f23f58f23f507a0275)
DEBU[0002] %%PHEV_START14_RECV%%
DEBU[0002] %PHEV_TCP_SEND_MSG%: [d4] START SEND 14 (orig )
DEBU[0002] %PHEV_TCP_SEND_MSG%: [d4] PING REQ      (id f)
DEBU[0002] %PHEV_TCP_SEND_MSG%: [d4] PING REQ      (id 10)
DEBU[0003] %PHEV_TCP_SEND_MSG%: [d4] PING REQ      (id 11)
DEBU[0003] %PHEV_SEC_KEY_UPDATE% Updated security key
DEBU[0003] %PHEV_TCP_RECV_MSG%: [00] START RECV 14 (orig 4e0c000137cfe9a51d0ce11d0218)
DEBU[0003] %PHEV_TCP_SEND_MSG%: [74] START SEND 14 (orig )
DEBU[0003] %%PHEV_START14_RECV%%
DEBU[0003] %PHEV_TCP_SEND_MSG%: [74] PING REQ      (id 12)
DEBU[0003] %PHEV_TCP_SEND_MSG%: [74] PING REQ      (id 13)
DEBU[0004] %PHEV_TCP_SEND_MSG%: [74] PING REQ      (id 14)
DEBU[0004] %PHEV_SEC_KEY_UPDATE% Updated security key
DEBU[0004] %PHEV_TCP_RECV_MSG%: [00] START RECV 14 (orig 4e0c0001e11583d0f237cfe90287)
DEBU[0004] %%PHEV_START14_RECV%%
DEBU[0004] %PHEV_TCP_SEND_MSG%: [73] START SEND 14 (orig )
DEBU[0004] %PHEV_TCP_SEND_MSG%: [73] PING REQ      (id 15)
DEBU[0004] %PHEV_TCP_SEND_MSG%: [73] PING REQ      (id 16)
DEBU[0005] %PHEV_TCP_SEND_MSG%: [73] PING REQ      (id 17)
DEBU[0005] %PHEV_SEC_KEY_UPDATE% Updated security key
DEBU[0005] %PHEV_TCP_RECV_MSG%: [00] START RECV 14 (orig 4e0c000194fac7691583d88b0216)
DEBU[0005] %PHEV_TCP_SEND_MSG%: [9f] PING REQ      (id 18)
DEBU[0005] %PHEV_TCP_SEND_MSG%: [9f] PING REQ      (id 19)
DEBU[0006] %PHEV_TCP_SEND_MSG%: [9f] PING REQ      (id 1a)
DEBU[0006] %PHEV_SEC_KEY_UPDATE% Updated security key
DEBU[0006] %PHEV_TCP_RECV_MSG%: [00] START RECV 14 (orig 4e0c000137c769158b619c8b02ec)
DEBU[0006] %PHEV_TCP_SEND_MSG%: [86] PING REQ      (id 1b)
DEBU[0006] %PHEV_TCP_SEND_MSG%: [86] PING REQ      (id 1c)
DEBU[0007] %PHEV_TCP_SEND_MSG%: [86] PING REQ      (id 1d)
DEBU[0007] %PHEV_SEC_KEY_UPDATE% Updated security key
DEBU[0007] %PHEV_TCP_RECV_MSG%: [00] START RECV 14 (orig 4e0c0001e11d0ce9ada51d0c02cb)
DEBU[0007] %PHEV_TCP_SEND_MSG%: [de] PING REQ      (id 1e)
DEBU[0007] %PHEV_TCP_SEND_MSG%: [de] PING REQ      (id 1f)
DEBU[0008] %PHEV_TCP_SEND_MSG%: [de] PING REQ      (id 20)
DEBU[0008] %PHEV_SEC_KEY_UPDATE% Updated security key
DEBU[0008] %PHEV_TCP_RECV_MSG%: [00] START RECV 14 (orig 4e0c000194f237cfe11d0ce902dc)
DEBU[0008] %PHEV_TCP_SEND_MSG%: [63] PING REQ      (id 21)
DEBU[0008] %PHEV_TCP_SEND_MSG%: [63] PING REQ      (id 22)
DEBU[0009] %PHEV_TCP_SEND_MSG%: [63] PING REQ      (id 23)
DEBU[0009] %PHEV_SEC_KEY_UPDATE% Updated security key
DEBU[0009] %PHEV_TCP_RECV_MSG%: [00] START RECV 14 (orig 4e0c000137cfe1158b691d0c0276)
DEBU[0009] %PHEV_TCP_SEND_MSG%: [e2] PING REQ      (id 24)
DEBU[0009] %PHEV_TCP_SEND_MSG%: [e2] PING REQ      (id 25)
DEBU[0010] %PHEV_TCP_SEND_MSG%: [e2] PING REQ      (id 26)
DEBU[0010] %PHEV_SEC_KEY_UPDATE% Updated security key
DEBU[0010] %PHEV_TCP_RECV_MSG%: [00] START RECV 14 (orig 4e0c0001e1158b691d0ce9ad0206)
DEBU[0010] %PHEV_RECV_LISTENER% message not sent
DEBU[0010] %PHEV_TCP_SEND_MSG%: [3b] PING REQ      (id 27)
DEBU[0010] %PHEV_TCP_SEND_MSG%: [3b] PING REQ      (id 28)
DEBU[0011] %PHEV_TCP_SEND_MSG%: [3b] PING REQ      (id 29)
DEBU[0011] %PHEV_SEC_KEY_UPDATE% Updated security key
DEBU[0011] %PHEV_TCP_RECV_MSG%: [00] START RECV 14 (orig 4e0c00019c8b691583d0f237027e)
DEBU[0011] %PHEV_RECV_LISTENER% message not sent
DEBU[0011] %PHEV_TCP_SEND_MSG%: [28] PING REQ      (id 2a)
DEBU[0011] %PHEV_TCP_SEND_MSG%: [28] PING REQ      (id 2b)
DEBU[0012] %PHEV_TCP_SEND_MSG%: [28] PING REQ      (id 2c)
DEBU[0012] %PHEV_SEC_KEY_UPDATE% Updated security key
DEBU[0012] %PHEV_TCP_RECV_MSG%: [00] START RECV 14 (orig 4e0c00013f5072b63f5072b602cb)
DEBU[0012] %PHEV_RECV_LISTENER% message not sent
DEBU[0012] %PHEV_TCP_SEND_MSG%: [68] PING REQ      (id 2d)
DEBU[0012] %PHEV_TCP_SEND_MSG%: [68] PING REQ      (id 2e)
DEBU[0013] %PHEV_TCP_SEND_MSG%: [68] PING REQ      (id 2f)
DEBU[0013] %PHEV_SEC_KEY_UPDATE% Updated security key
DEBU[0013] %PHEV_TCP_RECV_MSG%: [00] START RECV 14 (orig 4e0c0001e9ada51d0ce11583023a)
DEBU[0013] %PHEV_RECV_LISTENER% message not sent
DEBU[0013] %PHEV_TCP_SEND_MSG%: [80] PING REQ      (id 30)
DEBU[0013] %PHEV_TCP_SEND_MSG%: [80] PING REQ      (id 31)
DEBU[0014] %PHEV_TCP_SEND_MSG%: [80] PING REQ      (id 32)
DEBU[0014] %PHEV_SEC_KEY_UPDATE% Updated security key
DEBU[0014] %PHEV_TCP_RECV_MSG%: [00] START RECV 14 (orig 4e0c00019c83d883d0fac76102c9)
DEBU[0014] %PHEV_RECV_LISTENER% message not sent
DEBU[0014] %PHEV_TCP_SEND_MSG%: [f3] PING REQ      (id 33)
DEBU[0014] %PHEV_TCP_SEND_MSG%: [f3] PING REQ      (id 34)
DEBU[0015] %PHEV_TCP_SEND_MSG%: [f3] PING REQ      (id 35)
DEBU[0015] %PHEV_SEC_KEY_UPDATE% Updated security key
DEBU[0015] %PHEV_TCP_RECV_MSG%: [00] START RECV 14 (orig 4e0c00013f58facfe11d04610220)
DEBU[0015] %PHEV_RECV_LISTENER% message not sent
DEBU[0015] %PHEV_TCP_SEND_MSG%: [2f] PING REQ      (id 36)
DEBU[0015] %PHEV_TCP_SEND_MSG%: [2f] PING REQ      (id 37)
DEBU[0016] %PHEV_TCP_SEND_MSG%: [2f] PING REQ      (id 38)
DEBU[0016] %PHEV_SEC_KEY_UPDATE% Updated security key
DEBU[0016] %PHEV_TCP_RECV_MSG%: [00] START RECV 14 (orig 4e0c0001e9a5158b691d04610276)
DEBU[0016] %PHEV_RECV_LISTENER% message not sent
DEBU[0016] %PHEV_TCP_SEND_MSG%: [39] PING REQ      (id 39)
DEBU[0016] %PHEV_TCP_SEND_MSG%: [39] PING REQ      (id 3a)
DEBU[0017] %PHEV_TCP_SEND_MSG%: [39] PING REQ      (id 3b)
DEBU[0017] %PHEV_SEC_KEY_UPDATE% Updated security key
DEBU[0017] %PHEV_TCP_RECV_MSG%: [00] START RECV 14 (orig 4e0c00019c8b6194f237cfe10252)
DEBU[0017] %PHEV_RECV_LISTENER% message not sent
DEBU[0017] %PHEV_TCP_SEND_MSG%: [43] PING REQ      (id 3c)
DEBU[0017] %PHEV_TCP_SEND_MSG%: [43] PING REQ      (id 3d)
DEBU[0018] %PHEV_TCP_SEND_MSG%: [43] PING REQ      (id 3e)
DEBU[0018] %PHEV_SEC_KEY_UPDATE% Updated security key
DEBU[0018] %PHEV_TCP_RECV_MSG%: [00] START RECV 14 (orig 4e0c00013f507a3f5072bec702ec)
DEBU[0018] %PHEV_RECV_LISTENER% message not sent
DEBU[0018] %PHEV_TCP_SEND_MSG%: [4d] PING REQ      (id 3f)
DEBU[0018] %PHEV_TCP_SEND_MSG%: [4d] PING REQ      (id 40)
DEBU[0019] %PHEV_TCP_SEND_MSG%: [4d] PING REQ      (id 41)
DEBU[0019] %PHEV_SEC_KEY_UPDATE% Updated security key
DEBU[0019] %PHEV_TCP_RECV_MSG%: [00] START RECV 14 (orig 4e0c0001e9adada51d04691502e4)
DEBU[0019] %PHEV_RECV_LISTENER% message not sent
DEBU[0019] %PHEV_TCP_SEND_MSG%: [57] PING REQ      (id 42)
DEBU[0019] %PHEV_TCP_SEND_MSG%: [57] PING REQ      (id 43)
DEBU[0020] %PHEV_TCP_SEND_MSG%: [57] PING REQ      (id 44)
DEBU[0020] %PHEV_SEC_KEY_UPDATE% Updated security key
DEBU[0020] %PHEV_TCP_RECV_MSG%: [00] START RECV 14 (orig 4e0c0001a51d046194facfe102c2)
DEBU[0020] %PHEV_RECV_LISTENER% message not sent
DEBU[0020] %PHEV_TCP_SEND_MSG%: [9f] PING REQ      (id 45)
DEBU[0020] %PHEV_TCP_SEND_MSG%: [9f] PING REQ      (id 46)
DEBU[0021] %PHEV_TCP_SEND_MSG%: [9f] PING REQ      (id 47)
DEBU[0021] %PHEV_SEC_KEY_UPDATE% Updated security key
DEBU[0021] %PHEV_TCP_RECV_MSG%: [00] START RECV 14 (orig 4e0c00015072becfe11d0ce10297)
DEBU[0021] %PHEV_RECV_LISTENER% message not sent
DEBU[0021] %PHEV_TCP_SEND_MSG%: [cd] PING REQ      (id 48)
DEBU[0021] %PHEV_TCP_SEND_MSG%: [cd] PING REQ      (id 49)
DEBU[0022] %PHEV_TCP_SEND_MSG%: [cd] PING REQ      (id 4a)
DEBU[0022] %PHEV_SEC_KEY_UPDATE% Updated security key
DEBU[0022] %PHEV_TCP_RECV_MSG%: [00] START RECV 14 (orig 4e0c0001f23f58f23f58fac70230)
DEBU[0022] %PHEV_RECV_LISTENER% message not sent
DEBU[0022] %PHEV_TCP_SEND_MSG%: [09] PING REQ      (id 4b)
DEBU[0022] %PHEV_TCP_SEND_MSG%: [09] PING REQ      (id 4c)
DEBU[0023] %PHEV_TCP_SEND_MSG%: [09] PING REQ      (id 4d)
DEBU[0023] %PHEV_SEC_KEY_UPDATE% Updated security key
DEBU[0023] %PHEV_TCP_RECV_MSG%: [00] START RECV 14 (orig 4e0c0001a51583d0f237c76902c3)
DEBU[0023] %PHEV_RECV_LISTENER% message not sent
DEBU[0023] %PHEV_TCP_SEND_MSG%: [80] PING REQ      (id 4e)

My car is a 2016 model GX 4H bought in UK.

I donā€™t have a way of being able to test this, as my car is a MY18. Someone else will need to try and give this a go. Some guidelines for sniffing the official client are at the bottom of the Github page.

Thanks. I feel like itā€™s above my skills level but I will try anyway and see if I can sniff out anything useful. I might get back to you for help with decoding the captured packets if Iā€™m stuck.

I went back to using the version prior to the register feature, so that it could work :slight_smile:
But for this you need to first register with your mobile and mask that MAC to the PI.

I was actually thinking of trying that too. Are you saying that I canā€™t do it using the current version?

My thinking was that I can steal mac address of my phone and then simply start the mqtt relay completely skipping the registration process.

Unfortunately, I still have to work to pay my bills so I couldnā€™t try it today. I might try it tomorrow morning or over the weekend.

Ok, I couldnā€™t stop thinking about it so I found a few minutes. I logged on to the raspbian, shutdown wlan0, used macchanger to set my phoneā€™s UP, started up wlan0, verified that it connected to the car and got IP assigned when then I run this:

$ ./phev2mqtt client mqtt --mqtt_server tcp://192.168.1.12:1883/ --mqtt_username *********** --mqtt_password ******************

I got this:

INFO[0000] %PHEV_TCP_CONNECTED%
ERRO[0000] %PHEV_TCP_WRITER_ERROR%: write tcp 192.168.8.47:59142->192.168.8.46:8080: use of closed network connection
ERRO[0020] timed out waiting for start
INFO[0021] %PHEV_TCP_CONNECTED%
ERRO[0021] %PHEV_TCP_WRITER_ERROR%: write tcp 192.168.8.47:47696->192.168.8.46:8080: use of closed network connection

Itā€™s as if the program tried to communicate with the MQTT broker using wrong network interface - wlan0 instead of eth. Or is it a problem when communicating with the car?

With a DEBUG flag:

INFO[0000] %PHEV_TCP_CONNECTED%
DEBU[0000] %%PHEV_START_AWAIT%%
DEBU[0000] %%PHEV_TCP_READER_ERROR%%: EOF
DEBU[0000] %PHEV_TCP_READER_CLOSE%
DEBU[0000] %PHEV_TCP_SEND_MSG%: [00] PING REQ      (id a)
ERRO[0000] %PHEV_TCP_WRITER_ERROR%: write tcp 192.168.8.47:56736->192.168.8.46:8080: use of closed network connection
DEBU[0000] %PHEV_TCP_WRITER_CLOSE%
DEBU[0020] %%PHEV_START_TIMEOUT%%
ERRO[0020] timed out waiting for start
INFO[0021] %PHEV_TCP_CONNECTED%
DEBU[0021] %%PHEV_START_AWAIT%%
DEBU[0021] %%PHEV_TCP_READER_ERROR%%: EOF
DEBU[0021] %PHEV_TCP_READER_CLOSE%
DEBU[0021] %PHEV_TCP_SEND_MSG%: [00] PING REQ      (id a)
ERRO[0021] %PHEV_TCP_WRITER_ERROR%: write tcp 192.168.8.47:55838->192.168.8.46:8080: use of closed network connection
DEBU[0021] %PHEV_TCP_WRITER_CLOSE%

you CANā€™T do it with the current versionā€¦ but you can use a previous version.
Here: Commits Ā· buxtronix/phev2mqtt Ā· GitHub you will find all the commits done in master. You can then browse the repository for the version that you want to test.

I wenā€™t back and saw that the latest working version for me is this: GitHub - buxtronix/phev2mqtt at fe47367cf6dcbe51e1ccb991a34be869151fea25

Take a look at the instructions, they are the old instructions. But if you follow those, it should work.

I follow the repo from a couple of years and the latest REGISTER developments, seem to broke it for previous carsā€¦ like I say here: XOR Security Algorithm NOT working for me Ā· Issue #23 Ā· buxtronix/phev2mqtt Ā· GitHub

So Iā€™m keeping with the old but working version until further updates.

Ok, unfortunately, Iā€™m giving up. I tried the older version as suggested by @BunpGhost and I tried a couple of other versions too. I tried registering the phone and then spoofing MAC address, I tried registering with the phev2mqtt client, but nothing works.

When it comes to registration, Iā€™m basically having the same issue as described here: MY16 cant get it to register Ā· Issue #22 Ā· buxtronix/phev2mqtt Ā· GitHub

Spoofing MAC and then connecting with one of the older versions of the phev2mqtt app results in a timeout. Iā€™m out of ideas.

I will continue to monitor this thread hoping that there will be some future developments that will make it compatible with my car.

Thanks everybody for your help.

Sorry for the delayā€¦ Iā€™m not always online.

If you have a timeout that is good, you can work with thatā€¦ maybe your PI is to far away from the CAR. I used to have issues with that. Although you already had connection to itā€¦

Things to check:

  • Make sure the app in the phone works with the car.
  • Make sure your phone is not masking the MAC Address when registering. My iPhone was. In the Wi-Fi settings I had to disabled that to see the original MAC.
  • When connecting using the PI, make sure your phone is not connected to the CAR Wi-Fi.
  • With MAC spoffing you donā€™t need to register again, so use the old version.
  • Try first with just the client (this is: not using mqtt) just to see the data on the screen. And use debug mode :slight_smile: (I thing it is the flag -v=debug)

Thanks again for the tips but I actually did all of that and double-check each and every one of your points.

I really think I exhausted all of my options at this moment so Iā€™m just hoping somebody with better knowledge than mine will someday figure this out and share the solution online and then I will try again :slight_smile:

At least your SSID appears. My 16MY had a working SSID, then it went in for a service and now no matter how many times I reset it etc. No SSID, so not remote APP and therefore no means for me to use this excellent add-on :frowning:

:frowning:
so sorry to hear thatā€¦
I hope youā€™ll succeed next time.