ollo69 / ha-smartthinq-sensors

HomeAssistant custom integration for SmartThinQ LG devices configurable with Lovelace User Interface.
Apache License 2.0
1.16k stars 159 forks source link

Extra data error logged on LG range #270

Closed cmause closed 2 years ago

cmause commented 2 years ago

HA is logging "extra data" errors attempting to get data on my LG range, model LSE4617ST. HA reports the existence of 5 entities, but they never update status. The error appears about every 30 seconds.

Unexpected error fetching smartthinq_sensors-Oven data: Extra data: line 1 column 2 (char 1) 4:39:46 PM – (ERROR) SmartThinQ LGE Sensors (custom integration) - message first occurred at January 13, 2022, 5:03:15 PM and shows up 2828 times

This error originated from a custom integration.

Logger: custom_components.smartthinq_sensors Source: custom_components/smartthinq_sensors/wideq/device.py:737 Integration: SmartThinQ LGE Sensors (documentation, issues) First occurred: January 13, 2022, 5:03:15 PM (2828 occurrences) Last logged: 4:39:46 PM

Unexpected error fetching smartthinq_sensors-Oven data: Extra data: line 1 column 2 (char 1)

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 187, in _async_refresh self.data = await self._async_update_data() File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 147, in _async_update_data return await self.update_method() File "/config/custom_components/smartthinq_sensors/init.py", line 361, in async_device_update await self._hass.async_add_executor_job(self._device_update) File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/smartthinq_sensors/init.py", line 373, in _device_update state = self._device.poll() File "/config/custom_components/smartthinq_sensors/wideq/range.py", line 54, in poll res = self.device_poll("ovenState") File "/config/custom_components/smartthinq_sensors/wideq/device.py", line 1374, in device_poll res = self._model_info.decode_monitor(data) File "/config/custom_components/smartthinq_sensors/wideq/device.py", line 745, in decode_monitor return self.decode_monitor_json(data) File "/config/custom_components/smartthinq_sensors/wideq/device.py", line 737, in decode_monitor_json return json.loads(data.decode("utf8")) File "/usr/local/lib/python3.9/json/init.py", line 346, in loads return _default_decoder.decode(s) File "/usr/local/lib/python3.9/json/decoder.py", line 340, in decode raise JSONDecodeError("Extra data", s, end) json.decoder.JSONDecodeError: Extra data: line 1 column 2 (char 1)

ollo69 commented 2 years ago

You should enable debug log and provide me new log file to investigate this issue. To enable debug add this lines in configuration.yaml log section:

logger:
  default: info
  logs:
    custom_components.smartthinq_sensors: debug
cmause commented 2 years ago

HA_Thinq_log.txt

Thanks for info to enable debugging. I have attached the full log file after enabling and restarting. The key part is:

2022-01-18 08:44:27 DEBUG (SyncWorker_4) [custom_components.smartthinq_sensors] Updating ThinQ device Oven
2022-01-18 08:44:27 DEBUG (SyncWorker_4) [custom_components.smartthinq_sensors.wideq.device] Updating ThinQ device 10ca0570-20b9-11ec-9777-0051ed53ff8c
2022-01-18 08:44:27 DEBUG (SyncWorker_4) [custom_components.smartthinq_sensors.wideq.device] Polling...
2022-01-18 08:44:27 DEBUG (SyncWorker_4) [custom_components.smartthinq_sensors.wideq.core_v2] lgedm2_post before: https://aic.lgthinq.com:46030/api/rti/rtiResult
2022-01-18 08:44:27 DEBUG (SyncWorker_4) [custom_components.smartthinq_sensors.wideq.core_v2] lgedm2_post after: {'lgedmRoot': {'returnCd': '0000', 'returnMsg': 'OK', 'workList': {'deviceId': '10ca0570-20b9-11ec-9777-0051ed53ff8c', 'deviceState': 'E', 'format': 'B64', 'returnCode': '0000', 'returnData': 'MDAsMDAsMDAsMDAsMDAsMDAsMDAsMDAsNDYsMDAsMDAsMDAsMDAsMDAsMDAsMDYsMDAsMDAsMDAsMDAsMDAsMDAsMDAsMDAsMDAsMDAsMDAsMDAsMDAsMDAsMDAsMDAsMDAsMDAsMDAsMDAsMDAsMDAsMDAsMDAsMDAsMDAsMDAsMDAsMDAsMDAsMDAsMDAsMDAsMDAsMDAsMDAsMDAsMDAsMDAsMDAsMDAsMDAsMDAsMDAsMDAsMDA=', 'stateCode': 'S', 'workId': 'n-10ca0570-20b9-11ec-9777-0051ed53ff8c'}}}
2022-01-18 08:44:27 DEBUG (SyncWorker_4) [custom_components.smartthinq_sensors.wideq.device] ThinQ status updated
2022-01-18 08:44:27 ERROR (MainThread) [custom_components.smartthinq_sensors] Unexpected error fetching smartthinq_sensors-Oven data: Extra data: line 1 column 2 (char 1)
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 187, in _async_refresh
self.data = await self._async_update_data()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 147, in _async_update_data
return await self.update_method()
File "/config/custom_components/smartthinq_sensors/__init__.py", line 361, in async_device_update
await self._hass.async_add_executor_job(self._device_update)
File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/smartthinq_sensors/__init__.py", line 373, in _device_update
state = self._device.poll()
File "/config/custom_components/smartthinq_sensors/wideq/range.py", line 54, in poll
res = self.device_poll("ovenState")
File "/config/custom_components/smartthinq_sensors/wideq/device.py", line 1374, in device_poll
res = self._model_info.decode_monitor(data)
File "/config/custom_components/smartthinq_sensors/wideq/device.py", line 745, in decode_monitor
return self.decode_monitor_json(data)
File "/config/custom_components/smartthinq_sensors/wideq/device.py", line 737, in decode_monitor_json
return json.loads(data.decode("utf8"))
File "/usr/local/lib/python3.9/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "/usr/local/lib/python3.9/json/decoder.py", line 340, in decode
raise JSONDecodeError("Extra data", s, end)
json.decoder.JSONDecodeError: Extra data: line 1 column 2 (char 1)
2022-01-18 08:44:27 DEBUG (MainThread) [custom_components.smartthinq_sensors] Finished fetching smartthinq_sensors-Oven data in 0.404 seconds (success: False)
ollo69 commented 2 years ago

Can you provide me the JSON definition file for your oven (or attach full log from HA startup so that I can get the link and download by myself)?

cmause commented 2 years ago

I attempted to attach the full log in my previous response, called HA_Thinq_log.txt, but I might have messed it up. Here it is again:
HA_Thinq_log.txt

If there's another log I can provide to help troubleshoot, I'll need a bit more guidance on where to find it. The (hopefully) relevant part of the attached log is below.

I'm happy to dig up the JSON definition file, but I'd need to be pointed in the right direction.

-------------------------------------------------------------------
smartthinq_sensors
Version: 0.12.2
This is a custom component
If you have any issues with this you need to open an issue here:
https://github.com/ollo69/ha-smartthinq-sensors/issues
-------------------------------------------------------------------
2022-01-18 08:40:51 INFO (MainThread) [custom_components.smartthinq_sensors] Initializing ThinQ platform with region: US - language: en-US
2022-01-18 08:40:51 DEBUG (SyncWorker_1) [custom_components.smartthinq_sensors.wideq.core_v2] thinq2_get before: https://route.lgthinq.com:46030/v1/service/application/gateway-uri
2022-01-18 08:40:51 INFO (MainThread) [custom_components.ble_monitor] Attention! Option report_unknown is enabled for Govee sensors, be ready for a huge output
2022-01-18 08:40:51 INFO (MainThread) [homeassistant.setup] Setting up camera
2022-01-18 08:40:51 INFO (MainThread) [homeassistant.setup] Setting up usb
2022-01-18 08:40:51 INFO (MainThread) [homeassistant.setup] Setup of domain usb took 0.0 seconds
2022-01-18 08:40:51 INFO (MainThread) [homeassistant.setup] Setting up hacs
2022-01-18 08:40:51 INFO (MainThread) [homeassistant.setup] Setup of domain hacs took 0.0 seconds
2022-01-18 08:40:51 DEBUG (SyncWorker_1) [custom_components.smartthinq_sensors.wideq.core_v2] thinq2_get after: {'resultCode': '0000', 'result': {'countryCode': 'US', 'languageCode': 'en-US', 'thinq1Uri': 'https://aic.lgthinq.com:46030/api', 'thinq2Uri': 'https://aic-service.lgthinq.com:46030/v1', 'empUri': 'https://us.m.lgaccount.com', 'empSpxUri': 'https://us.m.lgaccount.com/spx', 'rtiUri': 'aic.lgthinq.com:47878', 'mediaUri': 'aic-media.lgthinq.com:47800', 'appLatestVer': '4.0.12230', 'appUpdateYn': 'Y', 'appLink': 'market://details?id=com.lgeha.nuts', 'nestSupportAppVer': '9.0.0', 'uuidLoginYn': 'Y', 'lineLoginYn': 'N', 'lineChannelId': '', 'cicTel': '800-243-0000', 'cicUri': '', 'isSupportVideoYn': 'N', 'countryLangDescription': 'USA/English', 'empTermsUri': 'https://us.emp.lgsmartplatform.com', 'googleAssistantUri': 'https://assistant.google.com/services/invoke/uid/000000d26892b8a3', 'smartWorldUri': 'http://us.lgworld.com/mall/mobile.main.dev?referUrl=ThinQ', 'racUri': 'us.rac.lgeapi.com', 'cssUri': 'https://aic-common.lgthinq.com', 'cssWebUri': 'http://s3-an2-op-t20-css-web-resource.s3-website.ap-northeast-2.amazonaws.com', 'iotssUri': 'https://aic-iotservice.lgthinq.com', 'chatBotUri': 'https://chatbot-us.lgthinq.com', 'autoOrderSetUri': 'http://us.lgworld.com/mall/mobile.product.RetrieveProdCategoryList.dev?referUrl=ThinQ&initCategoryType=AUTO', 'autoOrderManageUri': 'http://us.lgworld.com/mall/mobile.mypage.RetrieveAutoRequestList.dev?referUrl=ThinQ', 'aiShoppingUri': '', 'onestopCall': '1-833-560-1236', 'onestopEngineerUri': 'https://svcthinq.com/global/repairRequest.html', 'hdssUri': '', 'amazonDrsYn': 'Y', 'features': {'supportTvIoTServerYn': 'Y', 'amazonDrs': 'Y', 'bleConfirmYn': 'Y', 'csEngineerReserveProdCode': 'LA01,LA02,LA05,LA03,LA06,LA07,LA04,LI01,LI06,LI04,LI05,TV,LI03,KI01,KI0101,KI0102,KI0103,KI0104,KI02,KI0201,KI0202,KI10,KI03,KI04,KI08,KI07,KI05,KI12,KI06,AI01,RAC,PAC,POT,WIN,AI04,CST,DUCT,SPAC,SRAC,CVT,CSL,AI05,AWHP,LI02,AI02,AI03,AI07,SB01,SB07,SB02,SB04,SB03,SB05', 'androidAutoYn': 'Y', 'searchYn': 'Y', 'thinqMall': 'Y', 'thinqFaq': 'Y', 'careCardFeature': 'Y', 'smsAuthVerifyYn': 'Y', 'groupControlYn': 'Y', 'autoOrderYn': 'Y', 'supportBleYn': 'Y', 'pccWarrantyProd': '101,102,103,104,105,106,201,202,203,204,222,301,302,303,304,401,402,403,405,406,407,408,409,501,504,601,603', 'salesforceYn': 'Y', 'onestopCallbyProductId': '{"Common":"1-833-560-1236","301":"1-833-560-1236","401":"1-833-560-1236","402":"1-833-560-1236","201":"1-833-560-1236","202":"1-833-560-1236","203":"1-833-560-1236","221":"1-833-560-1236","222":"1-833-560-1236","501":"1-833-560-1236","204":"1-833-560-1236","101":"1-833-560-1236","102":"1-833-560-1236","103":"1-833-560-1236"}', 'disableWeatherCard': 'N', 'pccPushProd': '101,102,103,201,202,203,204,222,301,302,401,402', 'pccRegisterProd': '101,102,103,104,105,106,201,202,203,204,222,301,302,303,304,401,402,403,405,406,407,408,409,501,504,601,603', 'tvRcmdContentYn': 'Y', 'pccModelCategory': 'N', 'supportProductManualYn': 'N', 'smartlifeProductExtension': 'Y', 'amazonAlexaYn': 'Y', 'pccPush': 'Y', 'clientDbYn': 'Y', 'careContentCard': 'Y', 'pccMyPageYn': 'Y', 'smsAuthYn': 'Y', 'thinqNotice': 'Y', 'inAppReviewYn': 'Y', 'pccNoticeAgreement': 'N', 'cicSupport': 'Y', 'pccWarrantyPeriodType': 'M', 'pccReceiptRegister': 'Y', 'qrRegisterYn': 'Y'}, 'serviceCards': [{'id': 1000, 'order': 4, 'title': None, 'message': None, 'bgImage': 'https://objectcontent.lgthinq.com/16eda39d-9179-45e9-9339-55dcceeaf1bf?hdnts=exp=1654220528~hmac=395a8b43cc778b42a1e671477c7ccff5baa6f1c49a73a4e9f6f48e3472cdc7e4', 'bgImageDescription': None, 'smallImage': None, 'bgColor': None, 'link': 'thinqapp://webapp?state="GCM_DRS01_productList"', 'trackingKeyword': 'FUN_DRS_DEF_US', 'priority': 'normal', 'startDate': '1569902400', 'endDate': '1890773999', 'models': []}], 'uris': {'amazonAlexaLearnMoreUri': 'https://www.amazon.com/b?node=21227173011', 'takeATourUri': 'https://s3-us2-op-t20-css-contents.s3.us-west-2.amazonaws.com/workexperience-new/ios/no-version/index.html', 'csReserveListManualUri': 'https://svcthinq.com/support/global/track-repair.html', 'offerMicroSiteUri': 'https://thinq.us.lg.com/extend/mobile/login', 'hdssUri': 'https://aic-hdss.lgthinq.com:47040', 'quickguideUri': 'https://s3-us2-op-t20-css-contents.s3-us-west-2.amazonaws.com/quickguide/index.html', 'recipeUri': 'https://www.sidechef.com/account/signup/?next=/lg/&redirect=1', 'csFindServiceCenterUri': 'https://www.lg.com/us/support/find-service-center', 'gscsUri': 'https://gscs-america.lge.com', 'storeOrderUri': 'https://us.lgworld.com', 'storeOrderHistoryUri': 'http://us.lgworld.com/mall/mobile.mypage.RetrieveOrderSearchList.dev?referUrl=ThinQ', 'amazonDartUri': 'https://shs.lgthinq.com', 'csEngineerReserveUri': 'https://svcthinq.com/support/global/repair-service-schedule.html'}}}
2022-01-18 08:40:51 DEBUG (SyncWorker_1) [custom_components.smartthinq_sensors.wideq.core_v2] Request new access token
2022-01-18 08:40:51 INFO (MainThread) [homeassistant.setup] Setting up home_connect
2022-01-18 08:40:51 INFO (MainThread) [homeassistant.setup] Setup of domain home_connect took 0.0 seconds
2022-01-18 08:40:51 INFO (MainThread) [homeassistant.setup] Setting up roomba
2022-01-18 08:40:51 INFO (MainThread) [homeassistant.setup] Setup of domain roomba took 0.0 seconds
2022-01-18 08:40:51 INFO (MainThread) [homeassistant.components.binary_sensor] Setting up binary_sensor.updater
2022-01-18 08:40:51 INFO (MainThread) [homeassistant.setup] Setup of domain logbook took 1.6 seconds
2022-01-18 08:40:51 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.srp_energy
2022-01-18 08:40:51 INFO (MainThread) [homeassistant.setup] Setup of domain media_source took 1.6 seconds
2022-01-18 08:40:51 INFO (MainThread) [homeassistant.setup] Setting up squeezebox
2022-01-18 08:40:51 INFO (MainThread) [homeassistant.setup] Setup of domain squeezebox took 0.0 seconds
2022-01-18 08:40:51 DEBUG (SyncWorker_1) [custom_components.smartthinq_sensors.wideq.core_v2] Authorization request completed successfully
2022-01-18 08:40:52 DEBUG (SyncWorker_1) [custom_components.smartthinq_sensors.wideq.core_v2] thinq2_get before: https://aic-service.lgthinq.com:46030/v1/service/application/dashboard
2022-01-18 08:40:52 INFO (MainThread) [homeassistant.setup] Setting up ifttt
2022-01-18 08:40:52 INFO (MainThread) [homeassistant.setup] Setup of domain ifttt took 0.0 seconds
2022-01-18 08:40:52 INFO (MainThread) [homeassistant.setup] Setup of domain group took 1.8 seconds
2022-01-18 08:40:52 INFO (MainThread) [homeassistant.setup] Setup of domain system_health took 1.8 seconds
2022-01-18 08:40:52 INFO (MainThread) [homeassistant.setup] Setting up network
2022-01-18 08:40:52 INFO (SyncWorker_2) [homeassistant.loader] Loaded google_translate from homeassistant.components.google_translate
2022-01-18 08:40:52 INFO (MainThread) [homeassistant.setup] Setup of domain network took 0.0 seconds
2022-01-18 08:40:52 INFO (MainThread) [homeassistant.setup] Setting up energy
2022-01-18 08:40:52 INFO (MainThread) [homeassistant.setup] Setup of domain energy took 0.0 seconds
2022-01-18 08:40:52 INFO (MainThread) [homeassistant.setup] Setup of domain tag took 2.6 seconds
2022-01-18 08:40:52 INFO (MainThread) [homeassistant.setup] Setup of domain ffmpeg took 1.9 seconds
2022-01-18 08:40:52 INFO (MainThread) [custom_components.hacs]
ollo69 commented 2 years ago

Yes sorry, I see attached file in previous post just now. What I can see from your file is that your oven is using a different protocol, that I never see before (BINARY(HEX)) I need some time to implement this, I will come back when I will be ready.

cmause commented 2 years ago

I appreciate the work you've put into this integration. If there's any information I can provide to support your development, please let me know!

ollo69 commented 2 years ago

Can you try to installing the master version and let me know if this fix the issue. I would like to be sure that issue is fixed before releasing an official new version. If still not work, please attach again logs with errors.

cmause commented 2 years ago

HA_Thinq_log2.txt

Logs attached ^^^

I pulled masterusing HACS, but the logs are still reporting version 0.12.3. I don't know if that's expected. The error is different, though, so that's progress!

Unexpected error fetching smartthinq_sensors-Oven data: a bytes-like object is required, not 'str'

ollo69 commented 2 years ago

logs are still reporting version 0.12.3

Yes, is expected. Please update and try again, just committed a little fix.

cmause commented 2 years ago

Updated from master and restarted. No errors reported.

Here's the full log from restart: HA_Thinq_log3.txt

Checking now to see if cooktop and oven status update properly in HA...

cmause commented 2 years ago

A very quick test indicates that HA is receiving state updates from my cooktop and oven.

This issue can be closed. Thanks for the quick work!

ollo69 commented 2 years ago

Fine!!! Remember to disable debug and update to official new release when available, or HACS will not notify you about new version.