Logic Machine Forum
Azure IoT Hub - MQTT - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: Azure IoT Hub - MQTT (/showthread.php?tid=1793)

Pages: 1 2


RE: Azure IoT Hub - MQTT - Sandstrand - 21.05.2019

(10.01.2019, 09:55)admin Wrote: Thanks!

First, you need to update MQTT library packages:

New CPU:
https://dl.openrb.com/pkg/libmosquitto_1.4.15-1_imx6.ipk
https://dl.openrb.com/pkg/luamosquitto_0.3-2_imx6.ipk

Old CPU:
https://dl.openrb.com/pkg/libmosquitto_1.4.15-1_mxs.ipk
https://dl.openrb.com/pkg/luamosquitto_0.3-2_mxs.ipk

Here's a minimal example that you can use, don't forget to change device_id, broker, username and password parameters. You also need to upload azure.crt via FTP (using ftp username, upload to root directory). Certificate file contents: https://gist.github.com/jsopenrb/5873b203787ece0b1f12d5d6b950151f
Code:
device_id = 'DEV_TEST'
broker = 'DEV.azure-devices.net'
port = 8883
username = 'DEV.azure-devices.net/DEV_TEST'
password = 'SharedAccessSignature ...'

mqtt = require('mosquitto')
client = mqtt.new(device_id)

client.ON_CONNECT = function(...)
 log('ON_CONNECT', ...)
 client:publish('devices/' .. device_id .. '/messages/events/', '{id=456}')
end

client.ON_PUBLISH = function(...)
 log('ON_PUBLISH', ...)
end

client.ON_LOG = function(...)
 log('ON_LOG', ...)
end

client.ON_DISCONNECT = function(...)
 log('ON_DISCONNECT', ...)
end

client:version_set(mqtt.PROTOCOL_V311)
client:tls_set('/home/ftp/azure.crt')
client:login_set(username, password)
client:connect(broker, port)

while true do
 res, err, code = client:loop()
 if not res then
   log('loop error', res, err, code)
   os.sleep(1)
 end
end

Is there a typo in the filename or is the package removed from your downloads? 

libmosquitto_1.4.15-1_imx6.ipk


RE: Azure IoT Hub - MQTT - admin - 21.05.2019

Updated package: https://dl.openrb.com/pkg/libmosquitto_1.6.2-1_imx6.ipk


RE: Azure IoT Hub - MQTT - FatMax - 03.07.2019

(10.01.2019, 09:55)admin Wrote: Thanks!

First, you need to update MQTT library packages:

New CPU:
https://dl.openrb.com/pkg/libmosquitto_1.4.15-1_imx6.ipk
https://dl.openrb.com/pkg/luamosquitto_0.3-2_imx6.ipk

Old CPU:
https://dl.openrb.com/pkg/libmosquitto_1.4.15-1_mxs.ipk
https://dl.openrb.com/pkg/luamosquitto_0.3-2_mxs.ipk

Here's a minimal example that you can use, don't forget to change device_id, broker, username and password parameters. You also need to upload azure.crt via FTP (using ftp username, upload to root directory). Certificate file contents: https://gist.github.com/jsopenrb/5873b203787ece0b1f12d5d6b950151f
Code:
device_id = 'DEV_TEST'
broker = 'DEV.azure-devices.net'
port = 8883
username = 'DEV.azure-devices.net/DEV_TEST'
password = 'SharedAccessSignature ...'

mqtt = require('mosquitto')
client = mqtt.new(device_id)

client.ON_CONNECT = function(...)
 log('ON_CONNECT', ...)
 client:publish('devices/' .. device_id .. '/messages/events/', '{id=456}')
end

client.ON_PUBLISH = function(...)
 log('ON_PUBLISH', ...)
end

client.ON_LOG = function(...)
 log('ON_LOG', ...)
end

client.ON_DISCONNECT = function(...)
 log('ON_DISCONNECT', ...)
end

client:version_set(mqtt.PROTOCOL_V311)
client:tls_set('/home/ftp/azure.crt')
client:login_set(username, password)
client:connect(broker, port)

while true do
 res, err, code = client:loop()
 if not res then
   log('loop error', res, err, code)
   os.sleep(1)
 end
end

HELLO!

You seem to have removed one of the mosquitto lib files from your server!! Thats a bit of an issue as we have software that downloads and installs those libs automatically. Can you please upload them again?


RE: Azure IoT Hub - MQTT - admin - 03.07.2019

New CPU:
https://dl.openrb.com/pkg/libmosquitto_1.6.3-1_imx6.ipk
https://dl.openrb.com/pkg/luamosquitto_0.3-2_imx6.ipk

Old CPU:
https://dl.openrb.com/pkg/luamosquitto_0.3-2_mxs.ipk
https://dl.openrb.com/pkg/libmosquitto_1.6.3-1_mxs.ipk


RE: Azure IoT Hub - MQTT - FatMax - 03.07.2019

(03.07.2019, 12:33)admin Wrote: New CPU:
https://dl.openrb.com/pkg/libmosquitto_1.6.3-1_imx6.ipk
https://dl.openrb.com/pkg/luamosquitto_0.3-2_imx6.ipk

Old CPU:
https://dl.openrb.com/pkg/luamosquitto_0.3-2_mxs.ipk
https://dl.openrb.com/pkg/libmosquitto_1.6.3-1_mxs.ipk

Hi, 

These don't work with our software. You probably did some changes, I'm getting loads of error messages.

Could you send me the old ones linked to in this thread earlier? Then I can just deploy new software with these versions built in instead.

Edgars has my email.

EDIT:

It’s only the lib file for the new cpu I’m missing. 1.4 something.


RE: Azure IoT Hub - MQTT - admin - 03.07.2019

What errors are you getting exactly and what CPU are you using?

We constantly update packages on our server and you should never rely on certain files being there.

You can find older versions here but I suspect that they won't work:
https://dl.openrb.com/lm-17/pkg/
https://dl.openrb.com/lm-17-imx6/pkg/

Can you also send connection details via PM so we can test locally?


RE: Azure IoT Hub - MQTT - FatMax - 03.07.2019

(03.07.2019, 13:18)admin Wrote: What errors are you getting exactly and what CPU are you using?

We constantly update packages on our server and you should never rely on certain files being there.

You can find older versions here but I suspect that they won't work:
https://dl.openrb.com/lm-17/pkg/
https://dl.openrb.com/lm-17-imx6/pkg/

Can you also send connection details via PM so we can test locally?

Thank you for the files. I've packaged a version with local libs instead of downloading from the internet. I had to focus on making this work as opposed to troubleshooting as we have customers downloading our software from our portal. When I get back down to earth I'm sure we can look at what the issues might be. What changes were made? 

The hardware here is a HW3 SpaceLYnk, Armv7. We require they use 2.3.0 firmware for our software to function, that's why these "older" mosquitto libs will work fine.


RE: Azure IoT Hub - MQTT - admin - 04.07.2019

There should not be any changes on the protocol level, only some bug fixes. Can you send connection details via PM so we can test it?


RE: Azure IoT Hub - MQTT - Erwin van der Zwart - 04.07.2019

Hi,

FW 2.3.0 has MQTT default in the FW so you don't need to install any package to use it..

BR,

Erwin


RE: Azure IoT Hub - MQTT - admin - 04.07.2019

There might be some features missing like an ability to set protocol version.