jasper-seinhorst / homebridge-porsche-taycan

Homebridge plugin for owners of a Porsche Taycan or Macan EV. See current charge state and Battery level in the Apple Home app
Apache License 2.0
13 stars 0 forks source link

Error message "Porsche Connect connection failed" and plugin does not work until restart #2

Closed hirschaj closed 9 months ago

hirschaj commented 1 year ago

Describe The Bug:

I randomly get the error message "Porsche Connect connection failed". When this happens, the plugin stops working until it gets restarted manually. I get this failure basically every single day so I have a daily cron job set to run in the middle of the night to try and kickstart this plugin.

To Reproduce:

Nothing special but I do also have the electric sidecar app running on my phone which probably hits the same API. There might be a rate limiting issue due to MyPorsche, Electric Sidecar, and this plugin all trying to use the same API (guessing at what the problem might be).

Expected behavior:

Would love to have a graceful recovery where this app tries to connect again after an appropriate timeout period (maybe 5-10 minutes).

Logs:

[20/11/2023, 04:00:36] Homebridge v1.7.0 (HAP v0.11.1) (Homebridge B4CB) is running on port 51889.
[20/11/2023, 04:00:38] [homebridge-porsche-taycan] Launched child bridge with PID 18661
[20/11/2023, 04:00:38] [Hubitat-v2] Launched child bridge with PID 18660
[20/11/2023, 04:00:39] Registering platform 'homebridge-hubitat-tonesto7.Hubitat-v2'
[20/11/2023, 04:00:39] [Hubitat-v2] Loaded homebridge-hubitat-tonesto7 v2.9.4 child bridge successfully
[20/11/2023, 04:00:39] Loaded 3 cached accessories from cachedAccessories.0E3AF68A4B39.
[20/11/2023, 04:00:39] Registering platform 'homebridge-porsche-taycan.PorscheTaycan'
[20/11/2023, 04:00:39] [homebridge-porsche-taycan] Loaded homebridge-porsche-taycan v0.14.0 child bridge successfully
[20/11/2023, 04:00:39] Loaded 3 cached accessories from cachedAccessories.0EE180F26898.
DEPRECATED user supplied a custom 'mdns' option. This option is deprecated and ignored. Please move to the new 'bind' option.
[20/11/2023, 04:00:39] [homebridge-porsche-taycan] Authentication
[20/11/2023, 04:00:39] [homebridge-porsche-taycan] Retrieving available vehicles
[20/11/2023, 04:00:40] Homebridge v1.7.0 (HAP v0.11.1) (homebridge-porsche-taycan) is running on port 57646.
[20/11/2023, 04:00:40] [Hubitat-v2] Homebridge Version: 2.7
[20/11/2023, 04:00:40] [Hubitat-v2] Plugin Version: 2.9.4
[20/11/2023, 04:00:40] [Hubitat-v2] Checking Package Version for Updates...
[20/11/2023, 04:00:40] [Hubitat-v2] Adaptive Lighting Supported... Assigning Adaptive Lighting Controller to [Office Lights]!!!
DEPRECATED user supplied a custom 'mdns' option. This option is deprecated and ignored. Please move to the new 'bind' option.
[20/11/2023, 04:00:41] [Hubitat-v2] Fetching Hubitat-v2 Devices. NOTICE: This may take a moment if you have a large number of devices being loaded!
[20/11/2023, 04:00:41] [Hubitat-v2] Refreshing All Device Data | Source: (First Launch)
[20/11/2023, 04:00:41] Homebridge v1.7.0 (HAP v0.11.1) (Hubitat-v2) is running on port 59026.
[20/11/2023, 04:00:41] [Hubitat-v2] Temperature Unit is Now: (F)
[20/11/2023, 04:00:41] [Hubitat-v2] Updating Global Values | HubIP: 192.168.68.155 | UsingCloud: false
[20/11/2023, 04:00:41] [Hubitat-v2] Devices to Remove: (0) 
[20/11/2023, 04:00:41] [Hubitat-v2] Devices to Update: (3)
[20/11/2023, 04:00:41] [Hubitat-v2] Devices to Create: (0) 
[20/11/2023, 04:00:41] [Hubitat-v2] Total Initialization Time: (1 seconds)
[20/11/2023, 04:00:41] [Hubitat-v2] Unknown Capabilities: []
[20/11/2023, 04:00:41] [Hubitat-v2] Hubitat DeviceCache Size: (3)
[20/11/2023, 04:00:41] [Hubitat-v2] WebServer Initiated...
[20/11/2023, 04:00:41] [Hubitat-v2] Sending StartDirect Request to Hubitat | UsingCloud: (false)
[20/11/2023, 04:00:41] [Hubitat-v2] Direct Connect Active | Listening at 192.168.68.141:8000
[20/11/2023, 04:00:42] [homebridge-porsche-taycan] Porsche Connect connection failed
[20/11/2023, 04:00:42] [Hubitat-v2] Hubitat-v2 Hub Communication Established
[20/11/2023, 04:00:44] [Hubitat-v2] INFO: Your plugin version is up-to-date
[20/11/2023, 04:00:44] [Hubitat-v2] Sending Plugin Status to Hubitat | UpdateAvailable: false | newVersion: 2.9.4
[20/11/2023, 05:00:41] [Hubitat-v2] Refreshing All Device Data
[20/11/2023, 05:00:41] [Hubitat-v2] Temperature Unit is Now: (F)
[20/11/2023, 05:00:41] [Hubitat-v2] Updating Global Values | HubIP: 192.168.68.155 | UsingCloud: false
[20/11/2023, 05:00:41] [Hubitat-v2] Devices to Remove: (0) 
[20/11/2023, 05:00:41] [Hubitat-v2] Devices to Update: (3)
[20/11/2023, 05:00:41] [Hubitat-v2] Devices to Create: (0) 
[20/11/2023, 05:00:41] [Hubitat-v2] Total Initialization Time: (0 seconds)
[20/11/2023, 05:00:41] [Hubitat-v2] Unknown Capabilities: []
[20/11/2023, 05:00:41] [Hubitat-v2] Hubitat DeviceCache Size: (3)
[20/11/2023, 05:00:41] [Hubitat-v2] Checking Package Version for Updates...
[20/11/2023, 05:00:44] [Hubitat-v2] INFO: Your plugin version is up-to-date
[20/11/2023, 05:00:44] [Hubitat-v2] Sending Plugin Status to Hubitat | UpdateAvailable: false | newVersion: 2.9.4
[20/11/2023, 06:00:41] [Hubitat-v2] Refreshing All Device Data
[20/11/2023, 06:00:41] [Hubitat-v2] Temperature Unit is Now: (F)
[20/11/2023, 06:00:41] [Hubitat-v2] Updating Global Values | HubIP: 192.168.68.155 | UsingCloud: false
[20/11/2023, 06:00:41] [Hubitat-v2] Devices to Remove: (0) 
[20/11/2023, 06:00:41] [Hubitat-v2] Devices to Update: (3)
[20/11/2023, 06:00:41] [Hubitat-v2] Devices to Create: (0) 
[20/11/2023, 06:00:41] [Hubitat-v2] Total Initialization Time: (0 seconds)
[20/11/2023, 06:00:41] [Hubitat-v2] Unknown Capabilities: []
[20/11/2023, 06:00:41] [Hubitat-v2] Hubitat DeviceCache Size: (3)
[20/11/2023, 06:00:41] [Hubitat-v2] Checking Package Version for Updates...
[20/11/2023, 06:00:45] [Hubitat-v2] INFO: Your plugin version is up-to-date
[20/11/2023, 06:00:45] [Hubitat-v2] Sending Plugin Status to Hubitat | UpdateAvailable: false | newVersion: 2.9.4

Plugin Config:

{
    "mdns": {
        "interface": "XXXXXXXXXXXX"
    },
    "bridge": {
        "name": "XXXXXXXXXXXX",
        "username": "XXXXXXXXXXXX",
        "port": 51889,
        "pin": "XXXXXXXXXXXX"
    },
    "accessories": [],
    "platforms": [
        {
            "name": "Hubitat-v2",
            "app_url_local": "XXXXXXXXXXXX",
            "app_url_cloud": "XXXXXXXXXXXX",
            "use_cloud": false,
            "app_id": 1213,
            "access_token": "XXXXXXXXXXXX",
            "direct_port": 8000,
            "polling_seconds": 3600,
            "temperature_unit": "F",
            "round_levels": true,
            "adaptive_lighting": true,
            "adaptive_lighting_offset": 0,
            "consider_fan_by_name": true,
            "consider_light_by_name": true,
            "validateTokenId": false,
            "logConfig": {
                "debug": false,
                "showChanges": true
            },
            "platform": "Hubitat-v2",
            "_bridge": {
                "username": "XXXXXXXXXXXX",
                "port": 59026
            }
        },
        {
            "name": "Config",
            "port": 8581,
            "auth": "form",
            "theme": "auto",
            "tempUnits": "f",
            "lang": "auto",
            "platform": "config"
        },
        {
            "username": "XXXXXXXXXXXX",
            "password": "XXXXXXXXXXXX",
            "pollInterval": 15,
            "chargerDevice": "contact",
            "batteryDevice": true,
            "lowBattery": 30,
            "platform": "PorscheTaycan",
            "_bridge": {
                "username": "XXXXXXXXXXXX",
                "port": 57646
            }
        }
    ]
}

Screenshots:

Environment:

bigkraig commented 12 months ago

looks like the underlying api client needs some updates. i have this problem but not with the python client, they had an authentication fix in october. https://github.com/CJNE/pyporscheconnectapi/pull/35

hirschaj commented 12 months ago

Authentication continuously fails for me now. Unfortunately this renders this plugin unusable until an update happens to fix the authentication mechanism.

bigkraig commented 11 months ago

https://github.com/martijndierckx/node-porsche-connect/pull/3

jasper-seinhorst commented 10 months ago

@hirschaj I'm working on a fix. Authentication works for me (locally with code changes), but I can't get Emobility info yet from the new API. I will update the package when things are solved

jasper-seinhorst commented 9 months ago

@bigkraig can you re-test? I;ve updated the plugin to the latest version of porsche-connect package. For me it is not working, but want to double check if it is working for you?

hirschaj commented 9 months ago

@jasper-seinhorst - The update appears to have fixed the issue. The plugin has authenticated, is collecting data, and appears to be stable. Thank you so much for getting it fixed!

jasper-seinhorst commented 9 months ago

Super weird, it is not working for me unfortunately. Getting 400 errors myself! Glad it works for you. Will leave this issue open until issues are solved at my end too. Thanks for reporting the issue 👍

jasper-seinhorst commented 9 months ago

@hirschaj I was too fast with my comment. It works right now, must have been an API outage or something like that. Im closing the issue.