GuyKh / iec-custom-component

HomeAssistant Custom Component for IEC
MIT License
131 stars 5 forks source link

fail to fetch data #86

Open alnet82 opened 7 months ago

alnet82 commented 7 months ago

System Health details

System Information

version core-2024.3.3
installation_type Home Assistant Supervised
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.12.2
os_name Linux
os_version 5.15.76-v8+
arch aarch64
timezone Asia/Jerusalem
config_dir /config
Home Assistant Community Store GitHub API | ok -- | -- GitHub Content | ok GitHub Web | ok GitHub API Calls Remaining | 4918 Installed Version | 1.34.0 Stage | running Available Repositories | 1403 Downloaded Repositories | 6
Home Assistant Cloud logged_in | true -- | -- subscription_expiration | June 11, 2024 at 3:00 AM relayer_connected | true relayer_region | eu-central-1 remote_enabled | true remote_connected | true alexa_enabled | true google_enabled | true remote_server | eu-central-1-14.ui.nabu.casa certificate_status | ready instance_id | e46d5f58e66f4a40af3208fdacae7b38 can_reach_cert_server | ok can_reach_cloud_auth | ok can_reach_cloud | ok
Home Assistant Supervisor host_os | Debian GNU/Linux 11 (bullseye) -- | -- update_channel | stable supervisor_version | supervisor-2024.03.0 agent_version | 1.4.1 docker_version | 20.10.21 disk_total | 457.1 GB disk_used | 63.3 GB healthy | true supported | true supervisor_api | ok version_api | ok installed_addons | Studio Code Server (5.15.0), Cloudflared (4.2.6), AdGuard Home (5.0.5), Tailscale (0.16.1), Terminal & SSH (9.10.0), Mosquitto broker (6.4.0), Ring-MQTT with Video Streaming (5.6.3), Syncthing (1.19.0), AirCast (4.2.1), openWakeWord (1.10.0)
Dashboards dashboards | 1 -- | -- resources | 0 views | 1 mode | storage
Recorder oldest_recorder_run | March 23, 2024 at 5:14 PM -- | -- current_recorder_run | March 27, 2024 at 11:16 PM estimated_db_size | 621.24 MiB database_engine | sqlite database_version | 3.44.2
Sonoff version | 3.6.0 (8dd8af9) -- | -- cloud_online | 2 / 2 local_online | 2 / 2
Xiaomi Miot Auto component_version | 0.7.17 -- | -- can_reach_server | ok can_reach_spec | ok logged_accounts | 1 total_devices | 0

Checklist

Describe the issue

Getting "Failed setup, will retry" message.

Reproduction steps

1. 2. 3. ...

Debug logs

See the following in the log:
2024-03-27 23:22:48.773 ERROR (MainThread) [custom_components.iec.coordinator] Unexpected error fetching Iec data: (Code 400): Bad Request
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 318, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/iec/coordinator.py", line 150, in _async_update_data
    await self.api.load_jwt_token(JWT.from_dict(self._entry_data[CONF_API_TOKEN]))
  File "/usr/local/lib/python3.12/site-packages/iec_api/iec_client.py", line 380, in load_jwt_token
    if await self.check_token():
       ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/iec_api/iec_client.py", line 413, in check_token
    await self.refresh_token()
  File "/usr/local/lib/python3.12/site-packages/iec_api/iec_client.py", line 421, in refresh_token
    self._token = await login.refresh_token(self._session, self._token)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/iec_api/login.py", line 205, in refresh_token
    response = await commons.send_post_request(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/iec_api/commons.py", line 181, in send_post_request
    parse_error_response(resp, json_resp)
  File "/usr/local/lib/python3.12/site-packages/iec_api/commons.py", line 89, in parse_error_response
    raise IECError(resp.status, resp.reason)
iec_api.models.exceptions.IECError: (Code 400): Bad Request

Diagnostics dump

No response

GuyKh commented 7 months ago

@alnet82 it seems that the login token is misconfigured. Can you try to remove and add the component again?