Ludy87 / xplora_watch

Xplora® Watch Home Assistant Integration
MIT License
50 stars 6 forks source link

🐛 AttributeError load Message error per Service #232

Closed Caine72 closed 1 year ago

Caine72 commented 1 year ago

What version of Integration has the issue?

v2.8.2

System Health details

System Information

version core-2023.7.1
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.11.4
os_name Linux
os_version 6.1.34
arch x86_64
timezone Europe/Stockholm
config_dir /config
Home Assistant Community Store GitHub API | ok -- | -- GitHub Content | ok GitHub Web | ok GitHub API Calls Remaining | 4981 Installed Version | 1.32.1 Stage | running Available Repositories | 1341 Downloaded Repositories | 48
Home Assistant Supervisor host_os | Home Assistant OS 10.3 -- | -- update_channel | stable supervisor_version | supervisor-2023.07.1 agent_version | 1.5.1 docker_version | 23.0.6 disk_total | 116.7 GB disk_used | 10.6 GB healthy | true supported | true board | generic-x86-64 supervisor_api | ok version_api | ok installed_addons | Z-Wave JS (0.1.84), AppDaemon (0.13.1), File editor (5.6.0), Home Assistant Google Drive Backup (0.111.1), Terminal & SSH (9.7.1), Studio Code Server (5.8.1), Mosquitto broker (6.2.1), Uptime Kuma (0.8.0), Zigbee2MQTT (1.32.1-1)
Dashboards dashboards | 6 -- | -- resources | 30 views | 40 mode | storage
Recorder oldest_recorder_run | 2 July 2023 at 06:56 -- | -- current_recorder_run | 10 July 2023 at 21:08 estimated_db_size | 915.53 MiB database_engine | mysql database_version | 10.6.11

Checklist

Describe the issue

I noticed this error-log ( see supplied debug log) in my logs. It seems to occur when I read from the service every 30 seconds (i.e. the automation.read_message_from_watch). The last 24h it seems to have occurred 1084 times. I see no noticeable impact for the issue as it might be self correcting with the next read that occurs.

service: xplora_watch.read_message
data:
  target: all

Reproduction steps

  1. Watch is setup as required.
  2. Automation that calls the xplora_watch.read_message service every 30 seconds.
  3. Sometimes issue appears in logs.

Debug logs

Logger: homeassistant.components.automation.read_message_from_watch
Source: custom_components/xplora_watch/services.py:197
Integration: Automation (documentation, issues)
First occurred: 11 July 2023 at 11:22:37 (1084 occurrences)
Last logged: 11:57:14

Xplora - Read Messages from watch: Error executing script. Unexpected error for call_service at pos 1: 'NoneType' object has no attribute 'get'
While executing automation automation.read_message_from_watch
Xplora - Read Messages from watch: Error executing script. Unexpected error for call_service at pos 1: 'str' object has no attribute 'get'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 468, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 703, in _async_call_service_step
    response_data = await self._async_run_long_action(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 665, in _async_run_long_action
    return long_task.result()
           ^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 1957, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 1997, in _execute_service
    return await cast(
           ^^^^^^^^^^^
  File "/config/custom_components/xplora_watch/services.py", line 79, in async_read_message
    await sensor_update_service.async_read_message(kwargs[ATTR_SERVICE_TARGET])
  File "/config/custom_components/xplora_watch/services.py", line 180, in async_read_message
    await self._fetch_chat_short_video(watch, msg_id)
  File "/config/custom_components/xplora_watch/services.py", line 197, in _fetch_chat_short_video
    encoded_base64_string_to_file(self._hass, thumb.get("fetchChatShortVideoCover"), msg_id, "jpeg", "video/thumb")
                                              ^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'get'
github-actions[bot] commented 1 year ago

:wave: @Caine72, it is checked whether there is a bug. Please have some patience. This action was performed automatically.

github-actions[bot] commented 1 year ago

:wave: @Caine72, we found the bug, it will be fixed shortly. This action was performed automatically.