Mosquito/mqtt files missing

Hello all,

Still new and learning, so please forgive me if this problem is dumb.

I’m following the MK-Smarthouse guide to setup MQTT with the ultimate goal to control a Sonoff S31 running Tasmota. The device flash went well and is on my network and I configured MQTT using the Tasmota web interface to point to the server.

Now I’m attempting to configure OpenHAB. I SSH into openhabian, updated and installed mosquito. I then went into paperUI and installed the binding. I attempted to use MQTTfx to test the server and it won’t connect. I then went to my log viewer and can’t find anything regarding MQTT or Mosquito. I then used filezilla to check the etc/openhab2/services folder for a MQTT service, but it is missing. It’s like it didn’t install anything…

Can anyone spot something I did wrong or point me where to look for problems?

Should I skip the MQTT path and just set this up as a hue or WeMo device?

-Viper

First guess, the guide used is not up to date with mqtt 2 binding.
Which binding did you install and how did you configure it. Without that data we can only guess!
The connect between mqttfx and mosquito however should be possible no matter what you did with openhab!

And lastly, go for mqtt!

I used binding-mqtt - 2.4.0. I didn’t do any further configuration since the guide didn’t specify anything within paperUI.

You can still use the mqtt 1.x binding if you like. Just enable legacy bindings in PaperUI and you will then have the option to install the 1.x binding. Wouldn’t hurt to learn both bindings.:wink:

Is there any advantage to the 1.x binding?

I’m not sure that Mosquito is even installed/running since I cant connect with MQTTfx nor does there seem to be any services set up in the service folder.

I’m still using the 1.x binding and playing with the 2.x so for me it’s undecided.

Have you installed the broker via openhabian-config tool? You will have the /etc/openhab2/serevices/mqtt.cfg file once you install the 1.x binding.

No, that may be my problem. How do I do this? looking in PaperUI, i see services MQTT system broker connection with a manage button. Clicking it only gives me a save option. Looking in bindings, I see MQTT Thing Binding, but no options to configure.

If your planning to use the 2.x binding then you can select the embedded mqtt broker.

If your wanting to use the 1.x binding then you can install using the openhabian-config tool.

Here’s a good link for the 2.x binding.

If your just starting out with mqtt I would recommend picking one mqtt binding. Get that one working then learn the other.

Found half my issue. I see the broker setup now. Registers as running after putting in localhost for ip, port 1883, username and password, but i’m still missing something. Created a generic mqtt device and was able to connect to it using mqtt.fx. Now, just need to find a more accurate guide to setup the IO for the binding. Not sure wat to put into the MQTT State topic and MQTT Command topic.

Search the forum, there are several examples. Since your using sonoff devices here’s a good start.

Ok, getting frusterated now. I got the server online. I think I successfully linked the tasmota sonoff s31 to the binding since used mqtt.fx and subscribed to the channel and watched state changes as I switched the S31 via the physical switch. I can’t seem to figure out how to create button on habpannel since there is no option to select the mptt thing. What am I missing?

I read several threads on how to configure mqtt, but it seams most of them are for the old 1.x binding and the code has changed. THe linked thread had some examples of code, but didn’t provide full explanation of what files needed to be created and assumed you came from a 1.x configuration.

That sounds as if you have a mqtt broker worker working and the mqttfx can monitor the switch sending messages.
However besides the installed binding you are missing the mqtt setup.
Did you follow the link posted by @H102?
If yes, show your .things and .items files. If no, then do it now!

I pretty much did a copy/past of the code only changing my login information in the things file. I know that i’m going to have to replace a piece of this code with my Sonoff S31 client ID name which is AP1 for now, just haven’t figured out where that goes yet.

The following is my Sonoff.Items file:

Group  GF_Sonoff_S20           "Sonoff S20"                                   <sonoff_s20_uk> (Sonoff_S20)
String GF_Sonoff_S20_Reachable "Reachable: [%s]"                   <contactable>   (GF_Sonoff_S20) { channel="mqtt:topic:mosquitto:sonoffs20:reachable" }
Switch GF_Sonoff_S20_Power     "Power"                                   <sonoff_s20_uk> (GF_Sonoff_S20) { channel="mqtt:topic:mosquitto:sonoffs20:power" }       
Number GF_Sonoff_S20_RSSI      "WiFi Signal Strength [%d %%]"      <wifi>          (GF_Sonoff_S20) { channel="mqtt:topic:mosquitto:sonoffs20:rssi" }

Group  FF_Sonoff_B1            "Sonoff B1"                                    <sonoff_b1>     (Sonoff_B1)
String FF_Sonoff_B1_Reachable  "Reachable: [%s]"                    <contactable>   (FF_Sonoff_B1)  { channel="mqtt:topic:mosquitto:sonoffb1:reachable" }
Switch FF_Sonoff_B1_Power      "Power"                              <light>         (FF_Sonoff_B1)  { channel="mqtt:topic:mosquitto:sonoffb1:power" }
Switch FF_Sonoff_B1_Fade       "Fade: [%s]"                         <fade_out>      (FF_Sonoff_B1)  { channel="mqtt:topic:mosquitto:sonoffb1:fade" }
Dimmer FF_Sonoff_B1_Dimmer     "Dimmer"                             <brightness>    (FF_Sonoff_B1)  { channel="mqtt:topic:mosquitto:sonoffb1:dimmer" }
String FF_Sonoff_B1_Mode       "Mode: [MAP(spotlightmode.map):%s]"  <colorlight>    (FF_Sonoff_B1)  { channel="mqtt:topic:mosquitto:sonoffb1:mode" }
Color  FF_Sonoff_B1_ColorHSB   "Colour [%s]"                        <colorlight>    (FF_Sonoff_B1)  { channel="mqtt:topic:mosquitto:sonoffb1:colour" }
Number FF_Sonoff_B1_RSSI       "WiFi Signal Strength [%d %%]"       <wifi>          (FF_Sonoff_B1)  { channel="mqtt:topic:mosquitto:sonoffb1:rssi" }

Group  FF_Sonoff_POW           "Sonoff POW"                                   <sonoff_pow>    (Sonoff_POW)
String FF_Sonoff_POW_Reachable "Reachable: [%s]"                   <contactable>   (FF_Sonoff_POW) { channel="mqtt:topic:mosquitto:sonoffpow:reachable" }
Switch FF_Sonoff_POW_Power     "Power []"                          <sonoff_pow>    (FF_Sonoff_POW) { channel="mqtt:topic:mosquitto:sonoffpow:power" }
Number FF_Sonoff_POW_Load      "Power load [%.1f W]"               <voltage>       (FF_Sonoff_POW) { channel="mqtt:topic:mosquitto:sonoffpow:powerload" }
Number FF_Sonoff_POW_Voltage   "Line voltage [%.1f V]"             <voltage>       (FF_Sonoff_POW) { channel="mqtt:topic:mosquitto:sonoffpow:voltage" }
Number FF_Sonoff_POW_Current   "Line current [%.3f A]"             <current>       (FF_Sonoff_POW) { channel="mqtt:topic:mosquitto:sonoffpow:current" }
Number FF_Sonoff_POW_Today     "Total energy today [%.3f kWh]"     <total_energy>  (FF_Sonoff_POW) { channel="mqtt:topic:mosquitto:sonoffpow:total" }
Number FF_Sonoff_POW_Yesterday "Total energy yesterday [%.3f kWh]" <total_energy>  (FF_Sonoff_POW) { channel="mqtt:topic:mosquitto:sonoffpow:totalyest" }
Number FF_Sonoff_POW_RSSI      "WiFi Signal Strength [%d %%]"      <wifi>          (FF_Sonoff_POW) { channel="mqtt:topic:mosquitto:sonoffpow:rssi" }

Group  GF_Sonoff_SC             "Sonoff SC"                                   <sonoff_sc>     (Sonoff_SC)
String GF_Sonoff_SC_Reachable   "Reachable: [%s]"                   <contactable>   (GF_Sonoff_SC) { channel="mqtt:topic:mosquitto:sonoffsc:reachable" }
Number GF_Sonoff_SC_Temperature "Temperature [%d °C]"               <temp>          (GF_Sonoff_SC) { channel="mqtt:topic:mosquitto:sonoffsc:temperature" }
Number GF_Sonoff_SC_Humidity    "Humidity [%d %%]"                  <humidity>      (GF_Sonoff_SC) { channel="mqtt:topic:mosquitto:sonoffsc:humidity" }
Number GF_Sonoff_SC_Light       "Light [%d %%]"                     <light>         (GF_Sonoff_SC) { channel="mqtt:topic:mosquitto:sonoffsc:light" }
Number GF_Sonoff_SC_Noise       "Noise [%d %%]"                     <microphone>    (GF_Sonoff_SC) { channel="mqtt:topic:mosquitto:sonoffsc:noise" }
Number GF_Sonoff_SC_AirQuality  "Air Quality [%d %%]"               <air_quality>   (GF_Sonoff_SC) { channel="mqtt:topic:mosquitto:sonoffsc:airquality" }
Number GF_Sonoff_SC_RSSI        "WiFi Signal Strength [%d %%]"      <wifi>          (GF_Sonoff_SC) { channel="mqtt:topic:mosquitto:sonoffsc:rssi" }

Group  GF_Sonoff_RF                "RF Bridge"                                <sonoff_rf>     (Sonoff_RF)
String GF_Sonoff_RF_Reachable      "Reachable: [%s]"                <contactable>   (GF_Sonoff_RF) { channel="mqtt:topic:mosquitto:sonoffrf:reachable" }
String GF_Sonoff_RF_Received_Data  "Received Data: [%s]"            <none>          (GF_Sonoff_RF) { channel="mqtt:topic:mosquitto:sonoffrf:recieveddata" }
String GF_Sonoff_RF_Received_Sync  "Received Sync: [%s]"            <none>          (GF_Sonoff_RF) { channel="mqtt:topic:mosquitto:sonoffrf:recievedsync" }
String GF_Sonoff_RF_Received_Low   "Received Low: [%s]"             <none>          (GF_Sonoff_RF) { channel="mqtt:topic:mosquitto:sonoffrf:recievedlow" }
String GF_Sonoff_RF_Received_High  "Received High: [%s]"            <none>          (GF_Sonoff_RF) { channel="mqtt:topic:mosquitto:sonoffrf:recievedhigh" }
String GF_Sonoff_RF_Received_RfKey "Received RfKey: [%s]"           <none>          (GF_Sonoff_RF) { channel="mqtt:topic:mosquitto:sonoffrf:recievedrfkey" }
Switch GF_Sonoff_RF_Button_1       "Button 1"                       <none>          (GF_Sonoff_RF) { channel="mqtt:topic:mosquitto:sonoffrf:button1", autoupdate="false"}
...
Switch GF_Sonoff_RF_Button_16      "Button 16: [%s]"                <none>          (GF_Sonoff_RF) { channel="mqtt:topic:mosquitto:sonoffrf:button16", autoupdate="false"}
Number GF_Sonoff_RF_RSSI           "WiFi Signal Strength [%d %%]"   <wifi>          (GF_Sonoff_RF) { channel="mqtt:topic:mosquitto:sonoffrf:rssi" }

This is my MQTT.things

Bridge mqttbrokermosquitto Mosquitto [ host=localhost, port=1883, secure=false, username=MQTT, password=NonOfYourBusiness, clientID=Replanced_with_My_ID_in_broker ]
{
     Sonoffs
    Thing topic sonoffs20 Sonoff S20 @ Some Room {
    Channels
        Type string  reachable Reachable            [ stateTopic=telesonoff-s20LWT ]
        Type switch  power     Power                [ stateTopic=statsonoff-s20POWER, commandTopic=cmndsonoff-s20POWER ]
        Type number  rssi      WiFi Signal Strength [ stateTopic=telesonoff-s20STATE, transformationPattern=JSONPATH$.Wifi.RSSI]
    }

    Thing topic sonoffb1 Sonoff B1 @ Some Room {
    Channels
        Type string    reachable  Reachable            [ stateTopic=telesonoff-b1LWT ]
        Type switch    power      Power                [ stateTopic=statsonoff-b1POWER, commandTopic=cmndsonoff-b1POWER ]
        Type switch    fade       Fade                 [ stateTopic=telesonoff-b1STATE, commandTopic=cmndsonoff-b1FADE, transformationPattern=JSONPATH$.Fade ]
        Type dimmer    dimmer     Dimmer               [ stateTopic=telesonoff-b1STATE, commandTopic=cmndsonoff-b1DIMMER, transformationPattern=JSONPATH$.Dimmer ]
        Type string    mode       Mode                 [ stateTopic=telesonoff-b1STATE, commandTopic=cmndsonoff-b1SCHEME, transformationPattern=JSONPATH$.Scheme ]
        Type colorHSB  colour     Colour               [ stateTopic=telesonoff-b1STATE, commandTopic=cmndsonoff-b1HSBColor, transformationPattern=JSONPATH$.HSBColor ]
        Type number    rssi       WiFi Signal Strength [ stateTopic=telesonoff-b1STATE, transformationPattern=JSONPATH$.Wifi.RSSI]
    }

    Thing topic sonoffpow Sonoff POW @ Some Other Room {
    Channels
        Type string  reachable Reachable              [ stateTopic=telesonoff-powLWT ]
        Type switch  power     Power                  [ stateTopic=statsonoff-powPOWER, commandTopic=cmndsonoff-powPOWER ]
        Type number  powerload Power load             [ stateTopic=telesonoff-powSENSOR, transformationPattern=JSONPATH$.ENERGY.Power]
        Type number  voltage   Line voltage           [ stateTopic=telesonoff-powSENSOR, transformationPattern=JSONPATH$.ENERGY.Voltage]
        Type number  current   Line current           [ stateTopic=telesonoff-powSENSOR, transformationPattern=JSONPATH$.ENERGY.Current]
        Type number  total     Total energy today     [ stateTopic=telesonoff-powSENSOR, transformationPattern=JSONPATH$.ENERGY.Today]
        Type number  totalyest Total energy yesterday [ stateTopic=telesonoff-powSENSOR, transformationPattern=JSONPATH$.ENERGY.Yesterday]
        Type number  rssi      WiFi Signal Strength   [ stateTopic=telesonoff-powSTATE, transformationPattern=JSONPATH$.Wifi.RSSI]
    }

    Thing topic sonoffsc Sonoff SC @ Another Room {
    Channels
        Type string  reachable   Reachable            [ stateTopic=telesonoff-scLWT ]
        Type number  temperature Temperature          [ stateTopic=telesonoff-scSENSOR, transformationPattern=JSONPATH$.SonoffSC.Temperature]
        Type number  humidity    Humidity             [ stateTopic=telesonoff-scSENSOR, transformationPattern=JSONPATH$.SonoffSC.Humidity]
        Type number  light       Light                [ stateTopic=telesonoff-scSENSOR, transformationPattern=JSONPATH$.SonoffSC.Light]
        Type number  noise       Noise                [ stateTopic=telesonoff-scSENSOR, transformationPattern=JSONPATH$.SonoffSC.Noise]
        Type number  airquality  Air Quality          [ stateTopic=telesonoff-scSENSOR, transformationPattern=JSONPATH$.SonoffSC.AirQuality]
        Type number  rssi        WiFi Signal Strength [ stateTopic=telesonoff-scSTATE, transformationPattern=JSONPATH$.Wifi.RSSI]
    }

    Thing topic sonoffrf RF Bridge @ Yet Another Room {
        Type string  reachable     Reachable            [ stateTopic=telesonoff-rfLWT ]
        Type string  recieveddata  Received Data        [ stateTopic=telesonoff-rfRESULT, transformationPattern=JSONPATH$.RfReceived.Data]
        Type string  recievedsync  Received Sync        [ stateTopic=telesonoff-rfRESULT, transformationPattern=JSONPATH$.RfReceived.Sync]
        Type string  recievedlow   Received Low         [ stateTopic=telesonoff-rfRESULT, transformationPattern=JSONPATH$.RfReceived.Low]
        Type string  recievedhigh  Received High        [ stateTopic=telesonoff-rfRESULT, transformationPattern=JSONPATH$.RfReceived.High]
        Type string  recievedrfkey Received RfKey       [ stateTopic=telesonoff-rfRESULT, transformationPattern=JSONPATH$.RfReceived.RfKey]
        Type switch  button1       Button 1             [ stateTopic=statsonoff-rfRESULT, commandTopic=cmndsonoff-rfRFKEY1, transformationPattern=JSONPATH$.RfKey1 ]
        ...
        Type switch  button16      Button 16            [ stateTopic=statsonoff-rfRESULT, commandTopic=cmndsonoff-rfRFKEY16, transformationPattern=JSONPATH$.RfKey16 ]
        Type number  rssi          WiFi Signal Strength [ stateTopic=telesonoff-rfSTATE, transformationPattern=JSONPATH$.Wifi.RSSI]
    }
}

This is my sonoff.sitemap file:

sitemap default label="Some Place" {
    Frame label="Ground Floor" icon="groundfloor" {

        Group item=GF_Sonoff_S20 label="Some Adapter" 

        Group item=GF_Sonoff_SC label="Some Sensors" {
            Text item=GF_Sonoff_SC_Reachable label="Status [%s]"
            Text item=GF_Sonoff_SC_Temperature label="Temperature [%d °C]"
            Text item=GF_Sonoff_SC_Humidity label="Humidity [%d %%]"
            Text item=GF_Sonoff_SC_Light label="Light [%d %%]"
            Text item=GF_Sonoff_SC_Noise label="Noise [%d %%]"
            Text item=GF_Sonoff_SC_AirQuality label="Air Quality [%d %%]"
            Text item=GF_Sonoff_SC_RSSI label="WiFi Signal Strength [%d %%]"
        }

        Group item=GF_Sonoff_RF {
            Text item=GF_Sonoff_RF_Reachable label="Status [%s]"
            Text item=GF_Sonoff_RF_Received_Data label="Data [%s]"
            Text item=GF_Sonoff_RF_Received_Sync label="Sync [%s]"
            Text item=GF_Sonoff_RF_Received_Low label="Low [%s]"
            Text item=GF_Sonoff_RF_Received_High label="High [%s]"
            Text item=GF_Sonoff_RF_Received_RfKey label="RfKey [%s]"
            Switch item=GF_Sonoff_RF_Button_1 label="RfKey1" mappings=[ON="Key 1"]
            ...
            Switch item=GF_Sonoff_RF_Button_16 label="RfKey16" mappings=[ON="Key 16"]
            Text item=GF_Sonoff_RF_RSSI label="WiFi Signal Strength [%d %%]"
        }
    }
    
    Frame label="First Floor" icon="firstfloor" {
        Group item=FF_Sonoff_B1 label="Some Light" {
            Text item=FF_Sonoff_B1_Reachable label="Status [%s]"
            Switch item=FF_Sonoff_B1_Power label="Power"
            Switch item=FF_Sonoff_B1_Fade label="Fade"
            Slider item=FF_Sonoff_B1_Dimmer label="Brightness [%d]"
            Selection item=FF_Sonoff_B1_Mode label="Color Mode" mappings=["0"="Single Color", "1"="Wake up", "2"="Slow Cycle", "3"="Fast Cycle", "4"="Disco"]
            Colorpicker item=FF_Sonoff_B1_ColorHSB label="Colour"
            Text item=FF_Sonoff_B1_RSSI label="WiFi Signal Strength [%d %%]"
        }

        Group item=FF_Sonoff_POW {
            Text item=FF_Sonoff_POW_Reachable label="Status [%s]"
            Switch item=FF_Sonoff_POW_Power label="Power []"
            Text item=FF_Sonoff_POW_Load label="Power load [%.1f W]"
            Text item=FF_Sonoff_POW_Voltage label="Line voltage [%.1f V]"
            Text item=FF_Sonoff_POW_Current label="Line current [%.3f A]"
            Text item=FF_Sonoff_POW_Today label="Total energy today [%.3f kWh]"
            Text item=FF_Sonoff_POW_Yesterday label="Total energy yesterday [%.3f kWh]"
            Text item=FF_Sonoff_POW_RSSI label="WiFi Signal Strength [%d %%]"
        }
    }
}

Am I not finding it in habpanel because I didn’t define the proper rooms?

Possibly but not sure as I use BasciUI over habpanel.

After making the change to the sitemap file did you try restarting OH?

Yes, I reboot after every change to the file structure.

I think your openhab setup isn’t working at all because the broker and things aren’t created correctly.

The first line needs to read:

Bridge mqt:broker:mosquitto ......
That should correctly create the broker thing with the name “mosquitto”. Yes starting with a “m” because you use it that way in the .items file.

The other things need some " " around the label and location like this:
Thing topic sonoffb1 "Sonoff B1" @ "Some Room" {...

These are the changes needed I do see. After saving you will probably need to restart ( a known bug already resolved in the snapshot releases).
After a restart your things should correctly show on PaperUI Control under the location Sonoff Room. If I didn’t miss something.
Regarding habpanel it is not clear what you can’t achieve. IMHO you can select any item to show on habpanel, even if it isn’t linked at all. What kind of widget do you want to display? But consider asking that in a separate thread.

@opus are the :'s like below needed as well?

Thing topic sonoffs20 "Sonoff S20" @ "Some Room" {
    Channels
        Type string :  reachable Reachable            [ stateTopic=telesonoff-s20LWT ]
        Type switch :  power     Power                [ stateTopic=statsonoff-s20POWER, commandTopic=cmndsonoff-s20POWER ]
        Type number :  rssi      WiFi Signal Strength [ stateTopic=telesonoff-s20STATE, transformationPattern=JSONPATH$.Wifi.RSSI]
    }
1 Like

Thanks, the : are needed, BUT I think the label needs to be surrounded by “” again.

Type string : reachable "Reachable" ....

1 Like

Yep, I missed that one.:laughing: Good catch.:+1: