Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in mqtt async example #46

Open
lsrur opened this issue Aug 1, 2023 · 2 comments
Open

Error in mqtt async example #46

lsrur opened this issue Aug 1, 2023 · 2 comments

Comments

@lsrur
Copy link

lsrur commented Aug 1, 2023

I get the following error when running the async mqtt example:

Exception in message_received when handling msg on 'home-assistant/mqtt_example': 'payload_text' TypeError: async_setup.<locals>.message_received() missing 2 required positional arguments: 'payload' and 'qos'

Any ideas?
TIA

@fflori4n
Copy link

fflori4n commented Jan 7, 2024

Hey,
Ran into the same issue today, it seems that the message_received() function was changed at some point, and now expects a ReceiveMessage type object that contains all the previous arguments. Managed to do a quick and dirty fix to get the integration working, just by replacing :

def message_received(topic: str, payload: str, qos: int)  -> None:

with:

def message_received(args: ReceiveMessage) -> None:

       # logging.warning(args)  #just log the object to see how it looks

        topic = getattr(args, 'topic')
        payload = getattr(args, 'payload')
        qos = getattr(args, 'qos')

@bigmoby
Copy link

bigmoby commented May 24, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants