how to inverse MQTT payload

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
agroszer
Normal user
Posts: 28
Joined: 02 Jan 2023, 16:36

how to inverse MQTT payload

#1 Post by agroszer » 29 Oct 2023, 19:07

Trying to make a relay work over MQTT. MQTT import works fine, but would be nice to invert the payload of the MQTT message not to go insane.

This works just fine:

Code: Select all

on mqtt#venti1 do
  logentry,"venti1 %eventvalue%"
  pcfgpio,8,%eventvalue%
endon
I hoped "1-value" would work, but apparently the parameter is not evaluated just the template expanded:

Code: Select all

on mqtt#venti1 do
  logentry,"venti1 %eventvalue%"
  pcfgpio,8,1-%eventvalue%
endon
Any hints appreciated.

User avatar
Ath
Normal user
Posts: 3522
Joined: 10 Jun 2018, 12:06
Location: NL

Re: how to inverse MQTT payload

#2 Post by Ath » 29 Oct 2023, 19:15

A simple 0/1 value can be inverted by using the Let statement and the ! (not) operator:

Code: Select all

  Let,1,!%eventvalue1%
  pcfgpio,8,[int#1]
/Ton (PayPal.me)

agroszer
Normal user
Posts: 28
Joined: 02 Jan 2023, 16:36

Re: how to inverse MQTT payload

#3 Post by agroszer » 29 Oct 2023, 20:47

thanks

Post Reply

Who is online

Users browsing this forum: No registered users and 29 guests