Revisiting Project - MQTT Binding issue? No updates seen

Briefly:

Items:

Group All

Group gGroundFloor

Group GF_Laundry "Laundry Room" <video> (gGroundFloor)

Number washer "Washer [%s]" (ALL) {mqtt="<[mymisquitto:home/laundry/washer:state:default]"}

Rules:

`rule "Washer Complete"
when
    Item washer received update
then
    logInfo("Washer", "Washer state at beginning of rules: " + washer.state.toString)
    if((washer.state as DecimalType) == 1) {
        logInfo("Washer", "Washer is finished")
        say("Washer Complete!")
        sendMail("oddlogic@gmail.com", "Washer is finished", "Yay! Clean clothes!")
    }
    else if((washer.state as DecimalType) == 0) {
        logInfo("Washer", "Washer is not finished")
    }

    logInfo("Washer", "Washer rule completed")
end`

Sitemap:

sitemap home label="Home"
{
Frame    {
        Text label="Laundry Room" icon="firstfloor"
                  {
                  Text item=washer
                  }
         }
 }

I start openHAB in debug mode and get this:

I have followed tutorials that use apt-get for both openHAB and mosquitto. I am seeing published events on the channel in mosquitto. I am not getting any events logged by openHAB after the broker reads the event in a separate window.

Any help provided is much appreciated.

B-

Could you share the mqtt part of your openhab.cfg? I see in your screen grab that the MQTT event bus binding is running – what are you using it for?

Sure, Watou!

I am using an MCU and an RF24 transceiver to transmit data to the RPi. I have a C program running in the background that constantly scans for a message on the RF24. Once seen, it publishes the payload to the channel /home/laundry/washer. I have subscribed to the channel that the program publishes to in another terminal window and see that mosquitto is successfully publishing the correct payload. Right now I am only sending 0, 1, or 2, hence the use of the “Number” type in openHAB.

I used the apt-get method to install the mqtt binding and I have the appropriate add-on in the correct folder. I verified that the sitemap works as it should by installing the http and ntp bindings and using the demo. It does indeed pull weather and date information, as it should.

So with the event being seen in the terminal window, and openHAB publishing weather data correctly, I think I can rule out all other facets of transmission. We see the data published via the broker. The question is, why isn’t openHAB seeing it? I can only surmise that something is wrong with the binding.

Thanks,

b-

Sorry. that’s the mosquitto.conf. You wanted the openHAB mqtt section. Here it is:

There might be one or two more lines, but that should be everything that I have modified.

I think your item binding references the non-existent “mymisquitto” when you’ve defined (correctly spelled) “mymosquitto” in openhab.cfg. Change your item binding to match and it ought to work!

Great Success-Ah!

I can’t believe that I didn’t catch that before. I even told myself today that I needed to look over spellings used in both the config and items, but I got sidetracked with a few other things! Anyway, thanks for finding this annoying little typo. I think this is why I ultimately went and re-installed everything. It was this ONE LITTLE THING that I didn’t see.

Thanks to both you and Rich. You’ve both been really great in helping newbs such as myself. I was here a few weeks back and you both got me this far. As you can see I’ve learned a lot and was able to implement a lot of my newfound knowledge. The documentation is starting to make more sense to me now, and I have several projects in mind for going forward.

All of this to say…thanks!

Brad

1 Like

Great! Now if you can change the code that publishes 1’s and 0’s to publish ON or OFF, your openHAB washer item could be a Switch item. Of you could replace default with MAP(onoff.map) and map the 1 to ON and 0 to OFF. Or you could just enjoy the fact that this is all coming together! :smile:

1 Like

I plan on doing exactly what you said. I just wanted to first get information feeding through before adding the complication of a site map. Great suggestion though!

Next I have an interactive project with a blower on a smoker outside with temperature feedback control and persistence data logging. I just wanted something simple before I moved on. Thanks again!

1 Like