phev-remote / phevcore

MIT License
30 stars 11 forks source link

Information request on webapi calls to outlander #1

Closed leonvandebroek closed 1 year ago

leonvandebroek commented 5 years ago

Hello papawattu,

I am thinking About writing a simple app which uses the default direct iPhone WiFi connection to connect to my outlander 2014 and makes api calls to 192.168.8.46:8080 to get information using about the car. The next step would be to change settings of my car.

I’m massively under impressed by the quality of the old school official Mitsubishi app.

As you have built a kind of interface for the car, do you have experience sending api calls using http requests directly to the 192.168.8.46:8080 endpoint when connected to the cars wifi?

Any help would be appreciated,

Kind regards,

Léon van de Broek

papawattu commented 5 years ago

Hi Leon

The requests are not http unfortunately, they are a binary message format which I've mostly got a handle on now. I've rewritten some code to send an encoded message and decode the messages take a look at the tests

https://github.com/papawattu/phev-core/blob/master/test/test_phev_service.c

If you want to help contribute I'd love your help as progress is slow at my end at the moment.

Jamie.

runestone74 commented 5 years ago

Hi, I have a 2018 PHEV and is very frustrated by the fact that the fab remote cooling/heating are not available over 3G/4G, just a very short range WiFi. I have a working solution with TeamViewer Host on a cellphone connected to a USB-port for charging in the car right now, but I would love to make a proper Home Assistant solution ( https://www.home-assistant.io/hassio/ ) I found your project just by googling the IP adress and port that the PHEV uses :) I did not find anything other than the Pentest security test otherwise... I have set up WireShark equvivalent Packet Capture which works fine to get both PCAP and line by line info on the communication, so tell me if can help you out in some way. Thanks for your great efforts so far papawattu.

papawattu commented 5 years ago

Hi I share your frustration, it was the reason for me starting development. The objective of this is to create a gateway connected to a 3G/4G network. I have this library working on a ESP32 which is paired to a 2G card is using MQTT,

I will take a look at the hassio project and see how easy it will integrate with what's there already.

Keep an eye on this repo for more coming soon.

Jamie.

runestone74 commented 5 years ago

Super, I think if you have an Raspberry Pi inside the car with hassio installed it could easily be hacked together with https://www.home-assistant.io/components/sensor.command_line/ as a first step before making a more complex MQTT remote polling: https://www.home-assistant.io/components/#search/mqtt

Den fre 23 aug. 2019 kl 10:36 skrev Jamie Nuttall <notifications@github.com

:

Hi I share your frustration, it was the reason for me starting development. The objective of this is to create a gateway connected to a 3G/4G network. I have this library working on a ESP32 which is paired to a 2G card is using MQTT,

I will take a look at the hassio project and see how easy it will integrate with what's there already.

Keep an eye on this repo for more coming soon.

Jamie.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/phev-remote/phevcore/issues/1?email_source=notifications&email_token=AGFMEU2NJ2EDBVE6G6EHWG3QF6OQPA5CNFSM4G427IB2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD47REUY#issuecomment-524227155, or mute the thread https://github.com/notifications/unsubscribe-auth/AGFMEU6TXABZQ6HTQTS3RALQF6OQPANCNFSM4G427IBQ .

skoef commented 5 years ago

Hi guys, I'm in a similar situation. My idea was to hook up a raspberry pi right outside of where I park my car, with the raspberry connected to my home LAN and constantly trying to see if it could connect to the car. Then, when it can connect, gather some data periodically and show some grafana graphs perhaps about some statistics in a web-interface. This web-interface would then also offer buttons like headlight/parking lights etc, just like the app would, but then accessible over your regular WiFi.

Anyway, initially I wanted to reverse engineer the binary protocol to a Go library, my go-to language (pun intended) and just like @runestone74 stumbled upon this project while searching for more information about the WiFi interface of the car. So instead of re-inventing the wheel, I figured let's give this a try. But up until now, without any luck. I've tried registering the raspberry pi 30 times and created tcpdumps of whatever was happening (there wás in fact stuff happening) but it didn't work. Or I wasn't patient enough, but after 10 minutes per try I gave up. I also tried giving my Pi the MAC-address of the iPhone that I did register with the car. Also didn't work.

So I would like to help out in whatever way with this project, although I'm a complete n00b in C-coding, or still going to create that Go-library afterall. But it would really help if I at least could register my device. So far I found out that besides the commands listed there were command types 0xe4/0x4e and 0xf3/0x3f being passed back and forth when I created a tcpdump while using my iOS app.

By the way, I couldn't compile phevctl without changing PHEV_START to PHEV_STARTED on https://github.com/phev-remote/phevctl/blob/master/main.c#L280.

papawattu commented 5 years ago

I'd not pushed a change to the core library, sorry about that. Should be fixed now.

The best way to see the flows is looking at the tests for registration have a look at the test_phev_register_outHandlerOutE2E. link

Also there needs to be a constant ping from the client to the car so that the car doesn't close the connection.

If you'd like some help creating a golang client then I'm happy to get involved.

skoef commented 5 years ago

@papawattu I'd like that very much (you getting involved). Is there any way we can get in contact, other than this form of slowchat? You can reach me on reinier [at] skoef.nl if you want.

Also, indeed I looked at the test-framework, but like I said, C is just not my thing and I'm not savvy enough to debug/mess around with it.

runestone74 commented 5 years ago

Would it be possible for an pure android version, where you could just have GUI buttons for all functions? This would make it easy to remote control without any extra hardware, since most people have an extra cellphone laying around. A Moto phone could be bought new for around €99 so it would be a quick and easy fix to make some progress :) I am not a coder, just a tinkerer and scripter, that is why I dont take in this task! Thanks!

Den mån 2 sep. 2019 kl 20:13 skrev Reinier Schoof <notifications@github.com

:

@papawattu https://github.com/papawattu I'd like that very much (you getting involved). Is there any way we can get in contact, other than this form of slowchat? You can reach me on reinier [at] skoef.nl if you want.

Also, indeed I looked at the test-framework, but like I said, C is just not my thing and I'm not savvy enough to debug/mess around with it.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/phev-remote/phevcore/issues/1?email_source=notifications&email_token=AGFMEUZNOLCOWKCZUROCOR3QHVJVNA5CNFSM4G427IB2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5WLIEI#issuecomment-527217681, or mute the thread https://github.com/notifications/unsubscribe-auth/AGFMEU2KN2WG222OKJG42UTQHVJVNANCNFSM4G427IBQ .

papawattu commented 5 years ago

It is possible, unfortunately building Android apps and fancy UI's is not my strong point.

runestone74 commented 5 years ago

The code you got now, is this a compatible hardware? https://banggood.app.link/AtArm9Qal1

Den sön 3 nov. 2019 18:09Jamie Nuttall notifications@github.com skrev:

It is possible, unfortunately building Android apps and fancy UI's is not my strong point.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/phev-remote/phevcore/issues/1?email_source=notifications&email_token=AGFMEU3KYORXWRHCOWIUEA3QR4AWBA5CNFSM4G427IB2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEC5X2WA#issuecomment-549158232, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGFMEU2EHRNIXD2EQLLECU3QR4AWBANCNFSM4G427IBQ .

papawattu commented 5 years ago

Yes in fact I have two of them, they work fine I am just tweaking a few things at the moment.

papawattu commented 5 years ago

Hi,

I have a working beta version with the TTGO device. New project is here https://github.com/phev-remote/phev-ttgo

Please let me know if you can get this working.

It's great to be able to control the car from outside its WiFi range.

Jamie.

runestone74 commented 5 years ago

I'm waiting for delivery of my TT-GO I will update u when I have tried. Thanks!

Den tis 19 nov. 2019 17:41Jamie Nuttall notifications@github.com skrev:

Hi,

I have a working beta version with the TTGO device. New project is here https://github.com/phev-remote/phev-ttgo

Please let me know if you can get this working.

It's great to be able to control the car from outside its WiFi range.

Jamie.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/phev-remote/phevcore/issues/1?email_source=notifications&email_token=AGFMEU6XFU4SLP5IAHWVB5DQUQJMTA5CNFSM4G427IB2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEEO3SBQ#issuecomment-555596038, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGFMEUYO3KVZB64MLBYFL7DQUQJMTANCNFSM4G427IBQ .

papawattu commented 5 years ago

Great ! I am working on building a web based UI as well so you don't need to use raw MQTT commands. It was great for a frosty morning I was able to set off the heater from bed :)

runestone74 commented 5 years ago

I would love to integrate this with the MQTT broker in Home Assistant

Den tis 19 nov. 2019 18:08Jamie Nuttall notifications@github.com skrev:

Great ! I am working on building a web based UI as well so you don't need to use raw MQTT commands. It was great for a frosty morning I was able to set off the heater from bed :)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/phev-remote/phevcore/issues/1?email_source=notifications&email_token=AGFMEU42RSVH3VWS7VT5T2DQUQMPBA5CNFSM4G427IB2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEEO6SCA#issuecomment-555608328, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGFMEU3S5SDESBKADOSGB6DQUQMPBANCNFSM4G427IBQ .

guiguid commented 4 years ago

Hi all, I'm also very interested by Home Assistant integration. I've a MY19 PHEV, I'll try to help. If you plan to use ESP32 or 8266, I suggest you to look at ESPHome https://esphome.io/ as it's already include as an Home Assistant Addon. So you can use intergated developpement include in ESPHome ( GUI, OTA ...)

petitjfl commented 4 years ago

Same here. I have a Mitsubishi phev 2018 and I'm really interested in developing on this initiative.

Whatever I can do to help...

UPDATE:

I will start in the next few days to have the code work on an ESP32. Goal is to have a "relay" device to connect the car to my home WiFi. From there it would be easy to integrate with Home assistant or other mqtt etc..

Hopefully I will be able to go somewhere with this. I'll keep you posted :)

Téléchargez Outlook pour Androidhttps://aka.ms/ghei36


From: Guillaume DELVIT notifications@github.com Sent: Sunday, January 26, 2020 7:19:54 AM To: phev-remote/phevcore phevcore@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Subject: Re: [phev-remote/phevcore] Information request on webapi calls to outlander (#1)

Hi all, I'm also very interested by Home Assistant integration. I've a MY19 PHEV, I'll try to help.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fphev-remote%2Fphevcore%2Fissues%2F1%3Femail_source%3Dnotifications%26email_token%3DAOKJCC5SPNENEIDMCTRYNBLQ7V5WVA5CNFSM4G427IB2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJ5SQWY%23issuecomment-578496603&data=02%7C01%7C%7Cc662c26bc9ee416fdfb208d7a25a0d4f%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637156379955533242&sdata=nr4tkke3OizxHExCqbL7LPiv%2FiAJ10mrure%2BgFDsu2I%3D&reserved=0, or unsubscribehttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAOKJCC7S4I23KICSBO4IDSLQ7V5WVANCNFSM4G427IBQ&data=02%7C01%7C%7Cc662c26bc9ee416fdfb208d7a25a0d4f%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637156379955533242&sdata=ewyj9EfPosllgBtce0m7PET4dKeFIwtAbR0UrK6mND4%3D&reserved=0.


From: Guillaume DELVIT notifications@github.com Sent: Sunday, January 26, 2020 7:19:54 AM To: phev-remote/phevcore phevcore@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Subject: Re: [phev-remote/phevcore] Information request on webapi calls to outlander (#1)

Hi all, I'm also very interested by Home Assistant integration. I've a MY19 PHEV, I'll try to help.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fphev-remote%2Fphevcore%2Fissues%2F1%3Femail_source%3Dnotifications%26email_token%3DAOKJCC5SPNENEIDMCTRYNBLQ7V5WVA5CNFSM4G427IB2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJ5SQWY%23issuecomment-578496603&data=02%7C01%7C%7Cc662c26bc9ee416fdfb208d7a25a0d4f%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637156379955533242&sdata=nr4tkke3OizxHExCqbL7LPiv%2FiAJ10mrure%2BgFDsu2I%3D&reserved=0, or unsubscribehttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAOKJCC7S4I23KICSBO4IDSLQ7V5WVANCNFSM4G427IBQ&data=02%7C01%7C%7Cc662c26bc9ee416fdfb208d7a25a0d4f%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637156379955533242&sdata=ewyj9EfPosllgBtce0m7PET4dKeFIwtAbR0UrK6mND4%3D&reserved=0.

buxtronix commented 4 years ago

Also keen here. Got a 2018 one too, which judging by my tests and packet captures has a different binary format not compatible with this current codebase. Seems the MY18 changes in phevcore are very early for now, and registration doesnt even work yet. Happy to help out.

papawattu commented 4 years ago

Very early days, my car is getting the update on Monday so I will be able to see what changes are needed.

If you know any C that would be great :)

buxtronix commented 4 years ago

My C coding is fine yes, though my reverse-engineering (especially of binary wire formats) is a bit rusty.

I've managed to sniff the session from the official app and car into pcap.

petitjfl commented 4 years ago

Hello :)

It's been a while but I'm back at it... I'm trying to take your code and have it run on ESP32. My plan is to get a "bridge" device. One that is connected to the PHEV permanently and sending data back to my own WiFi network. I'm not sure if I'm doing this right or if I make it over complicated but... I loaded your cJSON & msg-core & phevcore into VSCode and I'm using PlatformIO to build and deploy to ESP32 DevKit v1 board.

I fixed a few include issues then I got compile errors on some lines like uint8_t phev_core_xorDataWithValue(const uint8_t data,uint8_t xor); because of the xor at the end that was recognized as the operator... I renamed them all. Now it all compile.

Where I need help is... what to do next. ;) Then ESP32 has 2 section : setup and loop. I'm not sure how should I be using your code and what function to call...

petitjfl commented 4 years ago

Hi all, I'm also very interested by Home Assistant integration. I've a MY19 PHEV, I'll try to help. If you plan to use ESP32 or 8266, I suggest you to look at ESPHome https://esphome.io/ as it's already include as an Home Assistant Addon. So you can use intergated developpement include in ESPHome ( GUI, OTA ...)

I successfully build a few sensors now with ESPHome… it make it so easy!!! Now I'm really motivated to get this nice PHEV code working on it!!! :)

papawattu commented 4 years ago

There is a version already running on ESP32 which runs on a TTGO device which has built in mobile connection. You can take a look here http://www.runesdata.se/butik/bilelektronik/mitsing-link/

The core library will work on an ESP as its the same code that is used on that device. If you want to do build your own version take a look at the phevctl code that uses this library https://github.com/phev-remote/phevctl/blob/master/main.c

petitjfl commented 4 years ago

Whaaaaaaaaaat !!! I guess I missed that while searching. Thanks!!! I'll have a look for sure!!!

Get Outlook for Androidhttps://aka.ms/ghei36


From: Jamie Nuttall notifications@github.com Sent: Thursday, June 25, 2020 3:19:41 AM To: phev-remote/phevcore phevcore@noreply.github.com Cc: petitjfl petit_jfl@hotmail.com; Comment comment@noreply.github.com Subject: Re: [phev-remote/phevcore] Information request on webapi calls to outlander (#1)

There is a version already running on ESP32 which runs on a TTGO device which has built in mobile connection. You can take a look here http://www.runesdata.se/butik/bilelektronik/mitsing-link/https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.runesdata.se%2Fbutik%2Fbilelektronik%2Fmitsing-link%2F&data=02%7C01%7C%7Cea4b34c220a3409a57f208d818d820fa%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637286663821229627&sdata=vraU5a%2FKujHSXRprUpIr6qsYRRXz0IEhwkh8Yw6rAEw%3D&reserved=0

The core library will work on an ESP as its the same code that is used on that device. If you want to do build your own version take a look at the phevctl code that uses this library https://github.com/phev-remote/phevctl/blob/master/main.chttps://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fphev-remote%2Fphevctl%2Fblob%2Fmaster%2Fmain.c&data=02%7C01%7C%7Cea4b34c220a3409a57f208d818d820fa%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637286663821239614&sdata=ZagMGxM4qoPpsQ2I0j6xp7WuvXgK1Yy66kLznWTgYiI%3D&reserved=0

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fphev-remote%2Fphevcore%2Fissues%2F1%23issuecomment-649299211&data=02%7C01%7C%7Cea4b34c220a3409a57f208d818d820fa%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637286663821239614&sdata=tOfyFLOVNyxhBKIhrSrBKT9aquRC5j%2FdruTxBIvrttc%3D&reserved=0, or unsubscribehttps://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAOKJCC26QYDIHO2OOS3YFKDRYL3A3ANCNFSM4G427IBQ&data=02%7C01%7C%7Cea4b34c220a3409a57f208d818d820fa%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637286663821249608&sdata=VVnfp4TAyfQqSRES15VtstqqIZTBUoM7zuZ%2FEYvC7PY%3D&reserved=0.

frodegr commented 4 years ago

Hello. Has the phev-ttgo project moved somewhere else?

I am trying to compile pvev-core for ESP32 in PlatformIO. I got some error ie regarding malloc(). I have kind of sorted this out, but still not able to successfully compile it.

Any tips on how to integrate phev-remote in an ESP32 project?

best regards, Frode

I have a working beta version with the TTGO device. New project is here https://github.com/phev-remote/phev-ttgo

petitjfl commented 4 years ago

Hello!!!! I was trying to do the same but had to put that aside since there was too many error for my level and skills. I though I was simply doing something wrong and did not had enough time to better learn all that.

I was trying to compile the code and have it deployed on ESP32. I’m also using PlatormIO. Maybe we should get in touch to see if we could help each other?

In my case it was dependencies missing and compile errors…

Sent from Mailhttps://go.microsoft.com/fwlink/?LinkId=550986 for Windows 10

From: frodegrmailto:notifications@github.com Sent: Friday, September 11, 2020 6:48 AM To: phev-remote/phevcoremailto:phevcore@noreply.github.com Cc: petitjflmailto:petit_jfl@hotmail.com; Commentmailto:comment@noreply.github.com Subject: Re: [phev-remote/phevcore] Information request on webapi calls to outlander (#1)

Hello. Has the phev-ttgo project moved somewhere else?

I am trying to compile pvev-core for ESP32 in PlatformIO. I got some error ie regarding malloc(). I have kind of sorted this out, but still not able to successfully compile it.

Any tips on how to integrate phev-remote in an ESP32 project?

best regards, Frode

I have a working beta version with the TTGO device. New project is here https://github.com/phev-remote/phev-ttgohttps://eur04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fphev-remote%2Fphev-ttgo&data=02%7C01%7C%7Cc005c08176834eddadd608d856403488%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637354181037425870&sdata=QF65%2FynjwTb7Cnok9NHzs59sS8HNNATuXwQyxV9uSjc%3D&reserved=0

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://eur04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fphev-remote%2Fphevcore%2Fissues%2F1%23issuecomment-691023156&data=02%7C01%7C%7Cc005c08176834eddadd608d856403488%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637354181037425870&sdata=uhRkAkOIYRgpsT0tWZyx%2F1AW5%2Bmb8lOIfWzNH%2F5zST0%3D&reserved=0, or unsubscribehttps://eur04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAOKJCCYPC7TNCKKRYIHMRVLSFH57NANCNFSM4G427IBQ&data=02%7C01%7C%7Cc005c08176834eddadd608d856403488%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637354181037435866&sdata=BVO9Y1cXKOWKNOnRwMTFIc2wWE3lM1cRWU31YHJ0tyY%3D&reserved=0.

frodegr commented 4 years ago

Hello!!!! I was trying to do the same but had to put that aside since there was too many error for my level and skills. I though I was simply doing something wrong and did not had enough time to better learn all that. I was trying to compile the code and have it deployed on ESP32. I’m also using PlatormIO. Maybe we should get in touch to see if we could help each other? In my case it was dependencies missing and compile errors…

I made some progress (I think) by using the esp-idf framework instead of arduino. The phev* libraries compile with some warnings, but without errors.

The next step is to try to use code from phve-ctl

scooper1 commented 3 years ago

keep on with the good work I am interested in this for home assistant and Phev