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 broker example
#32
(09.03.2020, 08:49)edgars Wrote: Here is a step by step guide to make LogicMachine act as MQTT broker.

1. Install these packages:
Power CPU:
https://dl.openrb.com/pkg/libmosquitto_1.6.2-1_imx6.ipk
https://dl.openrb.com/pkg/mosquitto_1.6.8-2_imx6.ipk

Old CPU:

https://dl.openrb.com/pkg/libmosquitto_1.6.8-1_mxs.ipk
https://dl.openrb.com/pkg/mosquitto_1.6.8-2_mxs.ipk


2. Server will start automatically. Keep in mind that there's no protection by default - no encryption and username/password auth.

3. If you need to get the data on LogicMachine in grp addresses, you can use MQTT client example and connect to localhost: 
https://forum.logicmachine.net/showthrea...6#pid10926

4. If you are connecting to broker running on the same device you can set broker IP to 127.0.0.1. This way you can reuse script on other devices without having to specify the new IP.

5. SSL is not used, default port is 1883

6. Remove username/password variables as broker does not have any kind of authentication enabled by default.

7. As for topic/message payload - there's no specific format here. You can choose anything you like but it's a good practice to use one topic for one value instead of publishing complex data structures (JSON or similar) to a single topic.

Hi ,

I am testing how MQTT works, I have updated the firmware of LM and activated the MQTT Broker app.

I have configured it for unsecured connections and created the example script as resident, but it does not work and I get this error all the time:

Resident script:133: bad argument #2 to 'selectfds' (number expected, got nil).
stack traceback:
[C]: in function 'selectfds'.

How can I fix it.

Thanks.
Reply


Messages In This Thread
MQTT broker example - by edgars - 09.03.2020, 08:49
RE: MQTT broker example - by cekca - 13.03.2020, 16:17
RE: MQTT broker example - by cekca - 18.03.2020, 16:59
RE: MQTT broker example - by admin - 18.03.2020, 17:29
RE: MQTT broker example - by benanderson_475 - 19.03.2020, 03:38
RE: MQTT broker example - by admin - 19.03.2020, 07:23
RE: MQTT broker example - by Bobby - 13.04.2020, 12:47
RE: MQTT broker example - by admin - 14.04.2020, 06:35
RE: MQTT broker example - by Bobby - 14.04.2020, 08:28
RE: MQTT broker example - by admin - 14.04.2020, 09:29
RE: MQTT broker example - by Bobby - 14.04.2020, 10:50
RE: MQTT broker example - by admin - 22.04.2020, 07:42
RE: MQTT broker example - by Bobby - 22.05.2020, 05:50
RE: MQTT broker example - by admin - 22.05.2020, 12:42
RE: MQTT broker example - by thomasoppida - 05.06.2020, 13:32
RE: MQTT broker example - by Daniel - 05.06.2020, 13:36
RE: MQTT broker example - by thomasoppida - 21.06.2020, 18:45
RE: MQTT broker example - by Daniel - 22.06.2020, 07:30
RE: MQTT broker example - by thomasoppida - 22.06.2020, 10:01
RE: MQTT broker example - by Daniel - 22.06.2020, 10:10
RE: MQTT broker example - by admin - 22.06.2020, 10:21
RE: MQTT broker example - by thomasoppida - 22.06.2020, 10:23
RE: MQTT broker example - by myg - 22.06.2020, 14:50
RE: MQTT broker example - by Daniel - 22.06.2020, 14:57
RE: MQTT broker example - by admin - 20.08.2021, 14:27
RE: MQTT broker example - by Bobby - 20.08.2021, 14:30
RE: MQTT broker example - by admin - 24.08.2021, 05:44
RE: MQTT broker example - by Bobby - 03.09.2021, 11:13
RE: MQTT broker example - by Daniel - 03.09.2021, 12:52
RE: MQTT broker example - by Hyxion14 - 01.11.2021, 18:15
RE: MQTT broker example - by Bobby - 01.11.2021, 18:23
RE: MQTT broker example - by admin - 02.11.2021, 08:59
RE: MQTT broker example - by Bobby - 19.12.2021, 08:59
RE: MQTT broker example - by lestole - 02.01.2022, 21:02
RE: MQTT broker example - by Daniel - 03.01.2022, 08:28
RE: MQTT broker example - by lestole - 03.01.2022, 13:24
RE: MQTT broker example - by FatMax - 13.01.2022, 10:59
RE: MQTT broker example - by Daniel - 13.01.2022, 11:12
RE: MQTT broker example - by FatMax - 13.01.2022, 12:55

Forum Jump: