I switched from mqtt1 binding to the new mqtt 2.4.0 binding but can’t set the qos. I don’t like the paperUI and prefer configuration via files.
Here is my config:
My mqtt.things looks like this (please note that I replaced credentials with dummy data or <placeholders>
):
Bridge mqtt:broker:thingspeak [ host="mqtt.thingspeak.com", port=8883, secure=true, reconnectTime=1000, username="username", password="password", certificatepin=false, publickeypin=false, qos=0 ]{
Thing topic motion {
Channels:
Type switch : MotionSwitch "Motion Switch" [ qos=0, retained=false, stateTopic="channels/<ID>/subscribe/fields/field1", commandTopic="channels/<ID>/publish/fields/field1/<KEY>", on="ON", off="OFF" ]
}
}
And an according item:
Switch MQTT_Switch_Command "MQTT Command 1" {channel="mqtt:topic:thingspeak:motion:MotionSwitch"}
After setting the phao mqtt logger to DEBUG level (karaf: log:set DEBUG org.eclipse.paho.client.mqttv3
) I can see some log entries when switching the MQTT_Switch_Command item (please note that qos is set to 1 but configured to be 0):
2019-11-21 11:19:33.169 [DEBUG] [mqttv3.internal.wire.MqttOutputStream] - null: Sent PUBLISH qos:1 msgId:10 retained:false dup:false topic:"channels/<ID>/publish/fields/field1/<KEY>" payload:[hex:4f4e utf8:"ON" length:2]
2019-11-21 11:19:33.380 [DEBUG] [mqttv3.internal.wire.MqttInputStream] - null: Automatic Reconnect Successful: PUBACK msgId 10
The update is not registered/showed by thingspeak so I guess it’s not accepted. (my channel on thingspeak shows 0 entries). I guess it’s rejected because of the qos.
The thingspeak mqtt docs state the following (requirements? or suggestions?)
https://de.mathworks.com/help/thingspeak/publishtoachannelfieldfeed.html
Set the PUBLISH messages to a QoS value of 0.
Set the connection RETAIN flag to 0.
Set the connection CleanSession flag to 1.
I cross-checked with MQTT.fx and published a new value successfully with qos 0. When I set the qos to 1 it does not work. Therefore I’m highly confident that the phao qos is the issue.
I cross-checked by using a public mqtt server that is not that picky regarding qos and the state changes where propagated successfully.
I restarted openhab2 multiple times because I red there is an issue with reloading the config. See Small problem with mqtt after model refresh
The relevant docs are here:
qos : Quality of Service. Can be 0, 1 or 2. Please read the MQTT specification for details. Defaults to 0.
I can’t observe a default of 0, neither setting this value to 0. It’s constantly 1. The same for the channel based configuration.
Does anyone have an idea what the problem is? Or other things I can try?
- Platform information:
- openHAB version: 2.4.0