Can not write MQTT Engine’s Tag

Hello everyone, I have a problem.

About MQTT Engine Tag.

I use MQTT engine 's tag to read tags from ha HiveMQ Cloud server.
The mqtt tags is sendt from KNX with eelectrons knx/mqtt gateway.

The gateway use subscribe rule and publish rule
image

When I change the tag in KNX it's updated and sendt to
ee/bridge/006c00636903/Instell/RT401_T_SP/sts
and If I use MQTT Explorer and Publish a new value on
ee/bridge/006c00636903/Instell/RT401_T_SP/cmd
It's sendt to KNX.
So KNX to MQTT is working. But It don't support sparkplug.

In Ignition I get the values with MQTT Engine
image
But I have to set the cmd tag to 'Read only = false' and 'Write Permissions = public'

I have check on the gateway config page for engine “Block Node Commands” and “Block Device Commands”. They are false

When I try to write to the tag I get Bad_ReadOnly
image
I have the same user on MQTT Explorer as on Ignition Mqtt Engine server settings

Is there more places I need to look?

This sounds familiar. Check the versions.

I have the 4.0.17 version and Ignition Version: 8.1.27 (b2023042509)

On the download page mqtt version 4.0.17 is linked to ignition version 8.1.28

So I installed mqtt version 4.0.16 that is linked to ignition version 8.1.27.

But still error when I try to write to the tag:(

From the logs

You might want to post on Cirrus Link's own forum, for more focused advice.

If you're bringing in tags from a Custom Namespace, writes don't automatically translate to publishes back to those respective topics. So even if you enable Writable Tags in the MQTT Engine configuration, those writes don't do anything by default. One thing you can do is setup a Tag Change script (triggering on a wildcard off of your custom namespace root tag folder, perhaps ee/bridge/* ?) and then leverage MQTT Engine Python Scripting Functions to publish a message back to the topic. It is a bit hand-cranked, but it can work nicely once assembled.

2 Likes

Sorry for the late replay, but other things happen..

I have setup the name spaces to subscribe to knx brigde


And enabelt write to mqtt. :slight_smile:

And I can now send a new setpoint from ignition to mqtt broker and to KNX
image

So far so good.
I have used Gateway Tag Change Scripts
image

system.cirruslink.engine.publish("HiveMQ Cloud storm elektro", "ee/bridge/006c00636903/Instell/RT401_T_SP/cmd", str("18").encode(), 0, 0)

But the Gateway Tag Change script is not a good way to change a lot of setpoints on room control. Is it a good way to do it in the NumericEntryField ? I can't get ignition to send updates directly to the tag

Kevin C already explained why:

Using the tag change script to publish is the solution for this.

1 Like

OK, I was hoping is was a way to have the script running from a UDT or the tagg.

(Update after some houres)
This is a solution I found to do it if anybody else wounder.

I have tags from knx to the mqtt broker. Some of them are setpoints that I need to send values down to. But they can be change on the KNX side to. If they are updated on the KNX side it's only publish to the sts value. If I want to update them from mqtt I send them on the cmd, but then sts is not updated.
image

image

Inn ignition i made a tag script on value changes
[MQTT Engine]KNX/ee/bridge/006c00636903/Instell/RT401_T_SP/cmd

def valueChanged(tag, tagPath, previousValue, currentValue, initialChange, missedEvents):
	    # Get the value of the [MQTT Engine]KNX/ee/bridge/006c00636903/Instell/RT401_T_SP/cmd tag as a string
		    tag_value = str(system.tag.read("[MQTT Engine]KNX/ee/bridge/006c00636903/Instell/RT401_T_SP/cmd").value)
		    
		    # Construct the MQTT payload with the tag name and its value
		    payload = tag_value.encode('utf-8')

		    # Publish the payload to the MQTT broker
		    system.cirruslink.engine.publish("HiveMQ Cloud storm elektro", "ee/bridge/006c00636903/Instell/RT401_T_SP/sts", payload, 0, 0)				
		    # Publish the payload to the MQTT broker
		    system.cirruslink.engine.publish("HiveMQ Cloud storm elektro", "ee/bridge/006c00636903/Instell/RT401_T_SP/cmd", payload, 0, 0)

and on [MQTT Engine]KNX/ee/bridge/006c00636903/Instell/RT401_T_SP/sts

def valueChanged(tag, tagPath, previousValue, currentValue, initialChange, missedEvents):
    # Get the value of the [MQTT Engine]KNX/ee/bridge/006c00636903/Instell/RT401_T_SP/sts tag as a string
	    tag_value = str(system.tag.read("[MQTT Engine]KNX/ee/bridge/006c00636903/Instell/RT401_T_SP/sts").value)
	    
	    # Construct the MQTT payload with the tag name and its value
	    payload = tag_value.encode('utf-8')
	
	    # Publish the payload to the MQTT broker
	    system.cirruslink.engine.publish("HiveMQ Cloud storm elektro", "ee/bridge/006c00636903/Instell/RT401_T_SP/cmd", payload, 0, 0)

If the sts value is updated from KNX I update the cmd value.
And if I change the cmd value from ignition I update both the sts and cmd value.

Thanks for all the help :slight_smile: