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


MQTT broker example - edgars - 09.03.2020

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.


RE: MQTT broker example - cekca - 13.03.2020

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'

My hw is a HL with old cpu


RE: MQTT broker example - cekca - 18.03.2020

no help?


RE: MQTT broker example - admin - 18.03.2020

Wait for RC2 firmware. It will have broker built-in and there will be an app for configuration.


RE: MQTT broker example - benanderson_475 - 19.03.2020

(18.03.2020, 17:29)admin Wrote: Wait for RC2 firmware. It will have broker built-in and there will be an app for configuration.
I too have same issue as below same as Cekca , is there a fix for this? or how long do we wait for RC2?
 13.03.2020, 16:17
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'

My hw is a HL with old cpu



RE: MQTT broker example - admin - 19.03.2020

Unfortunately these packages require some other system packages to be updated. This is only possible via full firmware upgrade.


RE: MQTT broker example - Bobby - 13.04.2020

(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.

When is RC2 available?


RE: MQTT broker example - admin - 14.04.2020

RC2 has been postponed. We can provide current firmware build if you have direct access to your LM and are willing to test it. But there's no guarantee that it's 100% stable.


RE: MQTT broker example - Bobby - 14.04.2020

If the MQTT broker is ready, i am willing to test on my own system


RE: MQTT broker example - admin - 14.04.2020

Ok, which LM hardware do you have?


RE: MQTT broker example - Bobby - 14.04.2020

(14.04.2020, 09:29)admin Wrote: Ok, which LM hardware do you have?
reactor V3


RE: MQTT broker example - admin - 22.04.2020

Firmware:
https://dl.openrb.com/lm-20-mxs/mxs-reactorv3.img

Configuration app (install through App > Plus icon > Top left menu > Install from file):
https://dl.openrb.com/lm-20-imx6/pkg/mqtt-broker-20200403.ipk


RE: MQTT broker example - Bobby - 22.05.2020

Hi! Is there any changes in Z-wave here? i am having big trouble after update. cannot start/stop daemon. tried rebooting several times. tried unplugging usb device..
any tips?


RE: MQTT broker example - admin - 22.05.2020

I'll forward this to ZWave app developer. Can you send your project backup via PM?


RE: MQTT broker example - thomasoppida - 05.06.2020

Hi, I have been using Kappelt's online gbridge broker to communicate with Google Home.
His solution has been down for several weeks now. Is there any possibility to get the RC2 to get the broker to work with google home?
I have a LM5 PMC.


RE: MQTT broker example - Daniel - 05.06.2020

Broker on LM will not solve this problem.


RE: MQTT broker example - thomasoppida - 21.06.2020

I have installed the gbridge on a local raspberry and the setup is now working fine. I have installed a preliminary mqtt broker on my ubuntu and get all the messages from google home to the broker, but i think I messed up a little bit with the logicmachine. I can`t send any mqtt messages from/to the LM. When I connect the LM with the script to the ubuntu broker I get that the connection is accepted. I also are monitoring the same topic, both on the broker and LM, but still no luck. Could I please test the RC2?


RE: MQTT broker example - Daniel - 22.06.2020

The script above should work fine in RC1, Did you try to use MQTT Explorer to see all the messages?


RE: MQTT broker example - thomasoppida - 22.06.2020

Just tried the MQTT explorer. 
It confirms that LM connects/disconnect when i look at active clients on the server. 

When i change the value on the knx bus which I am subscribing on both server and LM, only the set value (status) updates in the MQTT Explorer. When I change the value from google home the value only changes the value for write, as it should. 

I have this running in a resident script 0, and I also enables/disables everytime I do some changes in the script.

Seems like there is something wrong with my:
-- topic to object map
  mqtt_to_object = {
    ['gBridge/u1/d1/onoff'] = '1/0/1',


Are my packages correct?   
Libmosquitto 1.6.3-1
Luamosquitto 0.3-5
Luasocket 2.0.2-20191009


RE: MQTT broker example - Daniel - 22.06.2020

What value do you get from gbridge? maybe there is a need for some conversion?