Control Zwave device with MQTT


I have a working MQTT broker and a some working Zwave devices. I want to control the Zwave devices using MQTT. I looked through the forum and the docs and its not obvious how to do it.
What are my options?
I have light switches, so i imagine 2 topics a set and a state , and some thermostats which will have a few more topics.

thanks !

That is because there we have a very good Z-Wave binding and do not need the overhead of MQTT. There are some other free options just starting to explore Z-Wave over MQTT but, in my experience, their device support is not as good as that in our binding.

Even is you had something to go Z-Wave over MQTT you would still need a USB stick or some other Z-Wave radio anyway.

Which mqtt binding do you use? I still use the v1, which gives me the event bus. This exposes all openhab items to a bunch of mqtt topics, so you can external operate on them via mqtt. I believe there is also a way with the V2 version of the mqtt binding, and I can see it publishing a bunch topics, but couldn;t find a simple tutorial that had control and state processing.

I’d let openhab have primary control of the zwave.

In general, you will need a Rule(s) and/or Follow Profiles to forward state changes and commands back and forth.

Do you mean you want “something” to send instructions to openHAB over MQTT, and have openHAB control zwave devices?
You’d create MQTT Items in OH to “listen” forthe incoming instructions, and probably rules to mediate between those and your zwave Items.

Have you considered how to pass status back the other way? Much the same, in reverse, unsuprisingly.

I will give this a thorough reading… thank you
Happy for OH to continue to control the zwave devices. the commands just need to be able to originate and report on MQTT

I’m almost there with this… I can sync via hard coded topics, i just need them to be dynamic based on source now. I am just a little confused where this python in the instructions is supposed to go.

from core.rules import rule

from core.triggers import when

!!! Fill in these variables !!!

eb_out_gr = “PubItems” # name of the Group containing the Items to publish on the bus
eb_name = “openhab-remote” # name of the openHAB instance,
eb_br = “mqtt:broker:mosquitto” # Thing ID for the MQTT Broker Thing

@rule(“Publish Item events”,
description=("Publishes commands and update events for all members of {} "
“to the configured topic”.format(eb_out_gr)),
@when(“Member of {} received command”.format(eb_out_gr))
@when(“Member of {} received update”.format(eb_out_gr))
def pub(event):
is_cmd = hasattr(event, ‘itemCommand’)
msg = str(event.itemCommand if is_cmd else event.itemState)
topic = “{}/out/{}/{}”.format(eb_name, event.itemName,
“command” if is_cmd else “state”)
retained = False if is_cmd else True“Publishing {} to {} on {}”.format(msg, topic, eb_br))
action = actions.get(“mqtt”, eb_br)
if action:
action.publishMQTT(topic, msg, retained)
pub.log.error(“There is no broker thing {}!”.format(eb_br))

Have you set up Scripted Automation with Python? If not see [beta testers wanted!] Jython addon w/ helper libraries (requires OH 2.5.x)

If so see