cpolhout / loqed_custom_component

Custom component for Home Asssistant, use HACS to install.
8 stars 6 forks source link

Error processing webhook p87yh9pb787yhupctafkajayopb #12

Open ridderr opened 1 year ago

ridderr commented 1 year ago

Hi I hope you have some time to look at this issue.

Logger: homeassistant.components.webhook Source: custom_components/loqed/lock.py:259 Integration: Webhook (documentation, issues) First occurred: 6 mei 2023 om 19:28:37 (15 occurrences) Last logged: 14:28:37

Error processing webhook p87yh9pb787yhupctafkajayopb Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/webhook/init.py", line 169, in async_handle_webhook response = await webhook["handler"](hass, webhook_id, request) File "/config/custom_components/loqed/lock.py", line 259, in async_handle_webhook event = event_data["event_type"].strip().lower() KeyError: 'event_type'

ridderr commented 1 year ago

Hi, I have added an additional LOG statement and I think this error it is cause by the fact that event_type is not in the reply message:

2023-05-10 14:30:49.926 DEBUG (MainThread) [custom_components.loqed.lock] Callback received: <CIMultiDictProxy('Host': '***********', 'Connection': 'Upgrade', 'Content-Length': '102', 'User-Agent': 'ESP32 HTTP Client/1.0', 'Accept': 'text/html', 'Accept-Encoding': 'identity', 'Content-Type': 'application/json', 'HASH': '********', 'TIMESTAMP': '1683721849')> 2023-05-10 14:30:49.927 DEBUG (MainThread) [custom_components.loqed.lock] Callback body: {"battery_type":"UNKNOWN","battery_percentage":100,"mac_wifi":"a848fa897e28","mac_ble":"a848fa897e2a"} 2023-05-10 14:30:49.928 DEBUG (MainThread) [custom_components.loqed.lock] event_data: {'battery_type': 'UNKNOWN', 'battery_percentage': 100, 'mac_wifi': 'a848fa897e28', 'mac_ble': 'a848fa897e2a'} 2023-05-10 14:30:49.928 DEBUG (MainThread) [custom_components.loqed.lock] Firing event:: LOQED_status_change_to_unlocked 2023-05-10 14:30:49.928 ERROR (MainThread) [homeassistant.components.webhook] Error processing webhook p87yh9pb787yhupctafkajayopb Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/webhook/__init__.py", line 169, in async_handle_webhook response = await webhook["handler"](hass, webhook_id, request) File "/config/custom_components/loqed/lock.py", line 260, in async_handle_webhook event = event_data["event_type"].strip().lower() KeyError: 'event_type' 2023-05-10 14:32:20.757 DEBUG (MainThread) [custom_components.loqed.lock] Start update operation 2023-05-10 14:32:25.773 ERROR (MainThread) [homeassistant.helpers.entity] Update for lock.voordeur fails