krauskopf / node-red-contrib-car-bmw

Node-RED nodes for BMW ConnectedDrive
Other
11 stars 8 forks source link

Error: Server http statusCode 404 #30

Closed ChrisIDS6 closed 1 year ago

ChrisIDS6 commented 1 year ago

Has anyone also this Problem?

greytuk commented 1 year ago

Yes - started for me within the last 24 hours

ChrisIDS6 commented 1 year ago

Me too, seems to be a Server Problem...

MarcS071 commented 1 year ago

Same here for 2 days now, I think BMW changed the server? App works fine.

arneman commented 1 year ago

Seems like BMW has shut down the v1 API (that is used here) https://forum.iobroker.net/topic/66509/bmw-adapter-404-ressource-not-found/5 @krauskopf

jkellerer commented 1 year ago

Here's another reference: https://github.com/bimmerconnected/bimmer_connected/issues/544

It needs some changes. The /v4/vehicles endpoint returns just a subset of data and the details need to be fetched from /v4/vehicles/state. See: https://github.com/bimmerconnected/bimmer_connected/blob/master/bimmer_connected/account.py#L86

jkellerer commented 1 year ago

A quick check with

  async getCarList() {
    const host = Bmw._getApiServerNew(this._region);
    return Promise.all((await this.get(host, `/eadrax-vcs/v4/vehicles`)).map(async car => {
        let headers = {'bmw-vin': car["vin"]};
        Object.assign(car, await this.get(host, `/eadrax-vcs/v4/vehicles/state?apptimezone=0&appDateTime=${new Date().getTime()}&tireGuardMode=ENABLED`, headers));
        return car;
    }));
  }

shows that the services provide similar data. The structure is however different (previously there was properties and status now this is mostly below state)

Try to prepare a PR if I find the time this week.

krauskopf commented 1 year ago

I made a quickfix based on the code and info from @jkellerer. Credits go to him. Thanks for the groundwork! Published new nodes as v0.5.0.

Please notice, that I introduced a new service "state" which now holds most of the interesting vehicle information: grafik

Example flow to read all states of all cars: grafik

[{"id":"50743fa0.f3ba5","type":"inject","z":"77482163.aa1be","name":"","props":[{"p":"payload","v":"","vt":"date"},{"p":"topic","v":"","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":140,"y":120,"wires":[["83f261b6.ae49b"]]},{"id":"83f261b6.ae49b","type":"car-bmw-list","z":"77482163.aa1be","account":"20974e09.9f9e82","name":"","as":"multi","x":380,"y":120,"wires":[["14e76857.f58c78","cb4090a2.e4aac8"]]},{"id":"14e76857.f58c78","type":"debug","z":"77482163.aa1be","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":630,"y":120,"wires":[]},{"id":"26e62839.e6ff8","type":"car-bmw-get","z":"77482163.aa1be","account":"20974e09.9f9e82","name":"","datatype":"state","x":770,"y":160,"wires":[["717a63b8.7347e4"]]},{"id":"717a63b8.7347e4","type":"debug","z":"77482163.aa1be","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":930,"y":160,"wires":[]},{"id":"cb4090a2.e4aac8","type":"function","z":"77482163.aa1be","name":"","func":"var newMsg = {\n \"vin\": msg.payload.vin\n}\nreturn newMsg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":620,"y":160,"wires":[["26e62839.e6ff8"]]},{"id":"20974e09.9f9e82","type":"car-bmw","name":"","region":"0","unit":"metric","debug":true}]

greytuk commented 1 year ago

Fix is working well for me. Thanks guys. I think converting from KM to Miles is broken now but that is no big deal.

MarcS071 commented 1 year ago

Great! Thanks for the really quick fix!

ChrisIDS6 commented 1 year ago

Thank you, works great!!!