Logic Machine Forum
MQTT broker example - 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: MQTT broker example (/showthread.php?tid=2505)

Pages: 1 2 3


RE: MQTT broker example - admin - 22.06.2020

Enabled logging in your script and post what you get:
Code:
mclient.ON_LOG = log



RE: MQTT broker example - thomasoppida - 22.06.2020

Only 0 and 1.

Sorry admin, didnt see your post. I enabled logging and it seems like I am receiving a 1 byte on this one.. thats weird because the trait in gbridge is a onoff..

Thank you very much for your help :-)
Using my old script now that has conversion.


RE: MQTT broker example - myg - 22.06.2020

I've installed broker package from the first post on LM5 Lite + Ext (i.MX6) SW: 20191015, installation went without errors but mosquitto process have not started. I've also installed UI package, but it says i need to have at least 2020xxx firmware. I'm really interested in moving my broker to LM to reduce amount of dedicated hardware (and points of failure) needed to run automation, is there any updates on general availability?


RE: MQTT broker example - Daniel - 22.06.2020

I will send you Beta FW to PM but we are not far of with RC2 release. It contains some bugs.


RE: MQTT broker example - dharma@srujan-infotech.com - 20.08.2021

(19.03.2020, 07:23)admin Wrote: Unfortunately these packages require some other system packages to be updated. This is only possible via full firmware upgrade.

Hi,
am also getting same errors like
I have 2 errors:


error loading module 'mosquitto' from file 'Library mosquitto.so':
Error loading shared library libssl.so.1.1: No such file or directory (needed by /usr/lib/libmosquitto.so.1)
stack traceback:
[C]: at 0x00055d50
[C]: in function 'require'

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


but my Hardware is LM5p2-DR
with latest version (V052021)


RE: MQTT broker example - admin - 20.08.2021

Have you installed MQTT packages separately? You don't have to do this, MQTT support is already built into the 2021 firmware. Try reinstalling the firmware to revert the packages.


RE: MQTT broker example - Bobby - 20.08.2021

Is there a manual for using the internal MQTT broker?


RE: MQTT broker example - dharma@srujan-infotech.com - 20.08.2021

(20.08.2021, 14:27)admin Wrote: Have you installed MQTT packages separately? You don't have to do this, MQTT support is already built into the 2021 firmware. Try reinstalling the firmware to revert the packages.

can you Please send the latest firmware link which is suitable for my hardware.

(20.08.2021, 14:27)admin Wrote: Have you installed MQTT packages separately? You don't have to do this, MQTT support is already built into the 2021 firmware. Try reinstalling the firmware to revert the packages.

hi,
after the new version am getting the error like...

Mqttt 20.08.2021 20:08:47

* arg: 1
  * string: mqtt disconnect
* arg: 2
  * bool: false
* arg: 3
  * number: 7
* arg: 4
  * string: unexpected disconnect
* arg: 5
  * nil


RE: MQTT broker example - admin - 24.08.2021

(20.08.2021, 14:30)Bobby Wrote: Is there a manual for using the internal MQTT broker?
You need to install the MQTT broker configuration" app from the store to use it. Do you have any specific questions?


(20.08.2021, 14:33)dharma@srujan-infotech.com Wrote: hi,
after the new version am getting the error like...

Mqttt 20.08.2021 20:08:47
* arg: 1
  * string: mqtt disconnect
* arg: 2
  * bool: false
* arg: 3
  * number: 7
* arg: 4
  * string: unexpected disconnect
* arg: 5
  * nil
Install these packages and try again. There will be a more descriptive error report.
https://dl.openrb.com/pkg/libmosquitto_2.0.11-1_imx6.ipk
https://dl.openrb.com/pkg/luamosquitto_20210820_imx6.ipk


RE: MQTT broker example - Bobby - 03.09.2021

Hi!As i am new to MQTT broker, i dont know how to use it.I want to use my smartthings hub to all my Z.wave applications, since LM dont support it anymore. How do i set things up to get it to talk together?sorry for lame questions, this is probably a walk in the park for you.

Br Bobby

(24.08.2021, 05:44)admin Wrote:
(20.08.2021, 14:30)Bobby Wrote: Is there a manual for using the internal MQTT broker?
You need to install the MQTT broker configuration" app from the store to use it. Do you have any specific questions?



RE: MQTT broker example - Daniel - 03.09.2021

I don't know how to setup your smartthing hub but LM must subscribe to the same topics what your hub. There are several MQTT client scripts on the forum for example this.
https://forum.logicmachine.net/showthread.php?tid=2670&pid=17126#pid17126


RE: MQTT broker example - Hyxion14 - 01.11.2021

(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/showthread.php?tid=1759&pid=10926#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.


RE: MQTT broker example - Bobby - 01.11.2021

If someone want to help set up all my Z-wave sensors to talk with LM, via ie MQTT and Smartthings hub, i would appreciate it. Can also pay some for the help.
Since the Z-wave module in LM is not working now, none of my sensors are online. Sad


RE: MQTT broker example - admin - 02.11.2021

@Hyxion14
The script works for me correctly using the latest firmware. Can you post the whole script? Are you using RC3? You don't need to install any packages apart from the MQTT broker app.

@Bobby
Smartthings hubs now have Lua driver support for local network communication. Do you only need sensor data in LM or a two-way communication?
https://developer.samsung.com/smartthings/blog/en-us/2021/08/19/new-smartthings-edge-for-devices-and-automations


RE: MQTT broker example - Bobby - 19.12.2021

(02.11.2021, 08:59)admin Wrote: @Hyxion14
The script works for me correctly using the latest firmware. Can you post the whole script? Are you using RC3? You don't need to install any packages apart from the MQTT broker app.

@Bobby
Smartthings hubs now have Lua driver support for local network communication. Do you only need sensor data in LM or a two-way communication?
https://developer.samsung.com/smartthings/blog/en-us/2021/08/19/new-smartthings-edge-for-devices-and-automations
Hi. I need 2way as i have a couple of relays as well...


RE: MQTT broker example - lestole - 02.01.2022

(02.11.2021, 08:59)admin Wrote: @Hyxion14
The script works for me correctly using the latest firmware. Can you post the whole script? Are you using RC3? You don't need to install any packages apart from the MQTT broker app.

@Bobby
Smartthings hubs now have Lua driver support for local network communication. Do you only need sensor data in LM or a two-way communication?
https://developer.samsung.com/smartthings/blog/en-us/2021/08/19/new-smartthings-edge-for-devices-and-automations

Is there a way to make this work on a SpaceLYnk?

BR
Lars Eirik


RE: MQTT broker example - Daniel - 03.01.2022

SL has all the mqtt libs in, the only thing you miss is the broker app but you can also use an external one.


RE: MQTT broker example - lestole - 03.01.2022

(03.01.2022, 08:28)Daniel Wrote: SL has all the mqtt libs in, the only thing you miss is the broker app but you can also use an external one.

Ok! I've set up SpaceLYnks as MQTT clients but not as a broker. Do you have any example scripts on how to enable the broker functionality?

BR

Lars Eirik


RE: MQTT broker example - FatMax - 13.01.2022

So there is no way a SpaceLYnk can act as a broker?


RE: MQTT broker example - Daniel - 13.01.2022

Use it on your own risk Wink
https://dl.openrb.com/pkg/mqtt-broker-20210104.ipk