CJNE / ha-porscheconnect

Porsche Connect custom component for Home Assistant
MIT License
29 stars 12 forks source link

Integration got stuck in privacy mode #145

Closed fredriklj closed 1 year ago

fredriklj commented 1 year ago

Version of the custom_component

version 0.0.11 (latest)

Configuration

n/a

Describe the bug

The integration got stuck in privacy mode, although the vehicle had (and always have had) the privacy mode disabled. I had to comment out the code at row 160-162 in init.py in order to get updates again. Have not had the time to investigate further at this point, but it seems to me as if the API reports the vehicle to be in privacy mode, although it clearly isn't.

Controls are working and I get position from the vehicle, while the binary_sensor still indicates 'on' (after commenting out the lines mentioned).

Debug log


2023-01-14 12:52:51.425 DEBUG (MainThread) [custom_components.porscheconnect] Vehicle xxx is in privacy mode, will not fetch data
2023-01-14 12:52:51.425 DEBUG (MainThread) [custom_components.porscheconnect] {'privacyMode': True, 'services':...
fredriklj commented 1 year ago

Ok, I have investigated a bit further. I noted after issuing the "summary" command, that Apple Music and Apple Podcast was disabled and the reason given was 'PRIVACY_MODE'. Indeed, I had disabled these services in the car, as it was constantly nagging me with messages to configure these services (which I'm not interested in).

So I tried re-enabling them, and sure enough, 'privacyMode' flipped to False.

This makes me think that this flag is not reliable in determining wether the car is actually in privacy mode or not. Actually setting privacy mode results in all services listed in 'vehicleServiceEnabledMap' (except "CC") turning "DISABLED".

My suggestion for detecting privacy mode would be to test wether VSR in 'vehicleServiceEnabledMap' is "ENABLED" or "DISABLED". I believe that VSR stands for "Vehicle Status Report", and if this is disabled there should be no updates available.

CJNE commented 1 year ago

Thanks @fredriklj ! I was not sure which one to choose when I did the implementation, thanks for doing the research, your suggestion sounds like it would work. The change will be done in the python library.