This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

MQTT Status Problem
#1
Hello,
We are communicating with a relay module via MQTT. When we connect using MQTT Explorer, we send the value 00 00 00 07 to the topic address inels/set/2C6A6F1070CE/106/02EAD5 to set the relay output to true. When we send 00 00 00 06, the relay becomes false.
Meanwhile, we also receive the status information from the topic inels/status/2C6A6F1070CE/106/02EAD5 — if it’s true, the data is 00 00 00 07 00 00, and if it’s false, it’s 00 00 00 06 00 00.
Based on this information, I created two points in the Logic Machine MQTT Client — one for the command and one for the status. The issue is that I can send commands from the Logic Machine, but I can’t transfer the status information back to it. I’ve attached screenshots showing my MQTT Client point settings and the MQTT Explorer view.
What kind of mistake could I be making in the status configuration?

Attached Files Thumbnail(s)
               
Reply
#2
Remove the string conversion and in script for in (from MQTT) log(payload)
See what you get there
------------------------------
Ctrl+F5
Reply
#3
Here are the logs as general and as individiual after log(payload)

Attached Files Thumbnail(s)
           
Reply
#4
It uses new line instead of space for status value. Use a script for status conversion:
Code:
if payload:find('07') then
  return true
elseif payload:find('06') then
  return false
end
Reply
#5
It worked. Thx a lot.
Reply


Forum Jump: