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

io transport mqtt sets wrong QoS levels to hiveMQ #2145

Closed
stedon81 opened this issue Jan 22, 2021 · 3 comments
Closed

io transport mqtt sets wrong QoS levels to hiveMQ #2145

stedon81 opened this issue Jan 22, 2021 · 3 comments

Comments

@stedon81
Copy link
Contributor

Package: org.openhab.core.io.transport.mqtt.internal.client

Mqtt3AsyncClientWrapper.publish() and Mqtt3AsyncClientWrapper.subscribe use a function called getMqttQosFromInt to map the int qos to the enum value required by hiveMQ.
This function maps the integer values wrongly:

    protected MqttQos getMqttQosFromInt(int qos) {
        switch (qos) {
            case 0:
                return MqttQos.AT_LEAST_ONCE;
            case 1:
                return MqttQos.AT_MOST_ONCE;
            case 2:
                return MqttQos.EXACTLY_ONCE;
            default:
                throw new IllegalArgumentException("QoS needs to be 0, 1 or 2.");
        }
    }

According to https://www.hivemq.com/blog/mqtt-essentials-part-6-mqtt-quality-of-service-levels/, the QoS levels are:

  • At most once (0)
  • At least once (1)
  • Exactly once (2)

Hence, QoS levels 0 and 1 must be exchanged in that function.

@openhab-bot
Copy link
Collaborator

This issue has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/mqtt-minimum-delay-time-between-messages-that-openhab-can-process-them/114863/19

stedon81 pushed a commit to stedon81/openhab-core that referenced this issue Feb 18, 2021
@stedon81
Copy link
Contributor Author

I prvided pull request #2208 to fix this issue

kaikreuzer pushed a commit that referenced this issue Feb 27, 2021
@kaikreuzer
Copy link
Member

Fixed by #2208 - thanks!

splatch pushed a commit to ConnectorIO/copybara-hab-core that referenced this issue Jul 11, 2023
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