GithubHelp home page GithubHelp logo

phev2mqtt's Introduction

phev2mqtt - Mitsubishi Outlander PHEV to MQTT gateway

Utility to interact with a Mitsubishi Outlander PHEV via the Wifi remote control protocol.

Inspired by https://github.com/phev-remote/ but written entirely in Go.

For further hacking, read the protocol documentation.

Tested against a MY18 vehicle.

Home Assistant Screenshot

Supported functionality

  • MQTT proxy to Phev
  • Home Assistant discovery
  • Register client to car
  • Fetch battery, charge, door, light status
  • Set lights and charge enable
  • Near-instant response to commands
  • Only tested on a MY18 Phev

Also includes some debugging utilities.

Requirements

  • Go compiler

Licence, etc

Licenced under the GPLv2.

Copyright 2021 Ben Buxton [email protected]

Contributions and PRs are welcome.

Getting started.

Compiling

Install Go

  • Download and install the latest Go compiler
    • Your distro packager may have a version thats too old
    • For raspbian choose the ARMv6 release

Install PCAP dev libraries

  • Ensure you have install the libpcap-dev package

Download, extract, and compile phev2mqtt

  • Download the phev2mqtt archive
  • Extract it
  • Go into its the top level directory and run go build
  • Verify it runs with ./phev2mqtt -h

Connecting to the vehicle.

Configure Wifi client on system running mqtt2phev

On your computer running the phev2mqtt tools, configure a new Wifi connection to the car's SSID,

Register the client to the car

Follow the Mitsubishi instructions to find the Wifi credentials provided with the car.

Verify that your Wifi connection to the car is established - your local IP address should be 192.168.8.47.

Follow the Mitsubishi instructions and put the car into registration mode ("Setup Your Vehicle"). You may need to re-establish the Wifi connection.

Register by running phev2mqtt client register and you should shortly see a message indicating successful registration.

Testing the tool

Once connected to the car, you can sniff for messages by running phev2mqtt client watch. The phone client needs to be disconnected for this to work. You'll see a bunch of data go by - some of those will be decoded into readable messages such as charge and AC status.

MQTT Gateway

The primary feature of this code is to run as a proxy between the car and MQTT. Registers with car status are sent to MQTT, both as raw register values and decoded functional values. Commands sent on MQTT topics can be used to control certain aspects of the vehicle.

Start the MQTT gateway with:

./phev2mqtt client mqtt --mqtt_server tcp://<your_mqtt_address:1883/ [--mqtt_username <mqtt_username>] [--mqtt_password <mqtt_password>]

The following topics are published:

Topic/prefix Description
phev/register/[register] Raw values of each register, as hex strings
phev/available Wifi connection status to car. online or offline
phev/battery/level Current drive battery level as a percent
phev/climate/status Whether the car AC is on
phev/climate/mode Mode of the AC, if on. cool, heat, windscreen
phev/climate/[mode] Alternative of above. Modes are cool, heat, windscreen which can be off or on
phev/charge/charging Whether the battery is charging. on or off
phev/charge/plug If the charging plug is unplugged or connected.
phev/charge/remaining Minutes left, if charging.
phev/door/locked Whether the car is locked. on or off
phev/door/front_left State of doors. closed or open
phev/door/front_right State of doors. closed or open
phev/door/front_passenger State of doors. closed or open
phev/door/driver State of doors. closed or open
phev/door/rear_left State of doors. closed or open
phev/door/rear_right State of doors. closed or open
phev/door/bonnet State of doors. closed or open
phev/door/boot State of doors. closed or open
phev/lights/parking Parking lights. on or off
phev/lights/head Head lights. on or off
phev/vin Discovered VIN of the car
phev/registrations Number of wifi clients registered to the car

The following topics are subscribed to and can be used to change state on the car:

Topic/prefix Description
phev/set/register/[register] Set register 0x[register] to value 0x[payload]
phev/set/parkinglights Set parking lights on or off
phev/set/headlights Set head lights on or off
phev/set/cancelchargetimer Cancel charge timer (any payload)
phev/set/climate/[mode] Set ac/climate state (cool/heat/windscreen/off) for [payload] (10[on]/20/30)
phev/connection Change car connection state to (on/off/restart)

Home Assistant discovery

The client supports Home Assistant MQTT Discovery by default.

After initial discovery, re-run the binary for the entities to appear. You can search for "phev" in your entity list. Your car should also appear as a device in the Devices tab.

You can disable this with --ha_discovery=false or change the discovery prefix, the default is --ha_discovery_prefix=homeassistant.

Raspbian setup with auto-start

It's useful to have the tool auto-start when running on e.g a Raspberry Pi. The following describes how to set this up.

  • Edit or add to /etc/systemd/network/00-default.link with the following:
[Match]
# This should be the 'real' (default) mac address of the Pi's wireless interface.
MACAddress=b8:27:eb:50:c0:52

[Link]
# This should be the MAC address to use to connect to the car, per above.
MACAddress=ee:4d:ec:de:7a:91
NamePolicy=kernel database onboard slot path

  • Add the car's Wifi info to /etc/wpa_supplicant/wpa_supplicant.conf:
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=AU

network={
	ssid="REMOTE45bhds"
	scan_ssid=1
	psk="blahblahbla12314"
}

  • Add the following to /etc/systemd/system/phev2mqtt.service, updating the MQTT address to suit your setup:
[Unit]
Description=phev2mqtt service script
StartLimitIntervalSec=5
After=syslog.target network.target

[Service]
Type=exec
ExecStart=/usr/local/bin/phev2mqtt --config=/dev/null client mqtt --mqtt_server tcp://192.168.0.88:1883 -v=debug

# Restart script if stopped
Restart=always
# Wait 30s before restart
RestartSec=30s

# Tag things in the log
# View with: sudo journalctl -f -u phev2mqtt -o cat
SyslogIdentifier=phev2mqtt

StandardOutput=syslog
StandardError=syslog

[Install]
WantedBy=multi-user.target
  • Copy the phev2mqtt binary to /usr/local/bin and make sure it's executable.

  • Start the service with sudo systemctl start phev2mqtt.service

  • Enable the service to run at boot, with sudo systemctl enable phev2mqtt.service.

  • Restart the Pi and verify that it can connect to the car. Also run ifconfig and check that the wlan0 interface has the correct mac address. You should also see this interface have the IP address 192.168.8.47.

  • Verify that the phev2mqtt service is communicating with the car, by checking the logs: sudo journalctl -f -u phev2mqtt -o cat

Sniffing the official client

Further development of this library can be done with a packet dump of the official Mistubishi app.

A number of sniffer apps for phones are available for this. Two that the author have used are Packet Capture and PCAP Remote. These do not require root access, yet can successfully sniff the traffic into PCAP files for further analysis.

Packet Capture can save the PCAP files to your local phone storage which you can then extract off the phone.

PCAP Remote is a little more involved, but allows for live sniffing of the traffic.

Once you have downloaded the PCAP file(s) from the phone, you can analyse them with the command phev2mqtt decode pcap . Adjust the verbosity level (-v) between 'info', 'debug' and 'trace' for more details.

Additionally, the flag '--latency' will use the PCAP packet timestamps to decode the packets with original timings which can help pinpoint app events.

phev2mqtt's People

Contributors

buxtronix avatar gmta avatar iceeyz avatar martingjohn avatar zivillian avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

phev2mqtt's Issues

Restarting HASS breaks functionality

I have my phev2mqtt as a service running on my PI and starts on boot after network is up.
It works fine. However, every time I restart HASS, I have to restart phev2mqtt twice in order for the values to appear again in HA.

Is there a way to fix this?

XOR Security Algorithm NOT working for me

I have posted this on a previous issue:

I'm having a similar issue!
phev2mqtt was working fine until yesterday when I updated to the latest master.
It compiles ok and seems to run ok.

I've tried to register and I get exactly what the OP gets.
So, I tried using the previous MAC ADDRESS that I had spoofed (from my mobile, the old way) and I only get:
TCP_CONNECTED
and nothing more..

what has changed?
Is it possible to provide the previous version to test? (although I'm not sure what was)

I have a MY14 that was working fine ;)

LOGS with -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 4e0c00012e2e2e2e2e26a5150223)
DEBU[0001] %%PHEV_START14_RECV%%
DEBU[0001] %%PHEV_START_DONE%%
DEBU[0001] %PHEV_TCP_SEND_MSG%: [46] START SEND 14 (orig )
DEBU[0001] %PHEV_TCP_SEND_MSG%: [46] PING REQ (id c)
DEBU[0001] %PHEV_TCP_SEND_MSG%: [46] PING REQ (id d)
DEBU[0002] %PHEV_TCP_SEND_MSG%: [46] PING REQ (id e)
DEBU[0002] %PHEV_SEC_KEY_UPDATE% Updated security key
DEBU[0002] %PHEV_TCP_RECV_MSG%: [00] START RECV 14 (orig 4e0c0001d883d0fac7691583024a)
DEBU[0002] %%PHEV_START14_RECV%%
DEBU[0002] %PHEV_TCP_SEND_MSG%: [8c] START SEND 14 (orig )
DEBU[0002] %PHEV_TCP_SEND_MSG%: [8c] PING REQ (id f)
DEBU[0002] %PHEV_TCP_SEND_MSG%: [8c] PING REQ (id 10)
DEBU[0003] %PHEV_TCP_SEND_MSG%: [8c] PING REQ (id 11)
DEBU[0003] %PHEV_SEC_KEY_UPDATE% Updated security key
DEBU[0003] %PHEV_TCP_RECV_MSG%: [00] START RECV 14 (orig 4e0c00018b691583d88b61940241)
DEBU[0003] %%PHEV_START14_RECV%%
DEBU[0003] %PHEV_TCP_SEND_MSG%: [24] START SEND 14 (orig )
DEBU[0003] %PHEV_TCP_SEND_MSG%: [24] PING REQ (id 12)
DEBU[0003] %PHEV_TCP_SEND_MSG%: [24] PING REQ (id 13)
DEBU[0004] %PHEV_TCP_SEND_MSG%: [24] PING REQ (id 14)
DEBU[0004] %PHEV_SEC_KEY_UPDATE% Updated security key
DEBU[0004] %PHEV_TCP_RECV_MSG%: [00] START RECV 14 (orig 4e0c00012e26adadadada515021f)
DEBU[0004] %%PHEV_START14_RECV%%
DEBU[0004] %PHEV_TCP_SEND_MSG%: [3d] START SEND 14 (orig )
DEBU[0004] %PHEV_TCP_SEND_MSG%: [3d] PING REQ (id 15)
DEBU[0004] %PHEV_TCP_SEND_MSG%: [3d] PING REQ (id 16)
DEBU[0005] %PHEV_TCP_SEND_MSG%: [3d] PING REQ (id 17)
DEBU[0005] %PHEV_SEC_KEY_UPDATE% Updated security key
DEBU[0005] %PHEV_TCP_RECV_MSG%: [00] START RECV 14 (orig 4e0c0001d88b691583d0fac70252)
DEBU[0005] %PHEV_TCP_SEND_MSG%: [59] PING REQ (id 18)
DEBU[0005] %PHEV_TCP_SEND_MSG%: [59] PING REQ (id 19)
DEBU[0006] %PHEV_TCP_SEND_MSG%: [59] PING REQ (id 1a)
DEBU[0006] %PHEV_SEC_KEY_UPDATE% Updated security key
DEBU[0006] %PHEV_TCP_RECV_MSG%: [00] START RECV 14 (orig 4e0c00018b6194f23f507a37020f)
DEBU[0006] %PHEV_TCP_SEND_MSG%: [51] PING REQ (id 1b)
DEBU[0006] %PHEV_TCP_SEND_MSG%: [51] PING REQ (id 1c)
DEBU[0007] %PHEV_TCP_SEND_MSG%: [51] PING REQ (id 1d)
DEBU[0007] %PHEV_SEC_KEY_UPDATE% Updated security key
DEBU[0007] %PHEV_TCP_RECV_MSG%: [00] START RECV 14 (orig 4e0c00012e2e26adada51d0402ff)
DEBU[0007] %PHEV_TCP_SEND_MSG%: [5b] PING REQ (id 1e)
DEBU[0007] %PHEV_TCP_SEND_MSG%: [5b] PING REQ (id 1f)
DEBU[0008] %PHEV_TCP_SEND_MSG%: [5b] PING REQ (id 20)
DEBU[0008] %PHEV_SEC_KEY_UPDATE% Updated security key
DEBU[0008] %PHEV_TCP_RECV_MSG%: [00] START RECV 14 (orig 4e0c0001d883d883d0facfe1028d)
DEBU[0008] %PHEV_TCP_SEND_MSG%: [4d] PING REQ (id 21)
DEBU[0008] %PHEV_TCP_SEND_MSG%: [4d] PING REQ (id 22)
DEBU[0009] %PHEV_TCP_SEND_MSG%: [4d] PING REQ (id 23)
DEBU[0009] %PHEV_SEC_KEY_UPDATE% Updated security key
DEBU[0009] %PHEV_TCP_RECV_MSG%: [00] START RECV 14 (orig 4e0c00018b691d0ce11d0ce10265)
DEBU[0009] %PHEV_TCP_SEND_MSG%: [48] PING REQ (id 24)
DEBU[0009] %PHEV_TCP_SEND_MSG%: [48] PING REQ (id 25)
DEBU[0010] %PHEV_TCP_SEND_MSG%: [48] PING REQ (id 26)
DEBU[0010] %PHEV_SEC_KEY_UPDATE% Updated security key
DEBU[0010] %PHEV_TCP_RECV_MSG%: [00] START RECV 14 (orig 4e0c00012e26a51d0ce9ada502ba)
DEBU[0010] %PHEV_RECV_LISTENER% message not sent
DEBU[0010] %PHEV_TCP_SEND_MSG%: [79] PING REQ (id 27)
DEBU[0010] %PHEV_TCP_SEND_MSG%: [79] PING REQ (id 28)
DEBU[0011] %PHEV_TCP_SEND_MSG%: [79] PING REQ (id 29)
DEBU[0011] %PHEV_SEC_KEY_UPDATE% Updated security key
DEBU[0011] %PHEV_TCP_RECV_MSG%: [00] START RECV 14 (orig 4e0c0001d88b6194f237c769020e)
DEBU[0011] %PHEV_RECV_LISTENER% message not sent
DEBU[0011] %PHEV_TCP_SEND_MSG%: [3e] PING REQ (id 2a)
DEBU[0011] %PHEV_TCP_SEND_MSG%: [3e] PING REQ (id 2b)
DEBU[0012] %PHEV_TCP_SEND_MSG%: [3e] PING REQ (id 2c)
DEBU[0012] %PHEV_SEC_KEY_UPDATE% Updated security key
DEBU[0012] %PHEV_TCP_RECV_MSG%: [00] START RECV 14 (orig 4e0c00018b619c8b6194f23f0296)
DEBU[0012] %PHEV_RECV_LISTENER% message not sent
DEBU[0012] %PHEV_TCP_SEND_MSG%: [8d] PING REQ (id 2d)
DEBU[0012] %PHEV_TCP_SEND_MSG%: [8d] PING REQ (id 2e)
DEBU[0013] %PHEV_TCP_SEND_MSG%: [8d] PING REQ (id 2f)
DEBU[0013] %PHEV_SEC_KEY_UPDATE% Updated security key
DEBU[0013] %PHEV_TCP_RECV_MSG%: [00] START RECV 14 (orig 4e0c00012e2e2e26ada5158b02ff)
DEBU[0013] %PHEV_RECV_LISTENER% message not sent
DEBU[0013] %PHEV_TCP_SEND_MSG%: [f0] PING REQ (id 30)
DEBU[0013] %PHEV_TCP_SEND_MSG%: [f0] PING REQ (id 31)
DEBU[0014] %PHEV_TCP_SEND_MSG%: [f0] PING REQ (id 32)
DEBU[0014] %PHEV_SEC_KEY_UPDATE% Updated security key
DEBU[0014] %PHEV_TCP_RECV_MSG%: [00] START RECV 14 (orig 4e0c0001d883d0f237cfe11d027e)
DEBU[0014] %PHEV_RECV_LISTENER% message not sent
DEBU[0014] %PHEV_TCP_SEND_MSG%: [9b] PING REQ (id 33)
DEBU[0014] %PHEV_TCP_SEND_MSG%: [9b] PING REQ (id 34)
DEBU[0015] %PHEV_TCP_SEND_MSG%: [9b] PING REQ (id 35)
DEBU[0015] %PHEV_SEC_KEY_UPDATE% Updated security key
DEBU[0015] %PHEV_TCP_RECV_MSG%: [00] START RECV 14 (orig 4e0c00018b69158b619c83d80249)
DEBU[0015] %PHEV_RECV_LISTENER% message not sent
DEBU[0015] %PHEV_TCP_SEND_MSG%: [96] PING REQ (id 36)
DEBU[0015] %PHEV_TCP_SEND_MSG%: [96] PING REQ (id 37)
DEBU[0016] %PHEV_TCP_SEND_MSG%: [96] PING REQ (id 38)
DEBU[0016] %PHEV_SEC_KEY_UPDATE% Updated security key
DEBU[0016] %PHEV_TCP_RECV_MSG%: [00] START RECV 14 (orig 4e0c00012e26ada51d0ce11d022a)
DEBU[0016] %PHEV_RECV_LISTENER% message not sent
DEBU[0016] %PHEV_TCP_SEND_MSG%: [6a] PING REQ (id 39)
DEBU[0016] %PHEV_TCP_SEND_MSG%: [6a] PING REQ (id 3a)
DEBU[0017] %PHEV_TCP_SEND_MSG%: [6a] PING REQ (id 3b)
DEBU[0017] %PHEV_SEC_KEY_UPDATE% Updated security key
DEBU[0017] %PHEV_TCP_RECV_MSG%: [00] START RECV 14 (orig 4e0c0001d88b691d0ce9a51d02fd)
DEBU[0017] %PHEV_RECV_LISTENER% message not sent
DEBU[0017] %PHEV_TCP_SEND_MSG%: [df] PING REQ (id 3c)
DEBU[0017] %PHEV_TCP_SEND_MSG%: [df] PING REQ (id 3d)
DEBU[0018] %PHEV_TCP_SEND_MSG%: [df] PING REQ (id 3e)
DEBU[0018] %PHEV_SEC_KEY_UPDATE% Updated security key
DEBU[0018] %PHEV_TCP_RECV_MSG%: [00] START RECV 14 (orig 4e0c00018b6194fac7619c8b0226)
DEBU[0018] %PHEV_RECV_LISTENER% message not sent
DEBU[0018] %PHEV_TCP_SEND_MSG%: [01] PING REQ (id 3f)
DEBU[0018] %PHEV_TCP_SEND_MSG%: [01] PING REQ (id 40)
^C

seems to go on forever..

Originally posted by @BunpGhost in #22 (comment)

Then I decided to go thru all the Merges until it starts to break. And the last commit that works for me is this:
fe47367
After this one is the XOR Security Key. And it fails like the logs above.
So, something is not working for me.
Can you help? Am I doing something wrong?
Thanks

Unstable connection

Out of interest, what do you use to connect to the Outlander with?

I was becoming frustrated with my Raspberry Pi's seemingly flaky connection, so I bought a little Mikrotik router, set it all up to connect and route to the Outlander, which seemed to work fine (i.e. 100% ping success) until I start phev2mqtt up, where it then works for about a minute and then I lose connection to the Outlander. If I restart the Mikrotik wireless interface, it all comes back up again for another minute and the cycle repeats

root@pi4:~/phev# ./start.sh
INFO[0000] %PHEV_TCP_CONNECTED%
INFO[0066] Connection closed.
ERRO[0066] Connection closed.
ERRO[0066] %PHEV_TCP_WRITER_ERROR%: write tcp 192.168.100.90:38430->192.168.8.46:8080: use of closed network connection
ERRO[0067] dial tcp 192.168.8.46:8080: connect: connection refused
ERRO[0075] dial tcp 192.168.8.46:8080: connect: no route to host
ERRO[0079] dial tcp 192.168.8.46:8080: connect: no route to host
ERRO[0082] dial tcp 192.168.8.46:8080: connect: no route to host
ERRO[0085] dial tcp 192.168.8.46:8080: connect: no route to host
ERRO[0088] dial tcp 192.168.8.46:8080: connect: no route to host
ERRO[0091] dial tcp 192.168.8.46:8080: connect: no route to host
ERRO[0094] dial tcp 192.168.8.46:8080: connect: no route to host
ERRO[0097] dial tcp 192.168.8.46:8080: connect: no route to host
ERRO[0100] dial tcp 192.168.8.46:8080: connect: no route to host
ERRO[0103] dial tcp 192.168.8.46:8080: connect: no route to host
ERRO[0104] dial tcp 192.168.8.46:8080: connect: no route to host
ERRO[0105] dial tcp 192.168.8.46:8080: connect: no route to host
ERRO[0106] dial tcp 192.168.8.46:8080: connect: no route to host
ERRO[0107] dial tcp 192.168.8.46:8080: connect: no route to host
ERRO[0108] dial tcp 192.168.8.46:8080: connect: no route to host
ERRO[0109] dial tcp 192.168.8.46:8080: connect: no route to host
ERRO[0110] dial tcp 192.168.8.46:8080: connect: no route to host
ERRO[0111] dial tcp 192.168.8.46:8080: connect: no route to host
ERRO[0112] dial tcp 192.168.8.46:8080: connect: no route to host
ERRO[0113] dial tcp 192.168.8.46:8080: connect: no route to host
INFO[0114] %PHEV_TCP_CONNECTED%
INFO[0189] Connection closed.

Which all seems a little weird

Same thing happens when I do a netcat nc 192.168.8.46 8080
Just wondered if you'd seen similar behaviour and if so if you had any hints?

2020 PHEV connection issues.

Hi!

I've just set up phev2mqtt and have gotten it connected to Home Assistant and everything shows up and seems to be reading properly for about a minute or two but after that it all becomes unavailable.

I'm also not able to turn on anything. If I do, it flips back off and the logs says the following:

level=info msg="Topic: [phev/set/parkinglights] Payload: [on]"
level=info msg="Error setting register 0xb: timed out attempting to set register 0b"

It eventually fails and disconnects.

level=error msg="Disconnecting due to too many errors"
level=info msg="Error setting register 0xb: timed out attempting to set register 0a"
level=info msg="%PHEV_TCP_CONNECTED%"
level=debug msg="%%PHEV_START_AWAIT%%"

Once it connects again, it runs and endless loop of level=debug msg="%PHEV_TCP_SEND_MSG%: [00] PING REQ (id 1)" and the "id" keeps going up and up until it does level=debug msg="%%PHEV_START_TIMEOUT%%" and level=error msg="timed out waiting for start"

While watching the logs, I also noticed that this just popped in:

level=debug msg="%%PHEV_TCP_READER_ERROR%%: read tcp 192.168.8.47:40010->192.168.8.46:8080: i/o timeout"
level=debug msg="%PHEV_TCP_READER_CLOSE%"
level=debug msg="%PHEV_TCP_SEND_MSG%: [00] PING REQ (id 3b)"
level=error msg="%PHEV_TCP_WRITER_ERROR%: write tcp 192.168.8.47:40010->192.168.8.46:8080: use of closed network connection"
level=debug msg="%PHEV_TCP_WRITER_CLOSE%"

After rebooting I randomly get level=error msg="dial tcp 192.168.8.46:8080: connect: connection refused" and it doesn't reconnect to the car unless I reboot the Pi.

Do you have any advice on how to troubleshoot this further or fix this?

My20 issues

Hi,
Thanks for this gateway. It's great! I have Outlander from 2020.
I have several questions/requests, let me know if you'd like to divide them into separate issues.

{
  "device": {
    "identifiers": [
      "mitsubishi_0x84fd27fffe5f0651"
    ],
    "manufacturer": "Mitsubishi",
    "model": "",
    "name": "Mitsubishi Outlander Phev",
    "sw_version": "Phev2Mqtt"
  }
}
  • what do you use for Wifi connection manager? I'm trying NetworkManager, but I don't think it's working very well.

[Discussion] Further protocol reversing

I started to look into the protocol and stumbled upon the undetermined XOR algorithm - so I decided to dig deeper. Instead of looking at PCAPs or the responses from the car I started implementing a car simulator and connected the official app to it. As of now it looks promising, since I already found that the XOR value is only dependent on the Init connection packet (not the IP, or MAC or anything else I can think of). By modifying the Init connection packet content, I can reproducably change the XOR used by the app.

As of now, it looks like the app uses the data of the Init connection packet AND 0x00080808080808080800 while the first byte has to be 0x01 and the last byte is discarded. So we get 8 relevant bits, which is the byte used for determining the initial XOR value. All three of the following init packets result in the exact same XOR value (0x66) used by the app:

5e 0c 00 01507a37cfe11583d801 8d
5E 0C 00 01000800080000000800 83
5E 0C 00 01F7FFF7FFF7F7F7FFF7 32

After looking at the app (using my scissor ;-) I found three constants to enable debug logging in the app. The modified app can be found here.

By looking at the log output I can tell that the one byte from the init connection packet is logged directly as security_key and used further to create the XOR value by some kind of KEY_MAP lookup:

iMobile2: send sync time-------------------------------
iMobile2: -------security_key------ 138
iMobile2: send: E5 04 01 01 00 EB
iMobile2: -------KEY_MAP[0]------ 102
iMobile2: recv: 5E 0C 00 01 50 7A 37 CF E1 15 83 D8 01 8D
iMobile2: -------security_key------ 128
iMobile2: send: E5 04 01 01 00 EB
iMobile2: -------KEY_MAP[0]------ 128
iMobile2: recv: 5E 0C 00 01 00 00 00 00 00 00 00 08 00 73
iMobile2: send sync time-------------------------------
iMobile2: -------security_key------ 0
iMobile2: send: E5 04 01 01 00 EB
iMobile2: -------KEY_MAP[0]------ 0
iMobile2: recv: 5E 0C 00 01 00 00 00 00 00 00 00 00 00 6B
iMobile2: send Mac Addr
iMobile2: -------security_key------ 192
iMobile2: send: E5 04 01 01 00 EB
iMobile2: -------KEY_MAP[0]------ 115
iMobile2: recv: 5E 0C 00 01 00 00 00 00 00 00 08 08 00 7B

So the bits are interpreted with the LSB first:

0x0008000800000008 -> 0b_1000_1010 -> 138
0x0000000000000008 -> 0b_1000_0000 -> 128
0x0000000000000000 -> 0b_0000_0000 -> 0
0x0000000000000808 -> 0b_1100_0000 -> 192

My biggest obstacle right now is that I have only remote access to a car, so it would be great if someone could trace the registration process (so I can at least add a static example to my vehicle emulator). The log output of a registered app would be helpful as well.

To create the log file, you would need to install the modified app (which may remove the registration and all the data associated with the app - at least it did for me) and enable USB debugging. The log can then be extracted with adb logcat -s iMobile2.

If you don't trust my binary, you can also create your own, by using the commands and changes documented in the history of the app repo.

Not working on a 2014 outlander, MSG [AC]RESP18 ID A

Hello,
the latest version doesnt work at all as mentioned in issue #23. The version from pull request #17 works as a client, but eventually gets into a cycle. client MQTT does this as well, and doesnt get discovered by HA. Here is the debug log:

pi@mqtt:~/phev2mqtt$ ./phev2mqtt client mqtt --mqtt_username "celtec" --mqtt_password "celtec" -v=debug
INFO[0000] %PHEV_TCP_CONNECTED%
DEBU[0000] %%PHEV_START_AWAIT%%
DEBU[0001] %PHEV_TCP_RECV_MSG%: [00] START RECV 14 (orig 4e0c0001a5158b691d0ce11d0232)
DEBU[0001] %%PHEV_START_RECV%%
DEBU[0001] %%PHEV_START_DONE%%
DEBU[0001] %PHEV_TCP_SEND_MSG%: [00] START SEND 14 (orig )
DEBU[0001] %PHEV_TCP_RECV_MSG%: [01] REGISTER NTFY (reg 0x02 data 00000000)
DEBU[0001] %PHEV_TCP_SEND_MSG%: [01] REGISTER ACK (reg 0x02 data 00)
DEBU[0001] %PHEV_TCP_RECV_MSG%: [79] REGISTER NTFY (reg 0x03 data 011163)
DEBU[0001] %PHEV_TCP_SEND_MSG%: [79] REGISTER ACK (reg 0x03 data 00)
DEBU[0001] %PHEV_TCP_RECV_MSG%: [97] REGISTER NTFY (reg 0x07 data 00)
DEBU[0001] %PHEV_TCP_SEND_MSG%: [97] REGISTER ACK (reg 0x07 data 00)
DEBU[0001] %PHEV_TCP_RECV_MSG%: [bd] REGISTER NTFY (reg 0x0c data 04)
DEBU[0001] %PHEV_TCP_SEND_MSG%: [bd] REGISTER ACK (reg 0x0c data 00)
DEBU[0002] %PHEV_TCP_RECV_MSG%: [58] REGISTER NTFY (reg 0x0d data 02)
DEBU[0002] %PHEV_TCP_SEND_MSG%: [58] REGISTER ACK (reg 0x0d data 00)
DEBU[0004] %PHEV_TCP_RECV_MSG%: [77] REGISTER NTFY (reg 0x0e data 00)
DEBU[0004] %PHEV_TCP_SEND_MSG%: [77] REGISTER ACK (reg 0x0e data 00)
DEBU[0004] %PHEV_TCP_RECV_MSG%: [89] REGISTER NTFY (reg 0x0f data 00)
DEBU[0004] %PHEV_TCP_RECV_MSG%: [fc] REGISTER NTFY (reg 0x10 data 00)
DEBU[0004] %PHEV_TCP_RECV_MSG%: [3c] REGISTER NTFY (reg 0x11 data 00)
DEBU[0004] %PHEV_TCP_RECV_MSG%: [6c] REGISTER NTFY (reg 0x12 data 1701030f2e2e02)
DEBU[0004] %PHEV_TCP_RECV_MSG%: [8b] REGISTER NTFY (reg 0x13 data 00)
DEBU[0004] %PHEV_TCP_RECV_MSG%: [a1] REGISTER NTFY (reg 0x14 data 00000000000000)
DEBU[0004] %PHEV_TCP_SEND_MSG%: [89] REGISTER ACK (reg 0x0f data 00)
DEBU[0004] %PHEV_TCP_SEND_MSG%: [fc] REGISTER ACK (reg 0x10 data 00)
DEBU[0004] %PHEV_TCP_SEND_MSG%: [3c] REGISTER ACK (reg 0x11 data 00)
DEBU[0004] %PHEV_TCP_SEND_MSG%: [6c] REGISTER ACK (reg 0x12 data 00)
DEBU[0004] %PHEV_TCP_SEND_MSG%: [8b] REGISTER ACK (reg 0x13 data 00)
DEBU[0004] %PHEV_TCP_SEND_MSG%: [a1] REGISTER ACK (reg 0x14 data 00)
DEBU[0004] %PHEV_TCP_RECV_MSG%: [da] REGISTER NTFY (reg 0x15 data 004a4d42584447473257455a3031353336330001)
DEBU[0004] %PHEV_TCP_SEND_MSG%: [da] REGISTER ACK (reg 0x15 data 00)
DEBU[0005] %PHEV_TCP_RECV_MSG%: [b8] REGISTER NTFY (reg 0x16 data 02e501a61ea71e00)
DEBU[0005] %PHEV_TCP_SEND_MSG%: [b8] REGISTER ACK (reg 0x16 data 00)
DEBU[0005] %PHEV_TCP_RECV_MSG%: [4a] REGISTER NTFY (reg 0x17 data 01)
DEBU[0005] %PHEV_TCP_SEND_MSG%: [4a] REGISTER ACK (reg 0x17 data 00)
DEBU[0005] %PHEV_TCP_RECV_MSG%: [05] REGISTER NTFY (reg 0x18 data ffffffff07ffff1fffffffff07ffff1f)
DEBU[0005] %PHEV_TCP_SEND_MSG%: [05] REGISTER ACK (reg 0x18 data 00)
DEBU[0005] %PHEV_TCP_RECV_MSG%: [54] REGISTER NTFY (reg 0x19 data 01ffffffff07ffff1f)
DEBU[0005] %PHEV_TCP_SEND_MSG%: [54] REGISTER ACK (reg 0x19 data 00)
DEBU[0005] %PHEV_TCP_RECV_MSG%: [f8] REGISTER NTFY (reg 0x1a data 0000)
DEBU[0005] %PHEV_TCP_SEND_MSG%: [f8] REGISTER ACK (reg 0x1a data 00)
DEBU[0005] %PHEV_TCP_RECV_MSG%: [98] REGISTER NTFY (reg 0x1b data 01)
DEBU[0005] %PHEV_TCP_SEND_MSG%: [98] REGISTER ACK (reg 0x1b data 00)
DEBU[0005] %PHEV_TCP_RECV_MSG%: [36] REGISTER NTFY (reg 0x1c data 02)
DEBU[0005] %PHEV_TCP_SEND_MSG%: [36] REGISTER ACK (reg 0x1c data 00)
DEBU[0005] %PHEV_TCP_RECV_MSG%: [02] REGISTER NTFY (reg 0x1d data 0c000003)
DEBU[0005] %PHEV_TCP_SEND_MSG%: [02] REGISTER ACK (reg 0x1d data 00)
DEBU[0005] %PHEV_TCP_RECV_MSG%: [c0] REGISTER NTFY (reg 0x1e data 0000)
DEBU[0005] %PHEV_TCP_SEND_MSG%: [c0] REGISTER ACK (reg 0x1e data 00)
DEBU[0005] %PHEV_TCP_RECV_MSG%: [a6] REGISTER NTFY (reg 0x1f data 00ffff)
DEBU[0005] %PHEV_TCP_SEND_MSG%: [a6] REGISTER ACK (reg 0x1f data 00)
DEBU[0005] %PHEV_TCP_RECV_MSG%: [ad] REGISTER NTFY (reg 0x20 data 0000ff7fff01ff7fff01)
DEBU[0005] %PHEV_TCP_SEND_MSG%: [ad] REGISTER ACK (reg 0x20 data 00)
DEBU[0005] %PHEV_TCP_RECV_MSG%: [a9] REGISTER NTFY (reg 0x21 data 01)
DEBU[0005] %PHEV_TCP_SEND_MSG%: [a9] REGISTER ACK (reg 0x21 data 00)
DEBU[0005] %PHEV_TCP_RECV_MSG%: [0d] REGISTER NTFY (reg 0x22 data 0000ff7fff01)
DEBU[0005] %PHEV_TCP_SEND_MSG%: [0d] REGISTER ACK (reg 0x22 data 00)
DEBU[0005] %PHEV_TCP_RECV_MSG%: [2c] REGISTER NTFY (reg 0x23 data 0000000202)
DEBU[0005] %PHEV_TCP_SEND_MSG%: [2c] REGISTER ACK (reg 0x23 data 00)
DEBU[0005] %PHEV_TCP_RECV_MSG%: [f6] REGISTER NTFY (reg 0x24 data 02000000000000000000)
DEBU[0005] %PHEV_TCP_SEND_MSG%: [f6] REGISTER ACK (reg 0x24 data 00)
DEBU[0005] %PHEV_TCP_RECV_MSG%: [db] REGISTER NTFY (reg 0x25 data 0e00ff)
DEBU[0005] %PHEV_TCP_SEND_MSG%: [db] REGISTER ACK (reg 0x25 data 00)
DEBU[0005] %PHEV_TCP_RECV_MSG%: [b4] REGISTER NTFY (reg 0x26 data 00)
DEBU[0005] %PHEV_TCP_SEND_MSG%: [b4] REGISTER ACK (reg 0x26 data 00)
DEBU[0005] %PHEV_TCP_RECV_MSG%: [8e] REGISTER NTFY (reg 0x27 data 00)
DEBU[0005] %PHEV_TCP_SEND_MSG%: [8e] REGISTER ACK (reg 0x27 data 00)
DEBU[0005] %PHEV_TCP_RECV_MSG%: [69] REGISTER NTFY (reg 0x28 data 52454d4f5445343562666b63ffffffffffffffffffffffffffffffffffffffff)
DEBU[0005] %PHEV_TCP_SEND_MSG%: [69] REGISTER ACK (reg 0x28 data 00)
DEBU[0005] %PHEV_TCP_RECV_MSG%: [17] REGISTER NTFY (reg 0x29 data 0001)
DEBU[0005] %PHEV_TCP_SEND_MSG%: [17] REGISTER ACK (reg 0x29 data 00)
DEBU[0005] %PHEV_TCP_RECV_MSG%: [5c] REGISTER NTFY (reg 0x2c data 00)
DEBU[0005] %PHEV_TCP_SEND_MSG%: [5c] REGISTER ACK (reg 0x2c data 00)
DEBU[0005] %PHEV_TCP_RECV_MSG%: [08] REGISTER NTFY (reg 0xc0 data 30303330303030303030000100)
DEBU[0005] %PHEV_TCP_SEND_MSG%: [08] REGISTER ACK (reg 0xc0 data 00)
DEBU[0005] %PHEV_TCP_RECV_MSG%: [75] REGISTER NTFY (reg 0x01 data 0100)
DEBU[0005] %PHEV_TCP_SEND_MSG%: [75] REGISTER ACK (reg 0x01 data 00)
DEBU[0005] %PHEV_TCP_RECV_MSG%: [be] REGISTER NTFY (reg 0x16 data 02e501a61ea71e00)
DEBU[0005] %PHEV_TCP_SEND_MSG%: [be] REGISTER ACK (reg 0x16 data 00)
DEBU[0005] %PHEV_TCP_RECV_MSG%: [9f] REGISTER NTFY (reg 0x29 data 0001)
DEBU[0005] %PHEV_TCP_SEND_MSG%: [9f] REGISTER ACK (reg 0x29 data 00)
DEBU[0005] %PHEV_TCP_RECV_MSG%: [0a] REGISTER NTFY (reg 0x2c data 00)
DEBU[0005] %PHEV_TCP_SEND_MSG%: [0a] REGISTER ACK (reg 0x2c data 00)
DEBU[0005] %PHEV_TCP_RECV_MSG%: [cb] REGISTER NTFY (reg 0xc0 data 30303330303030303030000100)
DEBU[0005] %PHEV_TCP_SEND_MSG%: [cb] REGISTER ACK (reg 0xc0 data 00)
DEBU[0005] %PHEV_TCP_RECV_MSG%: [44] REGISTER NTFY (reg 0x16 data 02e501a61ea71e00)
DEBU[0005] %PHEV_TCP_SEND_MSG%: [44] REGISTER ACK (reg 0x16 data 00)
DEBU[0016] %PHEV_TCP_RECV_MSG%: [2d] START RESP18 (orig: 2f03000133)
DEBU[0016] %PHEV_TCP_SEND_MSG%: [2d] PING REQ (id a)
DEBU[0016] %PHEV_TCP_RECV_MSG%: [2d] PING RESP (id a)
DEBU[0030] %PHEV_TCP_RECV_MSG%: [2d] START RESP18 (orig: 2f03000133)
DEBU[0030] %PHEV_TCP_SEND_MSG%: [2d] PING REQ (id a)
DEBU[0030] %PHEV_TCP_RECV_MSG%: [2d] PING RESP (id a)
DEBU[0045] %PHEV_TCP_RECV_MSG%: [2d] START RESP18 (orig: 2f03000133)
DEBU[0045] %PHEV_TCP_SEND_MSG%: [2d] PING REQ (id a)
DEBU[0045] %PHEV_TCP_RECV_MSG%: [2d] PING RESP (id a)
DEBU[0060] %PHEV_TCP_RECV_MSG%: [2d] START RESP18 (orig: 2f03000133)
DEBU[0060] %PHEV_TCP_SEND_MSG%: [2d] PING REQ (id a)
DEBU[0060] %PHEV_TCP_RECV_MSG%: [2d] PING RESP (id a)
DEBU[0075] %PHEV_TCP_RECV_MSG%: [2d] START RESP18 (orig: 2f03000133)
DEBU[0075] %PHEV_TCP_SEND_MSG%: [2d] PING REQ (id a)
DEBU[0075] %PHEV_TCP_RECV_MSG%: [2d] PING RESP (id a)
DEBU[0092] %PHEV_TCP_RECV_MSG%: [2d] START RESP18 (orig: 2f03000133)
DEBU[0092] %PHEV_TCP_SEND_MSG%: [2d] PING REQ (id a)
DEBU[0092] %PHEV_TCP_RECV_MSG%: [2d] PING RESP (id a)
DEBU[0105] %PHEV_TCP_RECV_MSG%: [2d] START RESP18 (orig: 2f03000133)
DEBU[0105] %PHEV_TCP_SEND_MSG%: [2d] PING REQ (id a)
DEBU[0106] %PHEV_TCP_RECV_MSG%: [2d] PING RESP (id a)
DEBU[0120] %PHEV_TCP_RECV_MSG%: [2d] START RESP18 (orig: 2f03000133)
DEBU[0120] %PHEV_TCP_SEND_MSG%: [2d] PING REQ (id a)
DEBU[0120] %PHEV_TCP_RECV_MSG%: [2d] PING RESP (id a)
DEBU[0135] %PHEV_TCP_RECV_MSG%: [2d] START RESP18 (orig: 2f03000133)
DEBU[0135] %PHEV_TCP_SEND_MSG%: [2d] PING REQ (id a)
DEBU[0135] %PHEV_TCP_RECV_MSG%: [2d] PING RESP (id a)
DEBU[0150] %PHEV_TCP_RECV_MSG%: [2d] START RESP18 (orig: 2f03000133)
DEBU[0150] %PHEV_TCP_SEND_MSG%: [2d] PING REQ (id a)
DEBU[0150] %PHEV_TCP_RECV_MSG%: [2d] PING RESP (id a)
DEBU[0165] %PHEV_TCP_RECV_MSG%: [2d] START RESP18 (orig: 2f03000133)
DEBU[0165] %PHEV_TCP_SEND_MSG%: [2d] PING REQ (id a)
DEBU[0165] %PHEV_TCP_RECV_MSG%: [2d] PING RESP (id a)
DEBU[0180] %PHEV_TCP_RECV_MSG%: [2d] START RESP18 (orig: 2f03000133)
DEBU[0180] %PHEV_TCP_SEND_MSG%: [2d] PING REQ (id a)
DEBU[0180] %PHEV_TCP_RECV_MSG%: [2d] PING RESP (id a)
DEBU[0195] %PHEV_TCP_RECV_MSG%: [2d] START RESP18 (orig: 2f03000133)
DEBU[0195] %PHEV_TCP_SEND_MSG%: [2d] PING REQ (id a)
DEBU[0195] %PHEV_TCP_RECV_MSG%: [2d] PING RESP (id a)
DEBU[0210] %PHEV_TCP_RECV_MSG%: [2d] START RESP18 (orig: 2f03000133)
DEBU[0210] %PHEV_TCP_SEND_MSG%: [2d] PING REQ (id a)
DEBU[0210] %PHEV_TCP_RECV_MSG%: [2d] PING RESP (id a)
DEBU[0225] %PHEV_TCP_RECV_MSG%: [2d] START RESP18 (orig: 2f03000133)
DEBU[0225] %PHEV_TCP_SEND_MSG%: [2d] PING REQ (id a)
DEBU[0225] %PHEV_TCP_RECV_MSG%: [2d] PING RESP (id a)
DEBU[0241] %PHEV_TCP_RECV_MSG%: [2d] START RESP18 (orig: 2f03000133)
DEBU[0241] %PHEV_TCP_SEND_MSG%: [2d] PING REQ (id a)
DEBU[0241] %PHEV_TCP_RECV_MSG%: [2d] PING RESP (id a)
DEBU[0255] %PHEV_TCP_RECV_MSG%: [2d] START RESP18 (orig: 2f03000133)
DEBU[0255] %PHEV_TCP_SEND_MSG%: [2d] PING REQ (id a)
DEBU[0255] %PHEV_TCP_RECV_MSG%: [2d] PING RESP (id a)
DEBU[0270] %PHEV_TCP_RECV_MSG%: [2d] START RESP18 (orig: 2f03000133)
DEBU[0270] %PHEV_TCP_SEND_MSG%: [2d] PING REQ (id a)
DEBU[0270] %PHEV_TCP_RECV_MSG%: [2d] PING RESP (id a)
DEBU[0285] %PHEV_TCP_RECV_MSG%: [2d] START RESP18 (orig: 2f03000133)
DEBU[0285] %PHEV_TCP_SEND_MSG%: [2d] PING REQ (id a)
DEBU[0285] %PHEV_TCP_RECV_MSG%: [2d] PING RESP (id a)
DEBU[0300] %PHEV_TCP_RECV_MSG%: [2d] START RESP18 (orig: 2f03000133)
DEBU[0300] %PHEV_TCP_SEND_MSG%: [2d] PING REQ (id a)
DEBU[0300] %PHEV_TCP_RECV_MSG%: [2d] PING RESP (id a)
DEBU[0301] %PHEV_TCP_SEND_MSG%: [00] REGISTER SET (reg 0x06 data 03)
DEBU[0301] %PHEV_TCP_RECV_MSG%: [2d] BAD ENCODING (exp: 0x67)
DEBU[0301] %PHEV_TCP_SEND_MSG%: [67] REGISTER SET (reg 0x06 data 03)
DEBU[0301] %PHEV_TCP_RECV_MSG%: [2d] REGISTER SETACK (reg 0x06 data 00)
DEBU[0301] %PHEV_TCP_RECV_MSG%: [67] REGISTER NTFY (reg 0x12 data 1701030f332e02)
DEBU[0301] %PHEV_TCP_SEND_MSG%: [67] REGISTER ACK (reg 0x12 data 00)
DEBU[0301] %PHEV_TCP_RECV_MSG%: [fa] BAD ENCODING (exp: 0xd0)
DEBU[0301] %PHEV_TCP_RECV_MSG%: [fa] REGISTER NTFY (reg 0x16 data 02d9011a23db0100)
DEBU[0301] %PHEV_TCP_SEND_MSG%: [fa] REGISTER ACK (reg 0x16 data 00)
DEBU[0301] %PHEV_TCP_RECV_MSG%: [d0] Cmd: 0xcc () (len 6), Register 0xdc, Data: d0
DEBU[0301] %PHEV_TCP_RECV_MSG%: [d0] BAD ENCODING (exp: 0x42)
DEBU[0302] %PHEV_TCP_RECV_MSG%: [d0] REGISTER NTFY (reg 0x1d data 0c000007)
DEBU[0302] %PHEV_TCP_SEND_MSG%: [d0] REGISTER ACK (reg 0x1d data 00)
DEBU[0302] %PHEV_TCP_RECV_MSG%: [42] Cmd: 0xcc () (len 6), Register 0x64, Data: 42
DEBU[0302] %PHEV_TCP_RECV_MSG%: [42] BAD ENCODING (exp: 0xbb)
DEBU[0302] %PHEV_TCP_RECV_MSG%: [42] REGISTER NTFY (reg 0x12 data 1701030f332e02)
DEBU[0302] %PHEV_TCP_SEND_MSG%: [42] REGISTER ACK (reg 0x12 data 00)
DEBU[0302] %PHEV_TCP_RECV_MSG%: [bb] Cmd: 0xcc () (len 6), Register 0xf, Data: bb
DEBU[0302] %PHEV_TCP_RECV_MSG%: [bb] BAD ENCODING (exp: 0x5a)
DEBU[0303] %PHEV_TCP_RECV_MSG%: [bb] REGISTER NTFY (reg 0x16 data 02d9011a23db0100)
DEBU[0303] %PHEV_TCP_SEND_MSG%: [bb] REGISTER ACK (reg 0x16 data 00)
DEBU[0303] %PHEV_TCP_RECV_MSG%: [5a] Cmd: 0xcc () (len 6), Register 0x17, Data: 5a
DEBU[0303] %PHEV_TCP_RECV_MSG%: [5a] BAD ENCODING (exp: 0x1c)
DEBU[0303] %PHEV_TCP_RECV_MSG%: [5a] REGISTER NTFY (reg 0x1d data 0c000007)
DEBU[0303] %PHEV_TCP_SEND_MSG%: [5a] REGISTER ACK (reg 0x1d data 00)
DEBU[0303] %PHEV_TCP_RECV_MSG%: [1c] Cmd: 0xcc () (len 6), Register 0xb0, Data: 1c
DEBU[0303] %PHEV_TCP_RECV_MSG%: [1c] BAD ENCODING (exp: 0x68)
DEBU[0304] %PHEV_TCP_RECV_MSG%: [1c] REGISTER NTFY (reg 0x12 data 1701030f332e02)
DEBU[0304] %PHEV_TCP_SEND_MSG%: [1c] REGISTER ACK (reg 0x12 data 00)
DEBU[0304] %PHEV_TCP_RECV_MSG%: [68] Cmd: 0xcc () (len 6), Register 0x82, Data: 68
DEBU[0304] %PHEV_TCP_RECV_MSG%: [68] BAD ENCODING (exp: 0x33)
DEBU[0304] %PHEV_TCP_RECV_MSG%: [68] REGISTER NTFY (reg 0x16 data 02d9011a23db0100)
DEBU[0304] %PHEV_TCP_SEND_MSG%: [68] REGISTER ACK (reg 0x16 data 00)
DEBU[0304] %PHEV_TCP_RECV_MSG%: [33] Cmd: 0xcc () (len 6), Register 0xad, Data: 33
DEBU[0304] %PHEV_TCP_RECV_MSG%: [33] BAD ENCODING (exp: 0x40)
DEBU[0305] %PHEV_TCP_RECV_MSG%: [33] REGISTER NTFY (reg 0x1d data 0c000007)
DEBU[0305] %PHEV_TCP_SEND_MSG%: [33] REGISTER ACK (reg 0x1d data 00)
DEBU[0305] %PHEV_TCP_RECV_MSG%: [40] Cmd: 0xcc () (len 6), Register 0x85, Data: 40
DEBU[0305] %PHEV_TCP_RECV_MSG%: [40] BAD ENCODING (exp: 0x76)
DEBU[0305] %PHEV_TCP_RECV_MSG%: [40] REGISTER NTFY (reg 0x12 data 1701030f332e02)
DEBU[0305] %PHEV_TCP_SEND_MSG%: [40] REGISTER ACK (reg 0x12 data 00)
DEBU[0305] %PHEV_TCP_RECV_MSG%: [76] Cmd: 0xcc () (len 6), Register 0xc0, Data: 76
DEBU[0305] %PHEV_TCP_RECV_MSG%: [76] BAD ENCODING (exp: 0x04)
DEBU[0306] %PHEV_TCP_RECV_MSG%: [76] REGISTER NTFY (reg 0x16 data 02d9011a23db0100)
DEBU[0306] %PHEV_TCP_SEND_MSG%: [76] REGISTER ACK (reg 0x16 data 00)
DEBU[0306] %PHEV_TCP_RECV_MSG%: [04] Cmd: 0xcc () (len 6), Register 0x84, Data: 04
DEBU[0307] %PHEV_TCP_RECV_MSG%: [04] BAD ENCODING (exp: 0xe0)
DEBU[0307] %PHEV_TCP_RECV_MSG%: [04] REGISTER NTFY (reg 0x1d data 0c000007)
DEBU[0307] %PHEV_TCP_SEND_MSG%: [04] REGISTER ACK (reg 0x1d data 00)
DEBU[0307] %PHEV_TCP_RECV_MSG%: [e0] Cmd: 0xcc () (len 6), Register 0x12, Data: e0
DEBU[0307] %PHEV_TCP_RECV_MSG%: [e0] BAD ENCODING (exp: 0xe3)
DEBU[0307] %PHEV_TCP_RECV_MSG%: [e0] REGISTER NTFY (reg 0x12 data 1701030f332e02)
DEBU[0307] %PHEV_TCP_SEND_MSG%: [e0] REGISTER ACK (reg 0x12 data 00)
DEBU[0307] %PHEV_TCP_RECV_MSG%: [e3] Cmd: 0xcc () (len 6), Register 0xf5, Data: e3
DEBU[0307] %PHEV_TCP_RECV_MSG%: [e3] REGISTER NTFY (reg 0x16 data 02d9011a23db0100)
DEBU[0307] %PHEV_TCP_SEND_MSG%: [e3] REGISTER ACK (reg 0x16 data 00)
DEBU[0308] %PHEV_TCP_RECV_MSG%: [06] REGISTER NTFY (reg 0x1d data 0c000007)
DEBU[0308] %PHEV_TCP_SEND_MSG%: [06] REGISTER ACK (reg 0x1d data 00)
DEBU[0308] %PHEV_TCP_RECV_MSG%: [2e] REGISTER NTFY (reg 0x12 data 1701030f332e02)
DEBU[0308] %PHEV_TCP_SEND_MSG%: [2e] REGISTER ACK (reg 0x12 data 00)
DEBU[0308] %PHEV_TCP_RECV_MSG%: [66] REGISTER NTFY (reg 0x16 data 02f1017206730600)
DEBU[0308] %PHEV_TCP_SEND_MSG%: [66] REGISTER ACK (reg 0x16 data 00)
DEBU[0308] %PHEV_TCP_RECV_MSG%: [5d] REGISTER NTFY (reg 0x1d data 0c000003)
DEBU[0308] %PHEV_TCP_SEND_MSG%: [5d] REGISTER ACK (reg 0x1d data 00)
DEBU[0308] %PHEV_TCP_RECV_MSG%: [55] REGISTER NTFY (reg 0x16 data 02b4003506760e00)
DEBU[0308] %PHEV_TCP_SEND_MSG%: [55] REGISTER ACK (reg 0x16 data 00)
DEBU[0308] %PHEV_TCP_RECV_MSG%: [96] REGISTER NTFY (reg 0x16 data 02370e3806390000)
DEBU[0308] %PHEV_TCP_SEND_MSG%: [96] REGISTER ACK (reg 0x16 data 00)
DEBU[0308] %PHEV_TCP_RECV_MSG%: [28] REGISTER NTFY (reg 0x16 data 023a00fb013c0000)
DEBU[0308] %PHEV_TCP_SEND_MSG%: [28] REGISTER ACK (reg 0x16 data 00)
DEBU[0308] %PHEV_TCP_RECV_MSG%: [61] REGISTER NTFY (reg 0x16 data 024106420603fe00)
DEBU[0308] %PHEV_TCP_SEND_MSG%: [61] REGISTER ACK (reg 0x16 data 00)
DEBU[0308] %PHEV_TCP_RECV_MSG%: [51] REGISTER NTFY (reg 0x16 data 02c41e850e861e00)
DEBU[0308] %PHEV_TCP_SEND_MSG%: [51] REGISTER ACK (reg 0x16 data 00)
DEBU[0308] %PHEV_TCP_RECV_MSG%: [8a] REGISTER NTFY (reg 0x16 data 02473e081e493e00)
DEBU[0308] %PHEV_TCP_SEND_MSG%: [8a] REGISTER ACK (reg 0x16 data 00)
DEBU[0308] %PHEV_TCP_RECV_MSG%: [b5] REGISTER NTFY (reg 0x16 data 02ca014bfe8c0a00)
DEBU[0308] %PHEV_TCP_SEND_MSG%: [b5] REGISTER ACK (reg 0x16 data 00)
DEBU[0308] %PHEV_TCP_RECV_MSG%: [d2] REGISTER NTFY (reg 0x16 data 024d1e0e064f0600)
DEBU[0308] %PHEV_TCP_SEND_MSG%: [d2] REGISTER ACK (reg 0x16 data 00)
DEBU[0308] %PHEV_TCP_RECV_MSG%: [8d] REGISTER NTFY (reg 0x16 data 0210121106d20100)
DEBU[0308] %PHEV_TCP_SEND_MSG%: [8d] REGISTER ACK (reg 0x16 data 00)
DEBU[0309] %PHEV_TCP_RECV_MSG%: [10] REGISTER NTFY (reg 0x16 data 02d301d401d50100)
DEBU[0309] %PHEV_TCP_SEND_MSG%: [10] REGISTER ACK (reg 0x16 data 00)
DEBU[0309] %PHEV_TCP_RECV_MSG%: [5b] REGISTER NTFY (reg 0x16 data 02961ed701d80100)
DEBU[0309] %PHEV_TCP_SEND_MSG%: [5b] REGISTER ACK (reg 0x16 data 00)
DEBU[0309] %PHEV_TCP_RECV_MSG%: [85] REGISTER NTFY (reg 0x16 data 02dc015d065e0600)
DEBU[0309] %PHEV_TCP_SEND_MSG%: [85] REGISTER ACK (reg 0x16 data 00)
DEBU[0309] %PHEV_TCP_RECV_MSG%: [1b] REGISTER NTFY (reg 0x16 data 021f00600ee10100)
DEBU[0309] %PHEV_TCP_SEND_MSG%: [1b] REGISTER ACK (reg 0x16 data 00)
DEBU[0309] %PHEV_TCP_RECV_MSG%: [15] REGISTER NTFY (reg 0x16 data 02e201e301240e00)
DEBU[0309] %PHEV_TCP_SEND_MSG%: [15] REGISTER ACK (reg 0x16 data 00)
DEBU[0309] %PHEV_TCP_RECV_MSG%: [91] REGISTER NTFY (reg 0x16 data 02e801e9012a3e00)
DEBU[0309] %PHEV_TCP_SEND_MSG%: [91] REGISTER ACK (reg 0x16 data 00)
DEBU[0309] %PHEV_TCP_RECV_MSG%: [f7] REGISTER NTFY (reg 0x16 data 02ab0e6c00ed0100)
DEBU[0309] %PHEV_TCP_SEND_MSG%: [f7] REGISTER ACK (reg 0x16 data 00)
DEBU[0309] %PHEV_TCP_RECV_MSG%: [dc] REGISTER NTFY (reg 0x16 data 02ee016f00f00100)
DEBU[0309] %PHEV_TCP_SEND_MSG%: [dc] REGISTER ACK (reg 0x16 data 00)
DEBU[0315] %PHEV_TCP_RECV_MSG%: [ac] START RESP18 (orig: 2f03000133)
DEBU[0315] %PHEV_TCP_SEND_MSG%: [ac] PING REQ (id a)
DEBU[0315] %PHEV_TCP_RECV_MSG%: [ac] PING RESP (id a)
DEBU[0330] %PHEV_TCP_RECV_MSG%: [ac] START RESP18 (orig: 2f03000133)
DEBU[0330] %PHEV_TCP_SEND_MSG%: [ac] PING REQ (id a)
DEBU[0330] %PHEV_TCP_RECV_MSG%: [ac] PING RESP (id a)
DEBU[0345] %PHEV_TCP_RECV_MSG%: [ac] START RESP18 (orig: 2f03000133)
DEBU[0345] %PHEV_TCP_SEND_MSG%: [ac] PING REQ (id a)
DEBU[0345] %PHEV_TCP_RECV_MSG%: [ac] PING RESP (id a)
DEBU[0361] %PHEV_TCP_RECV_MSG%: [ac] START RESP18 (orig: 2f03000133)
DEBU[0361] %PHEV_TCP_SEND_MSG%: [ac] PING REQ (id a)
DEBU[0361] %PHEV_TCP_RECV_MSG%: [ac] PING RESP (id a)

And so on

Climate support for My14

Finally managed to connect my '15 Outlander thanks to the work of @IceEyz (#10) . However I stumble upon one problem. Attempting to set the climate mode always returns the following output:

INFO[0159] Topic: [phev/set/climate/heat] Payload: [on]
ERRO[0168] Disconnecting due to too many errors
INFO[0169] %PHEV_TCP_CONNECTED%
INFO[0169] Error setting register 0x1b: timed out attempting to set register 1b

So I decided to install a PCAP packet sniffer on my phone, and create separate PCAP files for setting each climate mode, for example, setting mode cool for 10 minutes, schedule disabled sends/receives the following packages:

INFO[0000] out  [b7] REGISTER SET  (reg 0x05 data 150c1515331e0200) 
INFO[0000] in   [b7] REGISTER NTFY (reg 0x01 data 0100) 
INFO[0000] out  [7b] REGISTER ACK  (reg 0x01 data 00)
INFO[0000] in   [78] REGISTER NTFY (reg 0x10 data 02)   
INFO[0000] out  [09] PING REQ      (id 8)               
INFO[0000] out  [09] REGISTER ACK  (reg 0x10 data 00)   
INFO[0000] in   [09] PING RESP     (id 8)     
INFO[0000] in   [6f] REGISTER NTFY (reg 0x1a data 0001) 
INFO[0000] out  [66] PING REQ      (id c)               
INFO[0000] out  [66] REGISTER ACK  (reg 0x1a data 00)   
INFO[0000] in   [66] PING RESP     (id c)               
INFO[0000] in   [66] REGISTER NTFY (reg 0x1b data 01)   
INFO[0000] out  [c5] REGISTER ACK  (reg 0x1b data 00)   
INFO[0000] in   [c5] REGISTER NTFY (reg 0x1c data 01)   
INFO[0000] out  [98] REGISTER ACK  (reg 0x1c data 00)   
INFO[0000] in   [a7] REGISTER NTFY (reg 0x10 data 01)   
INFO[0000] out  [a7] REGISTER ACK  (reg 0x10 data 00)
INFO[0000] in   [8c] REGISTER NTFY (reg 0x12 data 150c1515331e02) 
INFO[0000] out  [c8] REGISTER ACK  (reg 0x12 data 00)   

The only register being set is 0x05 I sniffed the following data, all with scheme disabled

     #Cool
     15 0c 15 15 33 1e 02 00       #10mins
     15 0c 15 15 35 15 02 00       #20mins
     15 0c 15 15 36 03 02 00       #30mins
     #Heat
     15 0c 15 15 30 32 02 00       #10mins
     15 0c 15 15 31 24 02 00       #20mins
     15 0c 15 15 32 15 02 00       #30mins
     #Windscreen
     15 0c 15 15 2e 11 02 00       #10mins
     15 0c 15 15 2f 14 02 00        #20mins
     15 0c 15 15 30 02 02 00       #30mins

#NOTE: The spaces between the values are added afterwards for readability.

0x12 returns the data being sent to 0x05, except for the last to zeroes.
e.g. setting register 0x05 to 150c1515331e0200, returns 150c1515331e02 on 0x12
0x10 always returns 02, except when the AC state is off, then 01
0x1a always returns 0001, except when AC state is off, then 0000

0x1c returns the current state, a little bit different than other versions

  • 01 = Cool for 10 minutes
  • 11 = Cool for 20 minutes
  • 21 = Cool for 30 minutes
  • 02 = Heat for 10 minutes
  • 12 = Heat for 20 minutes
  • 22 = Heat for 30 minutes
  • 03 = Heat windscreen for 10 minutes
  • 13 = Heat windscreen for 20 minutes
  • 23 = Heat windscreen for 30 minutes

Now, I'm not really sure how to proceed now. According to the protocol documentation the function for 0x12 is timesync, My knowledge about hex programming is a bit limited, but could it be that the 0x05 values I sniffed using the app contain a timestamp?
I already added the 0x1c states to the go files on my PC.

I added the PCAP files to this issue, figured they might be useful for further reference.
Climate PCAP My14.zip

front_right_door and front_left_door are switched

From my testing, when I open the front right door, the left door icon turns yellow and vice-versa.
So I believer that the binary_sensor.phev_front_right_door is switched with the binary_sensor.phev_front_left_door

MY16 cant get it to register

Hi,
This project looks like just what im looking for except I cant get my connection to register.

Ive reset the car leaving both registration slots empty but still don't seem to be able to get a successful register.

Output from ./phev2mqtt client register below.
mike@ubuntuserver:~/phev2mqtt-master$ ./phev2mqtt client register
INFO[0000] %PHEV_TCP_CONNECTED%
Client connected and started!
^C

And also part of my output from "ip a"
3: wls16: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 00:c2:c6:a1:d6:0a brd ff:ff:ff:ff:ff:ff
altname wlp0s16
inet6 fe80::2c2:c6ff:fea1:d60a/64 scope link
valid_lft forever preferred_lft forever

Is there any way to trouble shoot this?

Thanks for your time!

sensor.phev_battery sometimes shows incorrect amount

Not narrowed down what's happening here but the sensor.phev_battery stops showing the correct value (currently on my car 94%), starts showing an incorrect value (possibly 100%-correct value) (currently on my car 5%), then back to the correct value.

Looking at the history from MQTT explorer (for phev/battery/level), it's around 5mins at right value, between 5-30s at incorrect value, then back again.

I'll see if I can set up some traces for more info.

Getting timed out waiting for start once connected.

I have followed this installation guide, i think accurately from what I can tell.

I'm using a Raspberry Pi 3 Model B Rev 1.2

When I run the MQTT connection command I get the following response on the pi:

pi@raspberrypi:~ $ ./phev2mqtt-master/phev2mqtt client mqtt --mqtt_server tcp://192.168.1.101:1883/ --mqtt_username username --mqtt_password password
INFO[0000] %PHEV_TCP_CONNECTED%                         
ERRO[0020] timed out waiting for start                  
INFO[0021] %PHEV_TCP_CONNECTED%                         
ERRO[0041] timed out waiting for start                  
ERRO[0172] dial tcp 192.168.8.46:8080: connect: connection timed out 
INFO[0173] %PHEV_TCP_CONNECTED%        

The MQTT broker on HA shows the following related logs:

1643018628: New client connected from 192.168.1.115 as phev2mqtt (p2, c1, k30, u'username').
1643018742: Socket error on client phev2mqtt, disconnecting.

I've double checked my MQTT details and they're correct. I've also ran iwconfig and the WiFi is connected to the cars SSID. I've also spoofed the MAC Address of my mobile phone to the wlan0 of the Pi.

UPDATE:

I've run the mqtt command with the debug tag:

INFO[0000] %PHEV_TCP_CONNECTED%                         
DEBU[0000] %%PHEV_START_AWAIT%%                         
DEBU[0001] %PHEV_TCP_RECV_MSG%: [00] START RECV18  (orig 5e0c0001619c8b691d04691501fc) 
DEBU[0001] %PHEV_TCP_SEND_MSG%: [00] START SEND    (orig ) 
DEBU[0001] %PHEV_TCP_RECV_MSG%: [ae] REGISTER NTFY (reg 0x1d data 5e000003) 
DEBU[0001] %PHEV_TCP_RECV_MSG%: [a4] REGISTER NTFY (reg 0x1e data 0000) 
DEBU[0002] %PHEV_TCP_RECV_MSG%: [1d] REGISTER NTFY (reg 0x1f data 000000) 
DEBU[0002] %PHEV_TCP_RECV_MSG%: [e5] REGISTER NTFY (reg 0x21 data 00) 
DEBU[0003] %PHEV_TCP_RECV_MSG%: [a5] REGISTER NTFY (reg 0x22 data 000000000000) 
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[0041] %%PHEV_START_TIMEOUT%%                       
ERRO[0041] timed out waiting for start                  
INFO[0057] %PHEV_TCP_CONNECTED%                         
DEBU[0057] %%PHEV_START_AWAIT%%                         
DEBU[0058] %PHEV_TCP_RECV_MSG%: [00] START RECV18  (orig 5e0c0001507a3f5072b63f580184) 
DEBU[0058] %PHEV_TCP_SEND_MSG%: [00] START SEND    (orig ) 
DEBU[0058] %PHEV_TCP_RECV_MSG%: [c4] REGISTER NTFY (reg 0xc0 data 30303630303330303030100100) 
DEBU[0059] %PHEV_TCP_RECV_MSG%: [15] REGISTER NTFY (reg 0x01 data 0102) 
DEBU[0060] %PHEV_TCP_RECV_MSG%: [0c] REGISTER NTFY (reg 0x02 data 02000000) 
DEBU[0060] %PHEV_TCP_RECV_MSG%: [6d] REGISTER NTFY (reg 0x03 data 011573) 
DEBU[0061] %PHEV_TCP_RECV_MSG%: [e8] REGISTER NTFY (reg 0x04 data 00ffff0300ffff0300ffff0300ffff0300ffff03) 
DEBU[0077] %%PHEV_START_TIMEOUT%%                       
ERRO[0077] timed out waiting for start                  
INFO[0078] %PHEV_TCP_CONNECTED%                         
DEBU[0078] %%PHEV_START_AWAIT%%                         
DEBU[0078] %%PHEV_TCP_READER_ERROR%%: EOF               
DEBU[0078] %PHEV_TCP_READER_CLOSE%    

FURTHER UPDATE:

I ran client watch and got this

INFO[0000] %PHEV_TCP_CONNECTED%                         
panic: timed out waiting for start

goroutine 1 [running]:
github.com/buxtronix/phev2mqtt/cmd.Run(0x7871c0, {0xae8288, 0x0, 0x0})
	/home/pi/phev2mqtt-master/cmd/watch.go:50 +0x520
github.com/spf13/cobra.(*Command).execute(0x7871c0, {0xae8288, 0x0, 0x0})
	/home/pi/golib/pkg/mod/github.com/spf13/[email protected]/command.go:860 +0x644
github.com/spf13/cobra.(*Command).ExecuteC(0x786f30)
	/home/pi/golib/pkg/mod/github.com/spf13/[email protected]/command.go:974 +0x414
github.com/spf13/cobra.(*Command).Execute(...)
	/home/pi/golib/pkg/mod/github.com/spf13/[email protected]/command.go:902
github.com/buxtronix/phev2mqtt/cmd.Execute()
	/home/pi/phev2mqtt-master/cmd/root.go:55 +0x20
main.main()
	/home/pi/phev2mqtt-master/main.go:22 +0x14

[Question] Protocol documentation - A/B variants and location column

Hi there @buxtronix @zivillian,

I've been meaning to expand the protocol table (in https://github.com/buxtronix/phev2mqtt/blob/master/protocol/README.md) for further documentation of the registries. Two questions that you are probably able to answer:

  • There is mention of A/B variants of the registries. Could this be the MY'14 / MY'18 distinction? (seems like it to be based on registry 0x4 for example)
  • What exactly is the meaning of the "Location" column?

Works first time.....but stops after a day?

I have a Raspberry Pi connecting to the car's wifi.

This Pi is registered, and running phev2mqtt works....until the next day for example.

When its failing the Pi loses the car's wifi whenever phev2mqtt runs, as if its being kicked off the network.

The -v=debug log is as follows:

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:37878->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

Any help would be appreciated!

2019 PHEV - Issue communicating after registering is done

So, I keep getting this when running the watch command.

Just disconnects from the wlan and loses it's ip assignments. This is on a Raspberry Pi 3b.

image

Before running the command:
image

After:
image

What I've done:

  • Followed the readme.md for installing prerequisites and compiling with go.
  • Set up the rpi to connect to the car and made sure it got a 192.168.8.x address (should I turn off ipv6 on the pi wlan0 btw?)
  • Put car in registration mode
  • Ran the client registration command and got "success"
  • Tried the client watch command while the car was still in registration mode and got ECU-information and VIN displayed
  • Locked the car and here I am trying to make this work.

Not working on my14

Hi there,

Mqtt is reporting unavailable to HA.

I saw that IP is x.x.8.48, should it be 47?

I have this in service status:

Jul 22 16:16:11 raspberrypi phev2mqtt[1736]: time="2022-07-22T16:16:11+01:00" level=debug msg="%PHEV_TCP_RECV_MSG%: [25] Cmd: 0xcc () (len 6), Register 0x97, Data: 5c"
Jul 22 16:16:11 raspberrypi phev2mqtt[1736]: time="2022-07-22T16:16:11+01:00" level=debug msg="%PHEV_TCP_RECV_MSG%: [25] BAD ENCODING  (exp: 0xcc)"
Jul 22 16:16:11 raspberrypi phev2mqtt[1736]: time="2022-07-22T16:16:11+01:00" level=debug msg="%PHEV_TCP_RECV_MSG%: [25] REGISTER NTFY (reg 0x1a data 0000)"
Jul 22 16:16:11 raspberrypi phev2mqtt[1736]: time="2022-07-22T16:16:11+01:00" level=debug msg="%PHEV_TCP_SEND_MSG%: [25] REGISTER ACK  (reg 0x1a data 00)"
Jul 22 16:16:11 raspberrypi phev2mqtt[1736]: time="2022-07-22T16:16:11+01:00" level=debug msg="%PHEV_TCP_RECV_MSG%: [b3] Cmd: 0xcc () (len 6), Register 0x1f, Data: cc"
Jul 22 16:16:11 raspberrypi phev2mqtt[1736]: time="2022-07-22T16:16:11+01:00" level=debug msg="%PHEV_TCP_RECV_MSG%: [b3] BAD ENCODING  (exp: 0x3d)"
Jul 22 16:16:12 raspberrypi phev2mqtt[1736]: time="2022-07-22T16:16:12+01:00" level=debug msg="%PHEV_TCP_RECV_MSG%: [b3] REGISTER NTFY (reg 0x1b data 01)"
Jul 22 16:16:12 raspberrypi phev2mqtt[1736]: time="2022-07-22T16:16:12+01:00" level=debug msg="%PHEV_TCP_SEND_MSG%: [b3] REGISTER ACK  (reg 0x1b data 00)"
Jul 22 16:16:12 raspberrypi phev2mqtt[1736]: time="2022-07-22T16:16:12+01:00" level=debug msg="%PHEV_TCP_RECV_MSG%: [96] Cmd: 0xcc () (len 6), Register 0x78, Data: 3d"
Jul 22 16:16:12 raspberrypi phev2mqtt[1736]: time="2022-07-22T16:16:12+01:00" level=debug msg="%PHEV_TCP_RECV_MSG%: [96] BAD ENCODING  (exp: 0x25)"

Vehicle settings discussion

I have spent a little time trying to figure out the way the "Vehicle Settings" (per the OEM app) are communicated.

I have some initial code and notes in https://github.com/buxtronix/phev2mqtt/blob/settings/protocol/SETTINGS.md

Basically, the car sends settings using register 0x16, and updates to these are sent by the app via 0x0f. Updating
the settings is easy - it's two bytes - one is the setting, the other is the new value.

However decoding what comes from the car is harder. If I change a setting, I can see relevant bits change in what
is returned from 0x16, though figuring out the whole structure is harder - in particular exactly how we know what
settings are conveyed in a particular 0x16 packet...going to need to figure this out a bit more..

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.