FilipDem / Domoticz-BMW-plugin

Domoticz plugin working with BMW Connected Drive
4 stars 2 forks source link

After bimmer_connected update unable to login #15

Open TheLion opened 11 months ago

TheLion commented 11 months ago

Hi,

I noticed some time ago my BMW Domoticz plugin reported a login error.

Also running bimmer_connected with the status command, resulted in an error.

I updated bimmer_connected and now bimmer_connected doesn't report an error any more and my vehicle information is displayed.

But my Domoticz plugin still reports an error. See debug log below:

2023-08-15 19:20:18.315 Status: BMW: Entering work loop.
2023-08-15 19:20:18.315 Status: BMW: Started.
2023-08-15 19:20:19.825 BMW: Parameter Name: BMW
2023-08-15 19:20:19.825 BMW: Parameter Port: 0
2023-08-15 19:20:19.825 BMW: Parameter Key: Bmw
2023-08-15 19:20:19.825 BMW: Parameter Mode1: rest_of_world
2023-08-15 19:20:19.825 BMW: Parameter Mode2: martijn@email.com
2023-08-15 19:20:19.825 BMW: Parameter Mode3: password
2023-08-15 19:20:19.825 BMW: Parameter Mode4: WBA6K51050FJ00914
2023-08-15 19:20:19.825 BMW: Parameter Mode5: 10
2023-08-15 19:20:19.825 BMW: Parameter Mode6: Debug
2023-08-15 19:20:19.825 BMW: Parameter DomoticzVersion: 2023.2
2023-08-15 19:20:19.825 BMW: Parameter DomoticzHash: 19efd039c
2023-08-15 19:20:19.825 BMW: Parameter DomoticzBuildTime: 2023-07-21 17:23:44
2023-08-15 19:20:19.825 BMW: Got 13 devices:
2023-08-15 19:20:19.825 BMW: Device 1 ID: 1077, Name: 'BMW - Mileage', nValue: 38501, sValue: '38501'
2023-08-15 19:20:19.825 BMW: Device 1 DeviceID: 001D0001
2023-08-15 19:20:19.826 BMW: Device 1 Description:
2023-08-15 19:20:19.826 BMW: Device 1 LastLevel: 0
2023-08-15 19:20:19.826 BMW: Device 2 ID: 1080, Name: 'BMW - Doors', nValue: 0, sValue: '0'
2023-08-15 19:20:19.826 BMW: Device 2 DeviceID: 001D0002
2023-08-15 19:20:19.826 BMW: Device 2 Description:
2023-08-15 19:20:19.826 BMW: Device 2 LastLevel: 0
2023-08-15 19:20:19.826 BMW: Device 3 ID: 1081, Name: 'BMW - Windows', nValue: 0, sValue: '0'
2023-08-15 19:20:19.826 BMW: Device 3 DeviceID: 001D0003
2023-08-15 19:20:19.826 BMW: Device 3 Description:
2023-08-15 19:20:19.826 BMW: Device 3 LastLevel: 0
2023-08-15 19:20:19.826 BMW: Device 4 ID: 1082, Name: 'BMW - Actieradius', nValue: 161, sValue: '161'
2023-08-15 19:20:19.826 BMW: Device 4 DeviceID: 001D0004
2023-08-15 19:20:19.826 BMW: Device 4 Description:
2023-08-15 19:20:19.826 BMW: Device 4 LastLevel: 0
2023-08-15 19:20:19.826 BMW: Device 5 ID: 1083, Name: 'BMW - Remain mileage (elec)', nValue: 0, sValue: ''
2023-08-15 19:20:19.826 BMW: Device 5 DeviceID: 001D0005
2023-08-15 19:20:19.826 BMW: Device 5 Description:
2023-08-15 19:20:19.826 BMW: Device 5 LastLevel: 0
2023-08-15 19:20:19.826 BMW: Device 6 ID: 1084, Name: 'BMW - Charging', nValue: 0, sValue: ''
2023-08-15 19:20:19.826 BMW: Device 6 DeviceID: 001D0006
2023-08-15 19:20:19.826 BMW: Device 6 Description:
2023-08-15 19:20:19.827 BMW: Device 6 LastLevel: 0
2023-08-15 19:20:19.827 BMW: Device 7 ID: 1085, Name: 'BMW - Charging time', nValue: 0, sValue: ''
2023-08-15 19:20:19.827 BMW: Device 7 DeviceID: 001D0007
2023-08-15 19:20:19.827 BMW: Device 7 Description:
2023-08-15 19:20:19.827 BMW: Device 7 LastLevel: 0
2023-08-15 19:20:19.827 BMW: Device 8 ID: 1086, Name: 'BMW - Battery Level', nValue: 0, sValue: ''
2023-08-15 19:20:19.827 BMW: Device 8 DeviceID: 001D0008
2023-08-15 19:20:19.827 BMW: Device 8 Description:
2023-08-15 19:20:19.827 BMW: Device 8 LastLevel: 0
2023-08-15 19:20:19.827 BMW: Device 9 ID: 1079, Name: 'BMW - Remote Services', nValue: 2, sValue: '0'
2023-08-15 19:20:19.827 BMW: Device 9 DeviceID: 001D0009
2023-08-15 19:20:19.827 BMW: Device 9 Description:
2023-08-15 19:20:19.827 BMW: Device 9 LastLevel: 0
2023-08-15 19:20:19.827 BMW: Device 10 ID: 1087, Name: 'BMW - Car', nValue: 0, sValue: '0'
2023-08-15 19:20:19.827 BMW: Device 10 DeviceID: 001D000A
2023-08-15 19:20:19.827 BMW: Device 10 Description:
2023-08-15 19:20:19.827 BMW: Device 10 LastLevel: 0
2023-08-15 19:20:19.827 BMW: Device 11 ID: 1078, Name: 'BMW - Mileage (Day)', nValue: 0, sValue: '38501'
2023-08-15 19:20:19.827 BMW: Device 11 DeviceID: 001D000B
2023-08-15 19:20:19.827 BMW: Device 11 Description:
2023-08-15 19:20:19.827 BMW: Device 11 LastLevel: 0
2023-08-15 19:20:19.827 BMW: Device 12 ID: 1088, Name: 'BMW - Driving', nValue: 0, sValue: '0'
2023-08-15 19:20:19.827 BMW: Device 12 DeviceID: 001D000C
2023-08-15 19:20:19.827 BMW: Device 12 Description:
2023-08-15 19:20:19.827 BMW: Device 12 LastLevel: 1
2023-08-15 19:20:19.827 BMW: Device 13 ID: 1089, Name: 'BMW - Home', nValue: 0, sValue: '0'
2023-08-15 19:20:19.828 BMW: Device 13 DeviceID: 001D000D
2023-08-15 19:20:19.828 BMW: Device 13 Description:
2023-08-15 19:20:19.828 BMW: Device 13 LastLevel: 1
2023-08-15 19:20:19.828 BMW: Looking for configuration file /home/pi/domoticz/plugins/Domoticz-BMW-plugin/Bmw.json
2023-08-15 19:20:19.828 BMW: Update BMW - Mileage: nValue 38501 - sValue 38501 - Other: {'TimedOut': 1}
2023-08-15 19:20:19.828 (BMW - Mileage) Updating device from 38501:'38501' to have values 38501:'38501'.
2023-08-15 19:20:19.840 BMW: Update BMW - Doors: nValue 0 - sValue 0 - Other: {'TimedOut': 1}
2023-08-15 19:20:19.840 (BMW - Doors) Updating device from 0:'0' to have values 0:'0'.
2023-08-15 19:20:19.851 BMW: Update BMW - Windows: nValue 0 - sValue 0 - Other: {'TimedOut': 1}
2023-08-15 19:20:19.851 (BMW - Windows) Updating device from 0:'0' to have values 0:'0'.
2023-08-15 19:20:19.861 BMW: Update BMW - Actieradius: nValue 161 - sValue 161 - Other: {'TimedOut': 1}
2023-08-15 19:20:19.861 (BMW - Actieradius) Updating device from 161:'161' to have values 161:'161'.
2023-08-15 19:20:19.871 BMW: Update BMW - Remain mileage (elec): nValue 0 - sValue - Other: {'TimedOut': 1}
2023-08-15 19:20:19.872 (BMW - Remain mileage (elec)) Updating device from 0:'' to have values 0:''.
2023-08-15 19:20:19.879 BMW: Update BMW - Charging: nValue 0 - sValue - Other: {'TimedOut': 1}
2023-08-15 19:20:19.880 (BMW - Charging) Updating device from 0:'' to have values 0:''.
2023-08-15 19:20:19.900 BMW: Update BMW - Charging time: nValue 0 - sValue - Other: {'TimedOut': 1}
2023-08-15 19:20:19.900 (BMW - Charging time) Updating device from 0:'' to have values 0:''.
2023-08-15 19:20:19.920 BMW: Update BMW - Battery Level: nValue 0 - sValue - Other: {'TimedOut': 1}
2023-08-15 19:20:19.921 (BMW - Battery Level) Updating device from 0:'' to have values 0:''.
2023-08-15 19:20:19.930 BMW: Update BMW - Remote Services: nValue 2 - sValue 0 - Other: {'TimedOut': 1}
2023-08-15 19:20:19.930 (BMW - Remote Services) Updating device from 2:'0' to have values 2:'0'.
2023-08-15 19:20:19.944 BMW: Update BMW - Car: nValue 0 - sValue 0 - Other: {'TimedOut': 1}
2023-08-15 19:20:19.945 (BMW - Car) Updating device from 0:'0' to have values 0:'0'.
2023-08-15 19:20:19.955 BMW: Update BMW - Mileage (Day): nValue 0 - sValue 38501 - Other: {'TimedOut': 1}
2023-08-15 19:20:19.955 (BMW - Mileage (Day)) Updating device from 0:'38501' to have values 0:'38501'.
2023-08-15 19:20:19.971 BMW: Update BMW - Driving: nValue 0 - sValue 0 - Other: {'TimedOut': 1}
2023-08-15 19:20:19.971 (BMW - Driving) Updating device from 0:'0' to have values 0:'0'.
2023-08-15 19:20:19.988 BMW: Update BMW - Home: nValue 0 - sValue 0 - Other: {'TimedOut': 1}
2023-08-15 19:20:19.988 (BMW - Home) Updating device from 0:'0' to have values 0:'0'.
2023-08-15 19:20:19.819 Status: BMW: Initialized version 3.2.2, author 'Filip Demaertelaere'
2023-08-15 19:20:20.004 BMW: Entering tasks handler
2023-08-15 19:20:20.005 BMW: Acquiring GIL for 'onStartCallback'
2023-08-15 19:20:20.005 BMW: Handling task: Login.
2023-08-15 19:20:20.006 BMW: Login done! MyBMW object: MyBMWAccount(username='martijn@email.com', region=<Regions.REST_OF_WORLD: 'row'>, config=MyBMWClientConfiguration(authentication=<bimmer_connected.api.authentication.MyBMWAuthentication object at 0xa0b8f0b0>, log_response_path=None, observer_position=None, use_metric_units=True), vehicles=[])
2023-08-15 19:20:20.774 BMW: Login error: Client error '404 Resource Not Found' for url 'https://cocoapi.bmwgroup.com/eadrax-vcs/v2/vehicles'
2023-08-15 19:20:20.774 BMW: Finished handling task: Login.
2023-08-15 19:20:20.774 BMW: Handling task: StatusUpdate.
2023-08-15 19:20:20.774 BMW: Finished handling task: StatusUpdate.
2023-08-15 19:20:20.773 Error: BMW: Error login in MyBMW for user martijn@email.com and region rest_of_world.

I already updated my plugin folder to the latest content on Github and it already was up-to-date. Also restarting Domoticz and the complete RPi doesn't solve the issue.

Also changed my password to something that does not contain any (too) special characters, just minus sign as one special character is needed.

Any thought what can cause this and how to solve it?

sincze commented 11 months ago

What version of Bimmer_Connected are you running on your Domoticz machine where this plugin is installed ?

TheLion commented 11 months ago

According to pip it's version 0.13.10.

sincze commented 11 months ago

Python 3.8 or above also installed for that version??

Command; $ python3 -V

On Tue, 15 Aug 2023, 21:19 Martijn Janssen, @.***> wrote:

According to pip it's version 0.13.10.

— Reply to this email directly, view it on GitHub https://github.com/FilipDem/Domoticz-BMW-plugin/issues/15#issuecomment-1679468617, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABMCHTJLPLKDDBXTRFEX4WDXVPDULANCNFSM6AAAAAA3RLSFHI . You are receiving this because you commented.Message ID: @.***>

TheLion commented 11 months ago

Erhm. No. Running v3.7.3.

sincze commented 11 months ago

Ok, at least we know officially the pre-requirements are not fully met.

You could test with the CLI to see what the results are,

# run the fingerprint function
bimmerconnected fingerprint <username> <password> <region>

or

bimmerconnected status -j <username> <password> <region>

If still no results. Can you downgrade bimmer_connected to just the previous version ?

I had a feeling something was going to break so already created: https://github.com/bimmerconnected/bimmer_connected/discussions/558

TheLion commented 11 months ago

Ok, at least we know officially the pre-requirements are not fully met.

You could test with the CLI to see what the results are,

# run the fingerprint function
bimmerconnected fingerprint <username> <password> <region>

or

bimmerconnected status -j <username> <password> <region>

If still no results. Can you downgrade bimmer_connected to just the previous version ?

I had a feeling something was going to break so already created: bimmerconnected/bimmer_connected#558

Bimmerconnected itself works just fine after updating and outputs up-to-date information about my vehicle.

sincze commented 11 months ago

Ok so that is also checked. Then we need to debug the plugin as the basics still seem to work.

I noticed I think a 404 as well in your example . That is what triggered me as well. Need to look into that to see if the plugin connects to the right endpoints.

HTTP 404, 404 not found, 404, 404 error, page not found or file not found

On Wed, Aug 16, 2023 at 12:25 PM Martijn Janssen @.***> wrote:

Ok, at least we know officially the pre-requirements are not fully met.

You could test with the CLI to see what the results are,

run the fingerprint function

bimmerconnected fingerprint

or

bimmerconnected status -j

If still no results. Can you downgrade bimmer_connected to just the previous version ?

I had a feeling something was going to break so already created: bimmerconnected/bimmer_connected#558 https://github.com/bimmerconnected/bimmer_connected/discussions/558

Bimmerconnected itself works just fine after updating and outputs up-to-date information about my vehicle.

— Reply to this email directly, view it on GitHub https://github.com/FilipDem/Domoticz-BMW-plugin/issues/15#issuecomment-1680350143, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABMCHTOUPU2NQVGLDDUGRDLXVSNYPANCNFSM6AAAAAA3RLSFHI . You are receiving this because you commented.Message ID: @.***>

subtrEM commented 11 months ago

The 404 refers to https://cocoapi.bmwgroup.com/eadrax-vcs/v2/vehicles; bimmer_connected 0.13.10 itself seems to read from https://cocoapi.bmwgroup.com/eadrax-vcs/v4/vehicles. Different versions of Domoticz-BMW-plugin installed under different users (e.g. pi and root) maybe?

sincze commented 11 months ago

That indeed is a nice clue.

On Wed, Aug 16, 2023 at 3:10 PM subtrEM @.***> wrote:

The 404 refers to https://cocoapi.bmwgroup.com/eadrax-vcs/v2/vehicles; bimmer_connected itself reads from https://cocoapi.bmwgroup.com/eadrax-vcs/**v4**/vehicles. Different versions installed under different users (e.g. pi and root) maybe?

— Reply to this email directly, view it on GitHub https://github.com/FilipDem/Domoticz-BMW-plugin/issues/15#issuecomment-1680577686, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABMCHTOXQNFSUNBU3KFFY4DXVTBDVANCNFSM6AAAAAA3RLSFHI . You are receiving this because you commented.Message ID: @.***>

flenaers commented 10 months ago

Hi all, Had the same issue: login failed messages in Domoticz (build 15344) logs. Plugin version 3.2.2. I upgraded bimmer_connected, but may not have payed attention on successfull installation. Bimmer_connected gave car status on CLI. Domoticz kept failing, also after disable/enable of plugin, start/stop Domoticz and even reboot. So not sure which version of bimmer_connected I was testing.

Problem was solved by installing bimmer_connected as root (sudo). This may not the intended way of installing, and I still got some errors on the installation:

pi@lime:~/domoticz $ sudo pip3 install --upgrade bimmer_connected
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: bimmer_connected in /usr/local/lib/python3.7/dist-packages (0.10.1)
Collecting bimmer_connected
  Downloading https://www.piwheels.org/simple/bimmer-connected/bimmer_connected-0.13.10-py3-none-any.whl (110 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 110.1/110.1 kB 1.3 MB/s eta 0:00:00
Requirement already satisfied: httpx in /usr/local/lib/python3.7/dist-packages (from bimmer_connected) (0.23.0)
Requirement already satisfied: pyjwt>=2.1.0 in /usr/local/lib/python3.7/dist-packages (from bimmer_connected) (2.3.0)
Requirement already satisfied: pycryptodome>=3.4 in /usr/local/lib/python3.7/dist-packages (from bimmer_connected) (3.12.0)
Requirement already satisfied: rfc3986[idna2008]<2,>=1.3 in /usr/local/lib/python3.7/dist-packages (from httpx->bimmer_connected) (1.5.0)
Requirement already satisfied: certifi in /usr/lib/python3/dist-packages (from httpx->bimmer_connected) (2018.8.24)
Requirement already satisfied: httpcore<0.16.0,>=0.15.0 in /usr/local/lib/python3.7/dist-packages (from httpx->bimmer_connected) (0.15.0)
Requirement already satisfied: sniffio in /usr/local/lib/python3.7/dist-packages (from httpx->bimmer_connected) (1.2.0)
Requirement already satisfied: h11<0.13,>=0.11 in /usr/local/lib/python3.7/dist-packages (from httpcore<0.16.0,>=0.15.0->httpx->bimmer_connected) (0.12.0)
Requirement already satisfied: anyio==3.* in /usr/local/lib/python3.7/dist-packages (from httpcore<0.16.0,>=0.15.0->httpx->bimmer_connected) (3.6.1)
Requirement already satisfied: typing-extensions in /usr/local/lib/python3.7/dist-packages (from anyio==3.*->httpcore<0.16.0,>=0.15.0->httpx->bimmer_connected) (4.3.0)
Requirement already satisfied: idna>=2.8 in /usr/local/lib/python3.7/dist-packages (from anyio==3.*->httpcore<0.16.0,>=0.15.0->httpx->bimmer_connected) (3.3)
Installing collected packages: bimmer_connected
  Attempting uninstall: bimmer_connected
    Found existing installation: bimmer-connected 0.10.1
    Uninstalling bimmer-connected-0.10.1:
      Successfully uninstalled bimmer-connected-0.10.1
Successfully installed bimmer_connected-0.13.10
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
--- Logging error ---
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/pip/_internal/utils/logging.py", line 177, in emit
    self.console.print(renderable, overflow="ignore", crop=False, style=style)
  File "/usr/local/lib/python3.7/dist-packages/pip/_vendor/rich/console.py", line 1752, in print
    extend(render(renderable, render_options))
  File "/usr/local/lib/python3.7/dist-packages/pip/_vendor/rich/console.py", line 1390, in render
    for render_output in iter_render:
  File "/usr/local/lib/python3.7/dist-packages/pip/_internal/utils/logging.py", line 134, in __rich_console__
    for line in lines:
  File "/usr/local/lib/python3.7/dist-packages/pip/_vendor/rich/segment.py", line 245, in split_lines
    for segment in segments:
  File "/usr/local/lib/python3.7/dist-packages/pip/_vendor/rich/console.py", line 1368, in render
    renderable = rich_cast(renderable)
  File "/usr/local/lib/python3.7/dist-packages/pip/_vendor/rich/protocol.py", line 36, in rich_cast
    renderable = cast_method()
  File "/usr/local/lib/python3.7/dist-packages/pip/_internal/self_outdated_check.py", line 130, in __rich__
    pip_cmd = get_best_invocation_for_this_pip()
  File "/usr/local/lib/python3.7/dist-packages/pip/_internal/utils/entrypoints.py", line 60, in get_best_invocation_for_this_pip
    os.path.join(binary_prefix, exe_name),
  File "/usr/lib/python3.7/genericpath.py", line 97, in samefile
    s2 = os.stat(f2)
FileNotFoundError: [Errno 2] No such file or directory: '/usr/bin/pip'
Call stack:
  File "/usr/local/bin/pip3", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.7/dist-packages/pip/_internal/cli/main.py", line 70, in main
    return command.main(cmd_args)
  File "/usr/local/lib/python3.7/dist-packages/pip/_internal/cli/base_command.py", line 101, in main
    return self._main(args)
  File "/usr/local/lib/python3.7/dist-packages/pip/_internal/cli/base_command.py", line 223, in _main
    self.handle_pip_version_check(options)
  File "/usr/local/lib/python3.7/dist-packages/pip/_internal/cli/req_command.py", line 148, in handle_pip_version_check
    pip_self_version_check(session, options)
  File "/usr/local/lib/python3.7/dist-packages/pip/_internal/self_outdated_check.py", line 237, in pip_self_version_check
    logger.info("[present-rich] %s", upgrade_prompt)
  File "/usr/lib/python3.7/logging/__init__.py", line 1383, in info
    self._log(INFO, msg, args, **kwargs)
  File "/usr/lib/python3.7/logging/__init__.py", line 1519, in _log
    self.handle(record)
  File "/usr/lib/python3.7/logging/__init__.py", line 1529, in handle
    self.callHandlers(record)
  File "/usr/lib/python3.7/logging/__init__.py", line 1591, in callHandlers
    hdlr.handle(record)
  File "/usr/lib/python3.7/logging/__init__.py", line 905, in handle
    self.emit(record)
  File "/usr/local/lib/python3.7/dist-packages/pip/_internal/utils/logging.py", line 179, in emit
    self.handleError(record)
Message: '[present-rich] %s'
Arguments: (UpgradePrompt(old='22.1.2', new='23.2.1'),)

So an old version 0.10.1 was found and upgraded to 0.13.10 Even with these installation warnings/errors, bimmer_connected works and so does the plugin in Domoticz. After disable/enable of the BMW module, the login in Domoticz is succesfull again and data is collected. :-)

TheLion commented 8 months ago

For me it still doesn't work. Upgraded bimmer_connected to 0.14.2 with and without sudo and pulled the latest release of the plugin, but still same login error.