I wrote a small utility for communicating natively with my (MY18) Outlander PHEV via the Remote Control Wifi interface and integrating it into HA via MQTT and auto-discovery. This can be run on a Pi using its Wifi to talk to the car and ethernet to the MQTT broker.
It’s inspired by the Phev Remote work, but written from scratch and includes more functionality and responsiveness.
It’s very usable and responsive as is (~0.5s to change lights) but would love to get more contributions for decoding further features as well as verifying on other model year cars.
Setup docs are included - I also include a bunch of information on the proprietary car protocol.
Yes as it’s the AP you need something like a Pi with both Wifi and Ethernet so that the Pi can connect to the car’s AP and talk to it, as well as reach the MQTT server over the ethernet.
Well, after some fun and games getting my raspberry pi connected to the WiFi (obviously nothing to do with your software, I’m pleased to say getting this up and running was very simple. Haven’t done a great deal more than just connect it up and can see all the MQTT messages flowing out. Amazing job. I’m afraid mine’s the same model as yours though. I’ll have more of a poke about now
Well Done !
I’m not so lucky as you with my Outlander PHEV 2015.
Everything’s ok until the last command ( ./phev2mqtt client mqtt --mqtt_server tcp://<your_mqtt_address:1883/ [--mqtt_username <mqtt_username>] [--mqtt_password <mqtt_password>] ) give me this :
timed out waiting for start dial tcp 192.168.8.46:8080: connect: connection refused
Perhaps try a few troubleshooting steps first before giving up:
Make sure the official app does work with the car, it may have not registered properly.
Do you see the Pi associated with the PHEV? Run iwconfig wlan0 to check.
Is the PI MAC address the same as the device you registered using the official app? Run ifconfig wlan0 to check, it’s the line with ‘ether’.
Can you ping the PHEV? ping 192.168.8.46
Is the official app still connected/running? The car might only allow one connection.
If none of these show the problem, perhaps that year’s model uses a different port? You could try scanning the car apt install nmap ; nmap 192.168.8.46 or even sniff the app as described at the bottom of the repo’s README.
@buxtronix - I’ve created (quite a noddy) local addon for the phev2mqtt client side of things, I’ve been trying to also get the wlan changes working too but that’s a bit harder due to permissions in the docker container. But it seems to work reasonably well, lets you set some parameters and keeps it running. Is that worth adding to the same repo for people to use/improve or should I do that separately?
FYI - might also be worth mentioning needing to add the button-card component to add the lovelace.yaml to the dashboard.
Just tried this, seems to work fine. I’ll do more testing later this week, since some of my issues might be because how I started and what was the initial state of PHEV.
Because of this, all the things I noticed should be taken with a pinch of salt :).
responsiviness seems great! However, lovelace toggles for lights seem to lag (ie. they change back to previous state, and only after a while to reflect real state, logs seem to indicate also reconnect).
with fully charged i get battery state 94.
cable is shown to be unplugged, even though it is plugged. (However, car was already fully charged whe n I first run phev2mqtt, this may be the cause?)
( 4) is there ”recipe” for the lovelace setup shown in the first message somewhere? ) EDIT: just noticed the included lovelace.yaml
My phev is MY19 model, I think the only difference to MY18 might be the battery size?
After few hours, even though phev2mqtt was still running in my raspi I got error’s setting register xx when trying to change anything. Manually restarting phev2mqtt helped.
Haven’t yet physically unplugged the charging cable or anything like that, but noticed that when setting climate mode to cool (which worked, but slightly with the same lagging effect like with lights) following happened as well:
battery level dropped from 94 to 5 immediately
charge time raised from 0 to 1200 and charging from ‘not charging’ to ‘charging’ and charger connected from ‘unplugged’ to ‘plugged’ a bit later
Disabling phev cool retuned those values back in reverse order.
Thanks for the feedback, yes some of these issues are known:
Setting the registers is a bit hit and miss
The algorithm used to choose the xor encryption key is something I haven’t been able to figure out yet. So I set to an arbitrary value, and the car response with the expected value, so I re-send with that value and it usually works. However the code can then go out of sync again and will re-connect to sync up.
I would love for someone with more expertise to try and crack this one.
Fully charged at 94%.
This is correct, but perhaps I can just offset the value to make 94% = 100%, but I need to figure out any possible problems with this.
Charge value sometimes jumping to 5% then back.
This is just what the car sometimes sends. Even the official app glitches like this and shows low charge value briefly. Maybe some smoothing algorithm could help?
Setting climate mode makes other values glitch.
This would be a side effect of (1). When setting the register, the data sometimes goes out of sync and the code will reconnect to the car, sometimes the car will then send those glitched values.
On ‘error setting register’ it should eventually reconnect with the car and sync back up. It generally doesnt remain in an errored state.
I have also just yesterday merged a feature to attempt wifi restart if there are too many connection failures (bearing in mind that this will be triggered a lot if the car is not nearby).
Looks like you have registered with the phone Mac address. Mac address type should be random, then re register. Else it will clash with the real phone Mac when you copy to the pi.