From b6befabef27a6098a55be292c0f935c38b576ffd Mon Sep 17 00:00:00 2001 From: haocat Date: Sun, 3 May 2026 19:37:08 +0800 Subject: [PATCH 1/3] =?UTF-8?q?fix=20=E8=BF=9C=E7=A8=8B=E5=90=AF=E5=8A=A8?= =?UTF-8?q?=E5=92=8C=E5=AF=BB=E8=BD=A6=E7=9A=84=E8=AF=B7=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- custom_components/wuling/__init__.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/custom_components/wuling/__init__.py b/custom_components/wuling/__init__.py index 2641f5b..231c8b1 100644 --- a/custom_components/wuling/__init__.py +++ b/custom_components/wuling/__init__.py @@ -415,21 +415,21 @@ async def _async_update_data(self): return self.data async def async_auth_start(self): - result = await self.async_request('car/control/ignition/authorize', data={ + result = await self.async_request('car/control/ignition/authorize', json={ 'vin': self.vin, }) data = result.get('data') or {} return data async def async_search_car(self): - result = await self.async_request('car/control/searchCar', data={ + result = await self.async_request('car/control/searchCar', json={ 'vin': self.vin, }) data = result.get('data') or {} return data async def async_control_window(self, status=0): - result = await self.async_request('car/control/window', data={ + result = await self.async_request('car/control/window', json={ 'vin': self.vin, 'status': status, }) @@ -496,7 +496,19 @@ async def async_request(self, api: str, **kwargs): except (TypeError, ValueError) as exc: _LOGGER.error('Response from %s error: %s', api, [exc, text]) return {} - _LOGGER.debug('Request %s result: %s', api, [result, kwargs]) + # Temporary debug: log API response (avoid logging sensitive headers) + try: + safe_kwargs = dict(kwargs) + if 'headers' in safe_kwargs and isinstance(safe_kwargs['headers'], dict): + safe_headers = safe_kwargs['headers'].copy() + for k in ('sgmwclientsecret', 'sgmwaccesstoken', 'accessToken', 'Authorization'): + if k in safe_headers: + safe_headers[k] = '***REDACTED***' + safe_kwargs['headers'] = safe_headers + except Exception: + safe_kwargs = {'headers': '***error_building_safe_kwargs***'} + _LOGGER.debug('Request %s result: %s', api, result) + _LOGGER.debug('Request %s kwargs (safe): %s', api, safe_kwargs) return result def get_sign(self, timestamp, nonce): From f8ac3fb0322ecdf25b279c1e1841f213c5411681 Mon Sep 17 00:00:00 2001 From: haocat Date: Sun, 3 May 2026 19:46:23 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E5=90=AF=E5=8A=A8=E5=92=8C=E5=AF=BB=E8=BD=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- custom_components/wuling/__init__.py | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/custom_components/wuling/__init__.py b/custom_components/wuling/__init__.py index 231c8b1..8ce73e9 100644 --- a/custom_components/wuling/__init__.py +++ b/custom_components/wuling/__init__.py @@ -496,19 +496,8 @@ async def async_request(self, api: str, **kwargs): except (TypeError, ValueError) as exc: _LOGGER.error('Response from %s error: %s', api, [exc, text]) return {} - # Temporary debug: log API response (avoid logging sensitive headers) - try: - safe_kwargs = dict(kwargs) - if 'headers' in safe_kwargs and isinstance(safe_kwargs['headers'], dict): - safe_headers = safe_kwargs['headers'].copy() - for k in ('sgmwclientsecret', 'sgmwaccesstoken', 'accessToken', 'Authorization'): - if k in safe_headers: - safe_headers[k] = '***REDACTED***' - safe_kwargs['headers'] = safe_headers - except Exception: - safe_kwargs = {'headers': '***error_building_safe_kwargs***'} + _LOGGER.debug('Request %s result: %s', api, [result, kwargs]) _LOGGER.debug('Request %s result: %s', api, result) - _LOGGER.debug('Request %s kwargs (safe): %s', api, safe_kwargs) return result def get_sign(self, timestamp, nonce): From edd2c595d1c21c87e089fe754495a166ada5dff6 Mon Sep 17 00:00:00 2001 From: haocat Date: Sun, 3 May 2026 19:48:37 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E7=BB=B4=E6=8A=A4=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E5=90=AF=E5=8A=A8=E5=92=8C=E5=AF=BB=E8=BD=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- custom_components/wuling/__init__.py | 1 - 1 file changed, 1 deletion(-) diff --git a/custom_components/wuling/__init__.py b/custom_components/wuling/__init__.py index 8ce73e9..7b7d24d 100644 --- a/custom_components/wuling/__init__.py +++ b/custom_components/wuling/__init__.py @@ -497,7 +497,6 @@ async def async_request(self, api: str, **kwargs): _LOGGER.error('Response from %s error: %s', api, [exc, text]) return {} _LOGGER.debug('Request %s result: %s', api, [result, kwargs]) - _LOGGER.debug('Request %s result: %s', api, result) return result def get_sign(self, timestamp, nonce):