I now tried for several days to get the new MQTT binding to work, with out any succes.
Can anyone tell me what I am doing wrong.
This is my bridge configuration:
If I click the up or down butten no massage is send, when I look in mqtt.fx with "# "
While in with rules the old mqtt 1 binding is still working, so I see the messages in mqtt.fx
rule "bathroom shutter "
when
Item bathR_shutters received command
then
logInfo("Rollershutter:", " sends " + receivedCommand)
switch(receivedCommand){
case UP: {
publish("mosquitto","cmnd/bathR/window/shutter/POWER1","ON")
}
case DOWN: {
publish("mosquitto","cmnd/bathR/window/shutter/POWER2","ON")
}
case STOP: {
publish("mosquitto","cmnd/bathR/window/shutter/POWER2","OFF") // will also swithc power1 to of in the physical switch
}
default: {
publish("mosquitto","cmnd/bathR/window/shutter/POWER2","OFF")
}
}
end
How does the mqtt.cfg for the old mqtt binding look like?
Does the log give any clue? For instance, do you get an entry that the new binding connected to the broker? Are the mqtt bridge and the mqtt things online?
I have this eeror warning in the log file:
[WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model ‘MqttBridge.things’ has errors, therefore ignoring it: [5,14]: mismatched input ‘Rollershutter’ expecting RULE_ID
You might need to make a few changes. Compare what you have to the example below.
# URL to the MQTT broker, e.g. tcp://localhost:1883 or ssl://localhost:8883
pibroker.url=tcp://10.0.1.20:1883
# Optional. Client id (max 23 chars) to use when connecting to the broker.
# If not provided a random default is generated.
#<broker>.clientId=<clientId>
# Optional. User id to authenticate with the broker.
pibroker.user=openhab
# Optional. Password to authenticate with the broker.
pibroker.pwd=xxxxxxxxxxxx
Remove the broker, with < and > around it and you should have something like this mosquitto.user=openhab and mosquitto.pwd=xxxxx
rule "bathroom shutter "
when
Item bathR_shutters received command
then
logInfo("Rollershutter:", " sends " + receivedCommand)
switch(receivedCommand){
case UP: {
publish("mosquitto","cmnd/bathR/window/shutter/POWER1","ON")
}
case DOWN: {
publish("mosquitto","cmnd/bathR/window/shutter/POWER2","ON")
}
case STOP: {
publish("mosquitto","cmnd/bathR/window/shutter/POWER2","OFF") // will also swithc power1 to of in the physical switch
}
default: {
publish("mosquitto","cmnd/bathR/window/shutter/POWER2","OFF")
}
}
end
rule "Logeerkamer shutter "
when
Item logeerR_shutters received command
then
logInfo("Rollershutter:", " logeer sends " + receivedCommand)
switch(receivedCommand){
case UP: {
publish("mosquitto","cmnd/logeerR/window/shutter/POWER1","ON")
}
case DOWN: {
publish("mosquitto","cmnd/logeerR/window/shutter/POWER2","ON")
}
case STOP: {
publish("mosquitto","cmnd/logeerR/window/shutter/POWER2","OFF") // will also swith power1 to of in the physical switch
}
default: {
publish("mosquitto","cmnd/logeerR/window/shutter/POWER2","OFF")
}
}
end
rule "Parent room shutter "
when
Item parentsR_shutters received command
then
logInfo("Rollershutter:", "parent room sends " + receivedCommand)
switch(receivedCommand){
case UP: {
publish("mosquitto","cmnd/parentsR/window/shutter/POWER1","ON")
}
case DOWN: {
publish("mosquitto","cmnd/parentsR/window/shutter/POWER2","ON")
}
case STOP: {
publish("mosquitto","cmnd/parentsR/window/shutter/POWER2","OFF") // will also switch power1 to of in the physical switch
}
default: {
publish("mosquitto","cmnd/parentsR/window/shutter/POWER2","OFF")
}
}
end
/*rule "test "
when
Item livingR_shutters1 received command
then
logInfo("Rollershutter:", "test " + receivedCommand)
publish("mosquitto","cmnd/parentsR/window/shutter/POWER2","OFF")
end
*/
rule "All shutters"
when
Item all_shutters received command
then
/* !!!do not use gShutters group because shutters will com into a swicht on off loop!!!
Item all_shutters also belongs to group gShutters, this will then trigger an endless loop*/
gAll_shutters.members.forEach[shutter| shutter.sendCommand(receivedCommand)]
end
rule "All livingroom shutters"
when
Item allLivingR_shutters received command
then
gAllLivingR_shutters.members.forEach[shutterLR| shutterLR.sendCommand(receivedCommand)]
end
I tried it via paperUI. but for me it is very confusing.
I do not see how I can add a state or command topic, it is just possible to add a topic. And it does not work either.
Configuratuon via PaperUi or files?
Using PaperUI the config of the setup of each channel for a generic mqtt thing does show such.
Using an things file, the Example page of the documents would be helpfull.
Does some body know what this sentense mean:
"If you use the Mosquitto broker: Please be aware that there is a relatively low setting for retained messages. At some point messages will just not being delivered anymore: Change the setting " from the example page
That is strange, in the things file the type should start with small first charater for example rollershutters
And in the items files it should start with capital character like Rollershutter.
Or is there a reason for this?
The things and items file syntax is quite old (about 8 years?), and it is not necessarily logical or simple. For now that is all we have, if you don’t want to use the UI.