Sending command over Mqtt to OpenHAB

Hi,
actually I’m trying to setup the Mqtt binding for my OpenHAB installation.

Sending the current command or state from my Rollershutter item to my Mqtt broker works.

Now I’m looking for sending a command from a client over Mqtt to OpenHAB2 to control my Rollershutter.

I’m not sure if I have to configure an inbound and set the type to STATE or to COMMAND. The item documentation for a Rollershutter shows three different command types: upDown, stopMove and Percent.

My goal is to send a Percent value (0-100) over Mqtt to my Rollershutter.
Here is my first not working try:

Rollershutter Rollladen_UG_links {mqtt="<[mosquitto:rolladen/links/eingang:command:*]"}

Can anybody show me an example setting command or state?! to control/update the Rollershutter?

Thank you :grinning:

Cheers!
Christian

Welcome on board…
Maybe this helps: Using MQTT Binding on OpenHAB 2

1 Like

Thank you :slight_smile:

Thanks for link.

Sadly it still does not work.

Following config is set:

Rollershutter Rollladen_UG_links {mqtt=">[mosquitto:rolladen/links:command:*:default],>[mosquitto:rolladen/links:state:*:default],<[mosquitto:rolladen/links/cmd/:state:*:default]"}

The concrete inbound
<[mosquitto:rolladen/links/cmd/:state:*:default]
I have also tried it using the state instead of command but nothing happens. Also no log entry will be written.

I have found a solution:

<[mosquitto:rolladen/links/cmd:command:default]

After removing the * and switching from state to command, the rollershutter will follow the given command over MQTT.

The last thing is, that inside the sitemap the percentage value at the “Default” Item for the Rollershutter wont be updated (only after a page refresh) instead of a switch, that will change the state automatically without a page refresh.

Cheers!
Christian

Good to hear you worked it out… was going to say I am still on OH1 and not familair with v2; but noticed that my commands look liek this:

{mqtt="<[mymosquitto:weewx_weather/outHumidity:state:default]"}

and out:

{mqtt=">[mymosquitto:ArgyleCourt/House/Master/Light_House_Master_Bed_North/Blue:state:*:default]"}

An easier approach is to take advantage of the Node that @Peter_De_Mangelaere has been working on: Node-RED as a rule/script engine for OpenHAB

Thanks for the link to the node red approach. I’m following an alternative path:

I’m a software developer with a huge focus at process automation using BPM platforms. Concrete Camunda which provides three different engines for BPMN (structured processes), CMMN (cases)and DMN(business rules). At the first time I have written a simple API to communicate with homematic components, but this costs to much time. So there I’m interested in OpenHAB2 to easily control smart home components and can create simply some UI using sitemaps for manual mode. OpenHAB s own rule engine is not my preferred way. So here for me the easiest way is to use Mqtt as communication between the components. If someone is interested in, have a closer look to https://github.com/Chris81T/camunda-bpm-iot

This project allows using the Camunda engines as embedded engines without a jee container or spring. Also a MqttService is integrated to give options to bind inbound Mqtt messages with BPMN message receive events or so. It is still under development. After resolving this mqtt problem here I can concentrate finishing a first working version.

In my approach I will integrate this in a wildfly swarm project to create a small Uber jar, that will run as a Linux service on my pi and will hold my smart home business logic like a microservice.

1 Like

I’ve also come to realize that I was under the false impression that node-RED set on top of mqtt vs being totally independent from it (though can interface to it), so nevermind…