empicano / aiomqtt

The idiomatic asyncio MQTT client
https://aiomqtt.bo3hm.com
BSD 3-Clause "New" or "Revised" License
427 stars 75 forks source link

aiomqtt client_id #314

Closed paranoid64 closed 4 months ago

paranoid64 commented 4 months ago

Hi,

i updated to the aiomqtt lib today and realized that I can no longer use client_is like this.

async with aiomqtt.Client(hostname=GL.config['mqtt']['server'], port=GL.config['mqtt']['port'], username=GL.config['mqtt']['username'], password=GL.config['mqtt']['password'], client_id=GL.config['mqtt']['client']) as client:

I get this error now:

line 28, in task_thermo
    async with aiomqtt.Client(hostname=GL.config['mqtt']['server'], port=GL.config['mqtt']['port'], username=GL.config['mqtt']['username'], password=GL.config['mqtt']['password'], client_id=GL.config['mqtt']['client']) as client:
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: Client.__init__() got an unexpected keyword argument 'client_id'

Can anyone give me a hint as to what this is now?

empicano commented 4 months ago

I missed that in the migration guide, good catch! 👍 It's called identifier now, you can see the complete signature of the client in the documentation.

Let me know if that helps!

paranoid64 commented 4 months ago

Hi,

only managed to test it today. Had to change that too:

Delete without replacement: async with client.messages() as messages:

Code indented one to the left.

This: async for message in messages:

replace with: async for message in client.messages:

Then everything worked again. Thanks!