MQTT Manual Publish, Is the Sequence ID "permanent"?

Hi Guys,

I´m using a manual MQTT approach from an ESP8266
(Using the PubSUb library), and btw everything is working fine.

The actual Cayenne mqtt message payload (Actuator Command) consists of:
a Sequence Identifier followed by the actual Value (0 = Off, 1 = On)
For example: “2etaExGxnMJz1NQ,0”.
(I´ve “grabbed” it using MQTT.fx)

Is that “Sequence Identifier” permanent and unique?
Or it might change with time?

Thanks!

From what I have seen the sequence identifier changes with every message, so unique but nor permanent.

Thanks Adam!

I´m just disregarding that part of the string, and it does the trick!
Just read they payload´s character position number 17, which is the “state” value, using an IF function…

if ((char)payload[16] == ‘0’)
or
if ((char)payload[16] == ‘1’)

Works like a charm… :wink:
Thanks again.

Cheers!
Marc

What language are you using? I would recommend using a split to ensure if the length of the sequence ever changes you don’t get errors. In python this is what I use:

message.payload.split(',')[1]

1 Like

Umm… I see, that´s a very good point!

I´ll try to figure how to do it in C++ (Arduino IDE)…
Shouldn´t be that hard.

Thanks!