MQTT BASIC Last Will & Testament


I am getting an ‘Invalid Parameter’ for any ‘Will’ parameters with the MQTT SETPARAM function.

I either get a (5) - invalid parameter or (28) - operation failed

The parameters in question are WillTopic, WillPayload, and WillRetain


Make sure that you are on firmware 14.5PR as support for LWT was just added.

Well that was silly. You are correct. My mistake :slight_smile:

I do still get the ‘Invalid Parameter (5)’ on the ‘WillRetain’ parameter though, after firmware upgrade.
Any insight how to get this to work with a Mosquitto broker? I am receiving “No will message specified” on the broker when the Flexy connects.

Relevant Code:

TopicToWill$ = EwonName$ + “/” + SerNum$ + “/sts”
//MQTT “SETPARAM”, “WillRetain”, 1
MQTT “SETPARAM”, “WillTopic”, TopicToWill$
MQTT “SETPARAM”, “WillPayload”, “Not Connected”


I have not tested this yet, but according to the release notes, only WillTopic and WillPayload parameters were added:

ADDED [FLEXY] MQTT: Last will & testament parameters added (WILLTOPIC, WILLPAYLOAD parameters added)

I will have to check with the developers on this. Have you posted this question on the Ewon Developer Forum?

No, but I can do that.

Also, for any future lurkers, I had to make “WillRetain” have a string value of “1”, not integer of 1.


Thank you for sharing this!

I’m going to open a case for this in our ticketing system as well to get some more info from the devs, so you will get an email stating that a case has been opened. I’ll let you know when I hear back.