bimmerconnected / bimmer_connected

🚘 Library to query the status of your BMW or Mini from the ConnectedDrive portal
Apache License 2.0
362 stars 79 forks source link

The location of the car in China still shifts after upgrading to 0.8.6 version #379

Closed muxiachuixue closed 2 years ago

muxiachuixue commented 2 years ago

Describe the issue

After upgrading the BMW Connected Drive BETA in HA to 0.8.6 version and restart the HA, the location of the car still shifts in HA's map and device tracker. I am pretty sure the component is on the latest. After updating the car status in HA, I double checked the latitude and longitude properties of 'device_tracker.xxx'. The values are the same as the original data which I got from the shortcuts. So maybe the conversion of GCJ02 to WGS84 does not take effect?

Expected behavior

Fix the conversion of GCJ02 to WGS84.

Which Home Assistant version are you using?

core-2021.11.5

What was the last working version of Home Assistant Core?

No response

What is your region?

China

ConnectedDrive website

Number of cars

Output of bimmer_connected fingerprint

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

rikroe commented 2 years ago

Could you please double check custom component version (should be 20211207.1) and bimmer_connected version? If you update bimmer_connected manually and then started an older version of the custom component, the older version will be downloaded again when HA is starting.

Other than that I'm quite at a loss as the test (L171-L193) was passing and did convert (116.23221, 39.83492) to (116.22617, 39.83247).

muxiachuixue commented 2 years ago

Could you please double check custom component version (should be 20211207.1) and bimmer_connected version? If you update bimmer_connected manually and then started an older version of the custom component, the older version will be downloaded again when HA is starting.

Other than that I'm quite at a loss as the test (L171-L193) was passing and did convert (116.23221, 39.83492) to (116.22617, 39.83247).

The content of the manifest.json:

pi@raspberrypi:/usr/share/hassio/homeassistant/custom_components/bmw_connected_drive $ cat manifest.json 
{
  "domain": "bmw_connected_drive",
  "name": "BMW Connected Drive",
  "version": "20211207.1",
  "documentation": "https://www.home-assistant.io/integrations/bmw_connected_drive",
  "requirements": ["bimmer_connected==0.8.6"],
  "codeowners": ["@gerard33", "@rikroe"],
  "config_flow": true,
  "iot_class": "cloud_polling"
}

And the version of bimmerconnected:

pi@raspberrypi:~ $ pip3 install --upgrade bimmer-connected
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already up-to-date: bimmer-connected in ./.local/lib/python3.7/site-packages (0.8.6)
Requirement already satisfied, skipping upgrade: pyjwt>=2.1.0 in ./.local/lib/python3.7/site-packages (from bimmer-connected) (2.3.0)
Requirement already satisfied, skipping upgrade: pycryptodome>=3.4 in ./.local/lib/python3.7/site-packages (from bimmer-connected) (3.11.0)
Requirement already satisfied, skipping upgrade: requests>=2.24.0 in ./.local/lib/python3.7/site-packages (from bimmer-connected) (2.25.1)
Requirement already satisfied, skipping upgrade: chardet<5,>=3.0.2 in /usr/lib/python3/dist-packages (from requests>=2.24.0->bimmer-connected) (3.0.4)
Requirement already satisfied, skipping upgrade: idna<3,>=2.5 in /usr/lib/python3/dist-packages (from requests>=2.24.0->bimmer-connected) (2.6)
Requirement already satisfied, skipping upgrade: urllib3<1.27,>=1.21.1 in /usr/lib/python3/dist-packages (from requests>=2.24.0->bimmer-connected) (1.24.1)
Requirement already satisfied, skipping upgrade: certifi>=2017.4.17 in /usr/lib/python3/dist-packages (from requests>=2.24.0->bimmer-connected) (2018.8.24)

So both bimmerconnected and HA custom component are on the latest.

When I executed bimmerconnected status [my_phone_number] [my_password] china, I got the following results:

...
            "vehicleLocation": {
                "coordinates": {
                    "latitude": 31.123455,
                    "longitude": 121.123422
                },
...
      "gps_position": [
            31.123455,
            121.123422
        ],
...

It seems that the original coordinates are the same as the gps_position you generated. And also the properties of 'device_tracker.xxx':

source_type: gps
latitude: 31.123455
longitude: 121.123422
gps_accuracy: 0
car: xxx
vin: LBVXXXXXXXXX
friendly_name: xxx
icon: mdi:car
attribution: Data provided by BMW Connected Drive
rikroe commented 2 years ago

Didn't realize that the Python library and the tool you mentioned in #377 use (longitude, latitude) instead of (latitude, longitude)...

github-actions[bot] commented 2 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.