[Reactor] Bug when sending MQTT boolean payloads
-
Hey @toggledbits.
I found a strange bug while sending boolean MQTT payloads in actions. Latest MQTT/Reactor builds.
Basically, if I send a true/false, it gets logged but it's not sent:
[latest-25328]2025-12-31T11:36:23.958Z <MQTTController:INFO> MQTTController#mqtt x_mqtt.publish publishing foo/cmd/foo payload falseIf I change to ${{ str(1 == 1) }}, it goes thru. No apparent errors in logs.
-
All messages and payloads are text. You literally cannot send a boolean as a payload in MQTT. You have to convert all other types to a text representation.
That said, I will look into why MQTTController isn't doing it automatically for this action. It should.
Sorry for the reply delay... I was at a training event for a week.
Edit/Update: found it. The
x_mqtt.publishaction is handled specially, and that code was missing the default case that would catch and convert non-string/non-object types. The underlying package handles other primitives like Number, but apparently not Booleans. Give me a day or two to settle back in and publish an updated MQTTController. -
Yeah, I think the underlying package has some kind of half-check somewhere, like
if (payload) { ... }to see if a payload is being sent, and that would fail for boolean false and other falsy values, but it doesn't matter, I don't assume the proper conversion below me, and I missed it on the exception case in that action, so there's good permanent fix (for the code... my brain, maybe not so much).









