Andre0512 / pyhOn

Control hOn devices with python
MIT License
470 stars 1.76k forks source link

Error setting up entry to email@xxx.com for hon #3

Closed slegars56 closed 1 year ago

slegars56 commented 1 year ago

Hi,

When testing your integration I get the following error at the first connection:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 383, in async_setup result = await component.async_setup_entry(hass, self) File "/config/custom_components/hon/init.py", line 32, in async_setup_entry await hon.setup() File "/usr/local/lib/python3.10/site-packages/pyhon/api.py", line 57, in setup device = HonDevice(self, appliance) File "/usr/local/lib/python3.10/site-packages/pyhon/device.py", line 8, in init appliance["attributes"] = {v["parName"]: v["parValue"] for v in appliance["attributes"]} KeyError: 'attributes'

Tested on 0.2.1

Andre0512 commented 1 year ago

Hi, thanks for reporting. Should be fixed in v0.2.2 :slightly_smiling_face:

slegars56 commented 1 year ago

Hi,

Thank you for the quick action. I now getting the error below. I see it's related to pyHon, I can create a dedicated Issue on the right repo if you want.

I guess it's related to the Virtual Wine Cellar Appliance (see json at the bottom):

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 383, in async_setup result = await component.async_setup_entry(hass, self) File "/config/custom_components/hon/init.py", line 32, in async_setup_entry await hon.setup() File "/usr/local/lib/python3.10/site-packages/pyhon/api.py", line 58, in setup await asyncio.gather([ File "/usr/local/lib/python3.10/site-packages/pyhon/device.py", line 135, in load_attributes self._attributes = await self._connector.load_attributes(self) File "/usr/local/lib/python3.10/site-packages/pyhon/api.py", line 102, in load_attributes async with self._session.get(url, params=params, headers=await self._headers) as response: File "/usr/local/lib/python3.10/site-packages/aiohttp/client.py", line 1141, in aenter self._resp = await self._coro File "/usr/local/lib/python3.10/site-packages/aiohttp/client.py", line 508, in _request req = self._request_class( File "/usr/local/lib/python3.10/site-packages/aiohttp/client_reqrep.py", line 283, in init url2 = url.with_query(params) File "/usr/local/lib/python3.10/site-packages/yarl/_url.py", line 977, in with_query new_query = self._get_str_query(args, **kwargs) File "/usr/local/lib/python3.10/site-packages/yarl/_url.py", line 938, in _get_str_query query = "&".join(self._query_seq_pairs(quoter, query.items())) File "/usr/local/lib/python3.10/site-packages/yarl/_url.py", line 901, in _query_seq_pairs yield quoter(key) + "=" + quoter(cls._query_var(val)) File "/usr/local/lib/python3.10/site-packages/yarl/_url.py", line 916, in _query_var raise TypeError( TypeError: Invalid variable type: value should be str, int or float, got None of type <class 'NoneType'>

json returned by the Wine Cellar Appliance: { 'completeMyTasteProfile': 0, 'enrollmentDate': '2022-XX-XXT21: 08: 53.150Z', 'applianceTypeId': 6, 'brand': 'hOn', 'zone': '1', 'series': 'virtualWineCellar', 'applianceCapacity': '41', 'firstEnrollmentTBC': False, 'code': '34004778', 'applianceStatus': 1, 'SK': 'app#xxxxxxxxxxx'', 'PK': 'user#eu-west-1:xxxxxxxxxxxxxxxxxxxxx', 'applianceId': '34004778xxxxxxxx'#2022-08-09T21: 08: 53.150Z', 'id': 403, 'modelName': 'VWC 20', 'applianceTypeName': 'WC', 'connectivity': 'none', 'serialNumber': 'xxxxxxxxxxx', 'sections': {'chatbot': True, 'double_pairing_hidden': False, 'epp_enabled': False}, 'topics': {'publish': [], 'subscribe': ['$aws/events/presence/disconnected/34004778xxxxxxxx', '$aws/events/presence/connected/34004778xxxxxxxx', 'haier/things/34004778xxxxxxxx/event/appliancestatus/update', 'haier/things/34004778xxxxxxxx/event/discovery/update' ]} }

Andre0512 commented 1 year ago

Hi, I moved your issue to the right repo. The wine color was a good hint, when added it I had the same issue. I think we can ignore virtual appliances for now. I fixed it and created a new release.