From 7d6c3dcf71b7e9844e43d01d79bdcb615b26e3e1 Mon Sep 17 00:00:00 2001 From: Feng Wang Date: Thu, 19 Dec 2024 23:41:42 +0800 Subject: [PATCH] fix missing await --- custom_components/xiaomi_home/miot/miot_cloud.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/custom_components/xiaomi_home/miot/miot_cloud.py b/custom_components/xiaomi_home/miot/miot_cloud.py index cb548c47..dd4c2822 100644 --- a/custom_components/xiaomi_home/miot/miot_cloud.py +++ b/custom_components/xiaomi_home/miot/miot_cloud.py @@ -314,11 +314,9 @@ async def __mihome_api_post_async( self, url_path: str, data: dict, timeout: int = MIHOME_HTTP_API_TIMEOUT ) -> dict: - form_data = aiohttp.FormData() - form_data.add_field('data', json.dumps(data)) http_res = await self._session.post( url=f'{self._base_url}{url_path}', - data=form_data, + json=data, headers=self.__api_request_headers, timeout=timeout) if http_res.status == 401: @@ -365,7 +363,7 @@ async def get_central_cert_async(self, csr: str) -> Optional[str]: if not isinstance(csr, str): raise MIoTHttpError('invalid params') - res_obj: dict = self.__mihome_api_post_async( + res_obj: dict = await self.__mihome_api_post_async( url_path='/app/v2/ha/oauth/get_central_crt', data={ 'csr': str(base64.b64encode(csr.encode('utf-8')), 'utf-8')