robinostlund / homeassistant-volkswagencarnet

Volkswagen Carnet Component for home assistant
GNU General Public License v3.0
335 stars 61 forks source link

Plugin (partially) not working with non-electric engine VW cars #29

Closed SweViver closed 4 years ago

SweViver commented 5 years ago

After fiddling around with the code for this plugin the last days, Im starting to realize it was made for mainly electric engine VW cars. There are several things that makes me believe this. And I think Robin (the developer of this plugin) needs to have a look at how the VW Car-Net EManager Dashboard looks like for non-electric VW cars that have Diesel/Petrol engines only, as the URLs are apparently not the correct. Either VW has changed something on their website with latest updates, or maybe non-electric and electric cars have different dashboards.

Let me take it from start.

I have a non-electric VW Arteon, including climatisation working with Car-Net. I made many attempts the last days to get this plugin working on my Hassio (both version 87.1 and latest 89.1) and had a problem to even get the addon or component to connect to Car-Net, with a Error 400.

As @rickardhho , @Artionet and several others has mentioned, the Error 400 is caused by this URL being incorrect to retrieve emanager information: https://www.volkswagen-car-net.com/portal/user/xxxxxx/yyyyyyyyyyyyyyyyyy/-/emanager/get-emanager Some people suggested to change the last part "get-emanager" to "getemanager". This is made by editing line 255 in the file volkswagercarnet.py which you can find in folder /config/deps/lib/python3.7/site-packages/

The line looks like this:

vehicle_emanager = self.get('-/emanager/get-emanager', rel)

But as far as I can see, changing the url to '-/emanager/getemanager' is not a solution. This URL is incorrect (at least for non-electric VW cars) as it only brings you to the main dashboard again.

Therefore, when I changed that line, I got many errors (see here: https://github.com/robinostlund/homeassistant-volkswagencarnet/issues/26#issuecomment-472193608)

BUT eventually, thanks to @cyberjunky in the thread here I got the plugin to work with my non-electric Arteon, by completely removing the fetch of all e-manager information, editing the lines 254 to 263 in volkswagencarnet.py:

        #fetch vehicle emanage data
        #REMOVED vehicle_emanager = self.get('-/emanager/getemanager', rel)
        # fetch vehicle location data
        vehicle_location = self.get('-/cf/get-location', rel)
        # fetch vehicle details data
        vehicle_details = self.get('-/vehicle-info/get-vehicle-details', rel)
        #REMOVED if vehicle_emanager.get('errorCode', {}) == '0':
        #REMOVED    if vehicle_emanager.get('EManager', {}):
        #REMOVED        self._state[vin]['emanager'] = vehicle_emanager.get('EManager', {})

This way, the plugin and component was successfully installed upon boot of Hassio and HomeAssistant, no more errors and I was able to get a lot of information from my car with fuel, car info, doors locked or unlocked etc etc... and I can now also unlock and lock the car with switches.

Some of the values are fetched from this page, as far as I can tell: https://www.volkswagen-car-net.com/portal/user/xxxxxx/yyyyyyyyyyyyyyyyyy/-/vehicle-info/get-vehicle-details

The problem though, is that my climatization or window heater features are not accessible or even detected this way in Home Assistant. My Arteon is not electric engine car, but the climatization and window heater features are included, and as far as I can see, all these values are located under E-Manager (/emanager/get-emanager), which I obviously removed from loading, to get the plugin to even work with my car.

So...

if you have a non-electric engine VW car and just want to get some car details and ability to lock/unlock your car, then just remove the emanager lines as stated above.

But my personal main reason even using this plugin, is to be able to remotely start the climatization within Home Assistant, instead of the Car-Net smartphone app.

So, now I would like to ask Robin @robinostlund , could you please have a look on how this plugin could be re-made and working with non-electric VW cars including climatization and window heaters as well? Im sure many of us would really appreciate it!

Thank you in advance

mattheo78 commented 5 years ago

As I commented in thread #26, I have the exact same problem. I can confirm that your solution results in the same outcome for me. Me too is mostly interested in the climatization feature. Thanks a lot for taking me this far, really hope that the rest can be resolved aswell.

robinostlund commented 5 years ago

Can you try the latest version that i released now?

mattheo78 commented 5 years ago

Seems to work better. I can't try it out fully right now... Doesn't the S-PIN have to entered somewhere to activate the heater?

Rido commented 5 years ago

Can you try the latest version that i released now?

Yesterday I installed the latest version, but I still get error messages. I have a VW T-Roc.

2019-05-15 11:15:33 WARNING (SyncWorker_13) [volkswagencarnet] Failure when communcating with the server: 400 Client Error: Bad Request for url: https://www.volkswagen-car-net.com/portal/user/xxx/xxxxx/-/emanager/get-emanager, url: https://www.volkswagen-car-net.com/portal/user/xxx/xxxxx/-/emanager/get-emanager

2019-05-15 11:20:34 WARNING (SyncWorker_35) [volkswagencarnet] Failure when communcating with the server: 400 Client Error: Bad Request for url: https://www.volkswagen-car-net.com/portal/user/xxx/xxxxx/-/emanager/get-emanager, url: https://www.volkswagen-car-net.com/portal/user/xxx/xxxxx/-/emanager/get-emanager

pattyland commented 5 years ago

Same here for a VW Golf non-electric:

Failure when communcating with the server: 400 Client Error: Bad Request for url: https://www.volkswagen-car-net.com/portal/user/****/*******/-/emanager/get-emanager,

I guess you just have to implement a switch to disable emanager and the corresponding sensors/switches. I don't have any climatisation via CarNet, although I'm seeing a switch for it