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.

[OLD] LogicMachine firmware 2024.02
#13
I am running a script to send telemetry to thingsboard with mosquito mqtt connection:

Code:
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
indirizzo = event.dst --broker = "demo.thingsboard.io" broker = "185.5.xxx.xxx" port = 1883 token = "xxxxxxxxxxxxxxxxxxxxxxxx" topic = "v1/devices/me/telemetry" value = event.getvalue() -- Se value è un booleano, converte "true" in 1 e "false" in 0 if value == "true" then     value = 1 elseif value == "false" then     value = 0 else     -- Se value è un numero float, riduce i decimali a 1     numero = tonumber(value)     if numero ~= nil and numero % 1 ~= 0 then         value = string.format("%.1f", numero)     end     -- Se value è un numero intero, non fare nulla end -- Ora 'value' contiene il valore modificato secondo le specifiche old_value = storage.get(indirizzo) value = tostring(value) --log (value, old_value) if value == old_value then     --log("return")     return   end storage.set(indirizzo, value) dispositivo = grp.alias(indirizzo).." ("..indirizzo..")" payload = '{"'..dispositivo..' - valore":' .. value .. '}' --payload = "{temperatura:"..value.."}" --log (payload) mqtt = require("mosquitto") client = mqtt.new() client.ON_CONNECT = function(status, rc, msg)   if status then     --log("mqtt connected "..event.dst.." "..payload)     client:publish(topic, tostring(payload))   else     log("mqtt connect failed " .. tostring(msg))     client:disconnect()   end end client.ON_PUBLISH = function()   client:disconnect() end -- client:login_set(username, password) client:login_set(token, nil) status, rc, msg = client:connect(broker, port) if status then   client:loop_forever() else   log('connect failed: ' .. tostring(msg)) end

I taken it from LM docs, as suggested...

right now I can ping only in Zerotier and the reply is like that:

Esecuzione di Ping 10.147.20.232 con 32 byte di dati:
Risposta da 10.147.20.232: byte=32 durata=36ms TTL=64
Risposta da 10.147.20.232: byte=32 durata=36ms TTL=64
Risposta da 10.147.20.232: byte=32 durata=32ms TTL=64
Risposta da 10.147.20.232: byte=32 durata=32ms TTL=64

Statistiche Ping per 10.147.20.232:
    Pacchetti: Trasmessi = 4, Ricevuti = 4,
    Persi = 0 (0% persi),
Tempo approssimativo percorsi andata/ritorno in millisecondi:
    Minimo = 32ms, Massimo =  36ms, Medio =  34ms


Messages In This Thread
RE: [RC1] LogicMachine firmware 2024.02 - by gdimaria - 04.04.2024, 09:41

Forum Jump: