Publish to topics using system.cirruslink.engine.publish()


This post might be a bit far fetched. But I am hoping that some of you might just know what I need.

I have flashed an ESP8266 device (NodeMCU) with Tasmota ( This allows me to connect the NodeMCU to the MQTT Distributor module and then in turn see the device in the designer using the MQTT Engine. I see the information about the device coming in through the MQTT Engine without a problem - I had to configure a custom namespace though.

Here is an image of the information coming in:

Tasmota supports different commands through a MQTT publish to specific a topic.
Here I have tried to use the system.cirruslink.engine.publish() function. However it needs the payload as an byte array. Which would be the command name itself. I have tried to use the function bytearray() like this:

system.cirruslink.engine.publish(“LocalMQTT”, “cmnd/DVES_177FF2_fb/”, str(‘power’).encode(), 0 ,0)

However, this gives me an status message on the device:
Which indicates that the command was not published/converted properly.

If I run the same command in the Tasmota console I get this:

Here is my Miscellaneous section of the general tab in the config of the MQTT Engine:

Where you can see that I have un-checked the blocking of device and node commands.

So anyone of you who would know how to ensure a correct payload like “power” to be published to a topic like cmnd/DVES_177FF2_fb?
Is there any other ways to publish to topics other than using system.cirruslink.engine.publish()?
Do the system.cirruslink.engine.publish() require the namespace of sparkplug to be used?

If any additional information is needed please let me know and I will try to provide as much as possible.


Your problem is that jython is python 2.7.x, which uses strings for byte arrays. But strings in jython are really java strings, not byte arrays. So the .encode() method isn’t actually giving you a byte array. You’ll need to use the .getBytes() method from java’s actual String type.

1 Like

Hi Pturmel,

Thank you for your reply.

I found a solution.

I tried your solution without any success like this:

import java
system.cirruslink.engine.publish(“LocalMQTT”, “cmnd/DVES_177FF2_fb/”, java.lang.String(“power0 0”).getBytes() , 0 ,0)

Still the same response with unknown command…

However, after downloading the MQTT client, MQTT.fx, I found that I wrote the command wrong - typical…

I had to publish to the correct topic and not just the Fallback Topic of the device. So after altering my code to this:

system.cirruslink.engine.publish(“LocalMQTT”, “cmnd/DVES_177FF2_fb/power0”,bytearray(“0”) , 0 ,0)

It worked like a charm.

The solution you suggested also worked like this:

import java
system.cirruslink.engine.publish(“LocalMQTT”, “cmnd/DVES_177FF2_fb/power0”, java.lang.String(“0”).getBytes() , 0 ,0)