Skoda Connect

Great work.This replaces my workaround with IOBroker to 99%.

One question, there are an attribute for moving/not moving in the position object/data in the app. It is helpful for automations that you want to run when the car is stationary.

Taking the example from the repo, I am not so interested in that my car has moved while driving but I would be interested in that the car has been stationary for x number of minutes and i forgot to lock or that I left the sunroof open.

I will see if I can find it and to an MR.

Hello,

that would be nice, you are rightā€¦ I was checking what is returned with position, unfortunately in position reply I donā€™t see if device is moving or parkedā€¦

{
    "storedPositionResponse": {
        "parkingTimeUTC": "2020-11-04T10:28:23Z",
        "position": {
            "heading": {
                "direction": 3
            },
            "carCoordinate": {
                "latitude": 47123456,
                "longitude": 21123456
            }
        }
    }
}

So I installed 1.0.13 @lendy007 but Iā€™m still unable to trigger the lock/unlock commands. Anything I can test or see in the logs?

Lock/unlock is working fine for me. Is it working for you in Skoda app? Because this function need to be activated by Skoda seller firstā€¦

Perhaps parkingTimeUTC is empty when moving?

Yes it isā€¦ so in the app it works, but on Home Assistant only the airco heating start / stop is working for me.

Looks like you are on to something:

this.setObjectNotExists(vin + ".position.isMoving", {
		type: "state",
		common: {
			name: "is car moving",
			role: "indicator",
			type: "boolean",
			write: false,
			read: true,
		},
		native: {},
	});

	if (resp.statusCode === 204) {
		this.setState(vin + ".position.isMoving", true, true);
		resolve();
		return;
	} else {
		this.setState(vin + ".position.isMoving", false, true);
	}
	if (body && body.storedPositionResponse && body.storedPositionResponse.parkingTimeUTC) {
		body.storedPositionResponse.position.parkingTimeUTC = body.storedPositionResponse.parkingTimeUTC;
	}
}

This is the code from IOBroker. If i read it correctly a 204 return of the position should boil down to that the car is moving.

I did some quick check and it seems that when car is moving - position is returning HTTP 204 (No Content). Can somebody (??? @Farfar/@tanelv ??? ) also confirm this is how it behaves?

@fn87 - wouldnā€™t be enough for you exposing parking time so you can react based on this information? I guess this can be used for logic like when car is parked for XX minutes, do some automation?

Please see my response above, a 204 is an correct assumption.

@fn87 - great, thank you for confirmation from different code that assumption is correct. I will create sensor for moving state also with parking time attribute.

Would you mind sharing from where this code is so I can check more there?

Thank you

I now see in the logging I still get forbidden and stating the SPIN is maybe wrong. Thought I had the correct oneā€¦ but will try to change it and relink the services in the car laterā€¦

@fn87 - https://github.com/lendy007/homeassistant-skodaconnect/releases/tag/1.0.14

attributes vehicleMoving and parkingTime added

2 Likes

Yes that is correct. I already have it implemented in my fork, have a look. I have some more messy code trying to solve a few other items as well so pay no attention to that :laughing:

Edit: I see you had it implemented already, Iā€™m too slow!

Now I see the following warning in the log: 2020-11-25 14:54:26 WARNING (MainThread) [skodaconnect] Could not fetch pre-heating (ClientResponseError), error: 502, message=ā€˜Bad Gatewayā€™, url=URL(ā€˜https://msg.volkswagen.de/fs-car/bs/rs/v1/skoda/CZ/vehicles/<VIN>/statusā€™)

This is correct warning when your car doesnā€™t support auxialiary (parking) heating like Webasto.

Perhaps this should nog be logged as WARNING then, now it just fills up my log file

Correct, standardly it should return HTTP 403, but for heating it seems it is returing HTTP 502. Will fix that in coming release.

Took my kids to school this morning and when I got back I checked the vehicleMoving history, but it had not changed to ā€œMovingā€

You are correct, same for me hereā€¦ Why are things working perfectly only in DEV env? :slight_smile: Will check on this!

1 Like