SAIC-iSmart-API/saic-home-assistant-addon

Idiot's guide

Closed this issue · 6 comments

whenever I start the addon, it fails a few seconds later with the following error message in the log. I'm new to HA and haven't managed to get the addon working at all yet, presumable because of this. anyone know what ive done wrong and how to stop this from happening?

Traceback (most recent call last):
  File "/usr/local/lib/python3.12/asyncio/events.py", line 88, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/local/lib/python3.12/site-packages/gmqtt/mqtt/handler.py", line 217, in _handle_exception_in_future
    if future.exception():
       ^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/gmqtt/client.py", line 255, in reconnect
    async def reconnect(self, delay=False):
asyncio.exceptions.CancelledError
2024-04-30 22:13:44,846 [  INFO  ] [CONNECTION MADE] - gmqtt.mqtt.protocol
2024-04-30 22:13:44,851 [WARNING ] [CONNACK] 0x5 - gmqtt
2024-04-30 22:13:44,853 [  INFO  ] [CONN CLOSE NORMALLY] - gmqtt.mqtt.protocol
Traceback (most recent call last):
  File "/usr/src/app/./mqtt_gateway.py", line 883, in <module>
    asyncio.run(mqtt_gateway.run(), debug=debug_log_enabled())
  File "/usr/local/lib/python3.12/asyncio/runners.py", line 194, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 687, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/usr/src/app/./mqtt_gateway.py", line 424, in run
    await self.publisher.connect()
  File "/usr/src/app/publisher/mqtt_publisher.py", line 86, in connect
    await self.client.connect(host=self.host, port=self.port, version=gmqtt.constants.MQTTv311, ssl=ssl_context)
  File "/usr/local/lib/python3.12/site-packages/gmqtt/client.py", line 235, in connect
    raise self._error
gmqtt.mqtt.handler.MQTTConnectError: code 5 (Connection Refused: not authorised)
2024-04-30 22:13:44,931 [ ERROR  ] Task was destroyed but it is pending!
task: <Task pending name='Task-9' coro=<Client.reconnect() done, defined at /usr/local/lib/python3.12/site-packages/gmqtt/client.py:255> wait_for=<Future pending cb=[Task.task_wakeup()]>> - asyncio
2024-04-30 22:13:45,007 [ ERROR  ] Task was destroyed but it is pending!
task: <Task pending name='Task-1' coro=<Client._resend_qos_messages() running at /usr/local/lib/python3.12/site-packages/gmqtt/client.py:176>> - asyncio
sys:1: RuntimeWarning: coroutine 'Client._resend_qos_messages' was never awaited

The error says

gmqtt.mqtt.handler.MQTTConnectError: code 5 (Connection Refused: not authorised)

Looks like you are using incorrect credentials to connect to your MQTT broker. If you are using the mosquitto add on make sure you've created a user for the SAIC MQTT Gateway and that correct credentials have been supplied

Thanks for the help, I've fixed that and now it is running the startup process further, but is crashing when it tries to login to the API because the "call return code is not acceptable". Also, the wiki says auto discovery show kick in, but I've broken that as well.
Any advice on either of these?

I've been using a phone number to login, and my password is completely alphanumeric.

however, i did find this in the logs. Does it mean I need to add a country code into my config, because it's not marked as required. If so, is it just the country or the whole phone number.
2024-05-02** 17:57:31,315 [ ERROR ] API call return code is not acceptable: 1000020: {"code":1000020,"message":"The country code not exist !"}.

It's not required since it's needed only for phone numbers. It's for example 39 for italy. You should remove it from your phone number and specify that in that var

Thanks so much! I know thsi was probably really frustrating for you to sit through, but I've got the integration working now. Thanks again