Logic Machine Forum
MQTT Client app - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Application Store (https://forum.logicmachine.net/forumdisplay.php?fid=11)
+--- Thread: MQTT Client app (/showthread.php?tid=5609)

Pages: 1 2 3


RE: MQTT Client app - myg - 16.01.2025

suddenly with today's auto update mqtt client stopped working for multiple instances. Rolling back to older released helped. In error log i can see initialization error for all objects in the rules. It seems i was too naive to have auto update enabled on LM, this update broke critical functionality right in the evening.
What happend with quality control for releases? i don't remember anything like that before.
   


RE: MQTT Client app - admin - 17.01.2025

@myg, an update has been published, see if it fixes the issue for you.


RE: MQTT Client app - myg - 19.01.2025

(17.01.2025, 07:54)admin Wrote: @myg, an update has been published, see if it fixes the issue for you.

works again, thank you for quick update


RE: MQTT Client app - Pierluigi - 28.03.2025

Good morning,

I’m trying to use the Logic Machine 5 Lite for integrating a MQTT payload message.

This is a typically Topic/Payload we receive:

Topic: callway/ad75adfd-b72a-4119-a34c-dfb372df9ecf/status/1/1 QoS: 2
{"data":[{"position":0,"position_type":"room","room":1,"status":"assistance","timestamp":"2025-03-28T10:01:06.000Z","ward":1}],"timestamp":"2025-03-28T11:29:16.000Z","type":"snapshot","uuid":"ad75adfd-b72a-4119-a34c-dfb372df9ecf","version":"1.0.0"}

With this metode I receive on the “String Object” the value: (image 1 and 2)

The problem is that I need to export the value throught Bacnet communication and String object is not permitted.
So, i need to convert the string value into a numeric one, like 06.1 1byte signed integer.
Could you help me with the script ?
Thank you.


RE: MQTT Client app - Daniel - 28.03.2025

Click New Replay then you can attach images


RE: MQTT Client app - admin - 28.03.2025

Do you have a define mapping between text and numeric values?


RE: MQTT Client app - Pierluigi - 28.03.2025

(28.03.2025, 13:02)Daniel Wrote: Click New Replay then you can attach images

i modified the previous message.

Thank you.

(28.03.2025, 13:03)admin Wrote: Do you have a define mapping between text and numeric values?

idle : 0
call: 1
presence: 2
unhooked: 3
assistance: 4
emergency: 5
technical: 6
speech: 7


RE: MQTT Client app - admin - 28.03.2025

Remove JSON value path, use this Input script:
Code:
local map = {
  idle = 0,
  call = 1,
  presence = 2,
  unhooked = 3,
  assistance = 4,
  emergency = 5,
  technical = 6,
  speech = 7,
}

local msg = json.pdecode(payload)

if type(msg) == 'table' then
  local status = msg.data[1].status
  return map[ status ]
end



RE: MQTT Client app - Pierluigi - 28.03.2025

(28.03.2025, 13:11)admin Wrote: Remove JSON value path, use this Input script:
Code:
local map = {
  idle = 0,
  call = 1,
  presence = 2,
  unhooked = 3,
  assistance = 4,
  emergency = 5,
  technical = 6,
  speech = 7,
}

local msg = json.pdecode(payload)

if type(msg) == 'table' then
  local status = msg.data[1].status
  return map[ status ]
end
It works, really thank you.  Cool


RE: MQTT Client app - tomnord - 24.04.2025

Hello, MQTT client app works fine, but it would be nice to be able to edit topics in a texteditor or excel etc? If you have many topics, it is timeconsuming to add them all, or is this something that could be made in a script?


RE: MQTT Client app - admin - 24.04.2025

Try this:
Code:
data = {
  direction = 'both',
  topic = 'test2',
  address = '0/0/1',
  retain = '1',
  buswrite = '1',
  qospub = '0',
  qossub = '0',
  delta = '',
  throttle = '',
  jsonpath = '',
  boolon = '',
  booloff = '',
}

dofile('/www/apps/data/mqtt-client/lua/lib.lua')

res = save_topic(data)
log(res)
reload()



RE: MQTT Client app - tomnord - 24.04.2025

thanks. Is there any easy way of implementing timestamp in the script?


RE: MQTT Client app - admin - 24.04.2025

Timestamp for what? Explain your task in more detail.


RE: MQTT Client app - tomnord - 25.04.2025

I would like a timestamp as an object in the JSON sendt from LM, can it be done in the script section. i see that "timestamp = os.time()" worked in script.
That returns unix time?


RE: MQTT Client app - admin - 25.04.2025

Yes, os.time() returns UNIX timestamp.


RE: MQTT Client app - tomnord - 27.05.2025

(24.04.2025, 12:25)admin Wrote: Try this:
Code:
data = {
  direction = 'both',
  topic = 'test2',
  address = '0/0/1',
  retain = '1',
  buswrite = '1',
  qospub = '0',
  qossub = '0',
  delta = '',
  throttle = '',
  jsonpath = '',
  boolon = '',
  booloff = '',
}

dofile('/www/apps/data/mqtt-client/lua/lib.lua')

res = save_topic(data)
log(res)
reload()

Regarding this, any good ideas on how to implement this based on GA names? As far as I can see we need to run the "save_topic" once for each new topic.


RE: MQTT Client app - admin - 27.05.2025

Use tags. You can filter object list using wildcard search and assign tags using mass edit option.


RE: MQTT Client app - jmir - 30.05.2025

Hi,
I'm trying to use certificates and I get this message:

"Save failed: unable to get local issuer certificate"

I've seen that someone had this same issue... How can it be fixed?

Using MQTT-Explorer and the same certificates it works.

Thanks.


RE: MQTT Client app - admin - 02.06.2025

@jmir, see PM.