Mqtt bindings not showing up

ok, but it have to be tomorrow … it’s getting very late here … I can’t think straight …:persevere:

Thank’s for the help so far

Now your openhab mqtt.cfg should be 2 lines only:

VERY FIRST LINE OF THE FILE:

pid:org.openhab.mqtt
broker.url=tcp://192.168.178.31:1883

And comment out the user line:
#mosquitto.user=bmentink

Mosquitto.conf information:

copy your mosquitto.conf to mosquitto.conf.bak
edit your mosquitto.conf and remove all the commented stuff except for where you have actual values

You should be left with 10-20 lines

I still get connection issue:
13:41:19.848 [INFO ] [rt.mqtt.internal.MqttBrokerConnection] - Starting MQTT broker         connection 'mosquitto'
13:41:19.899 [ERROR] [openhab.io.transport.mqtt.MqttService] - Error starting broker connection
org.eclipse.paho.client.mqttv3.MqttException: Unable to connect to server
at         org.eclipse.paho.client.mqttv3.internal.TCPNetworkModule.start(TCPNetworkModule.java:7     9) [202:org.openhab.io.transport.mqtt:1.12.0]
at org.eclipse.paho.client.mqttv3.internal.ClientComms$ConnectBG.run(ClientComms.java:650) [202:org.openhab.io.transport.mqtt:1.12.0]
at java.lang.Thread.run(Thread.java:748) [?:?]
Caused by: java.net.ConnectException: Connection refused (Connection refused)
at java.net.PlainSocketImpl.socketConnect(Native Method) ~[?:?]
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) ~[?:?]
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) ~[?:?]
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) ~[?:?]
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[?:?]
at java.net.Socket.connect(Socket.java:589) ~[?:?]
at org.eclipse.paho.client.mqttv3.internal.TCPNetworkModule.start(TCPNetworkModule.java:70) ~[?:?]
... 2 more

I have it working now, I had the IP for the mosquitto server wrong … duh!

So now I have some items and a sitemap setup. However only 3 out of 4 of my items publish/subscribe correctly to the broker … the last item below does not get received by the broker, when I modify the slider in the GUI it changes state according to the log …
Here is the items:

Number LuminousIntensity "accum [%d]" {mqtt=" <[mosquitto:Sensor.Accumulation:state:default]"}
Switch Auto {mqtt=">[mosquitto:Sensor.Manual_Auto:command:ON:1],>[mosquitto:Sensor.Manual_Auto:command:OFF:0]"}
Switch Pump {mqtt=">[mosquitto:Sensor.Pump:command:ON:1],>[mosquitto:Sensor.Pump:command:OFF:0]"}
Dimmer Threshold {mqtt=">[mosquitto:Sensor.Threshold:command:percent:*]"}

and here is the sitemap:

sitemap aeroponics label="My first sitemap"
{
    Frame label="Aeroponics" {
        Text item=LuminousIntensity label="Luminous Accumulation" icon="sun"
        Switch item=Auto label="Auto Mode" icon="switch"
        Switch item=Pump label="Irrigation Pump" icon="switch"
        Slider item=Threshold label="Accumulation Threshold" icon="humidity"
    }
}

any idea’s why the Slider won’t publish?

Dimmer Threshold {mqtt=">[mosquitto:Sensor.Threshold:command:*:default]"}

That’s brillant, works a treat.

Now if I could find out how to show the value of the Slider and the status of the pump. I will be a happy man :slight_smile:
I guess with the pump, I have to create a pump item and subscribe to the pump on/off? But with the slider I expected the gui to show me the vaule of the slider …

Cheers

items:

Dimmer Threshold "Accumulation Threshold [%d]" <humidity> {mqtt=">[mosquitto:Sensor.Threshold:command:*:default]"}

sitemap:

Slider item=Threshold

Thanks, and the Pump Switch? That normally changes color to indicate on/off state when I hit the switch, can I also get it to change color when incoming pump on/off messages are sent? Seems a shame to have to provide a separate indicator for that …

I don’t see any inbound setting for this item

Forgive me for being thick, but how do I add that …?

is it?

 Switch Pump {mqtt=">[mosquitto:Sensor.Pump:command:ON:1], >[mosquitto:Sensor.Pump:command:OFF:0],<[mosquitto:Sensor.Pump:state:*:default] "}

almost :slight_smile:

 Switch Pump { mqtt=">[mosquitto:Sensor.Pump:command:ON:1],>[mosquitto:Sensor.Pump:command:OFF:0],<[mosquitto:Sensor.Pump:state:default]" }

https://www.openhab.org/addons/bindings/mqtt1/

but… this config is not correct since it is using the same topic (Sensor.Pump) for command (outbound) as well as for status (inbound).
Does the pump controller report to MQTT it’s status? (does it publish to a topic? if yes: which topic?)

Thanks, yes the Pump Controller reports the same topic for pump status, will fix that …:grin:

1 Like