MQTT Plugin
-
here we are: https://github.com/dbochicchio/luup-mqtt
Try it and let me know. It should be easy to acquire .NET Core SDK and build the app. It's very minimal, fast and should be easy to understand. Right now it's only updating variables (with virtual device I think it's more tha enough), but I could add other actions if needed.
-
here we are: https://github.com/dbochicchio/luup-mqtt
Try it and let me know. It should be easy to acquire .NET Core SDK and build the app. It's very minimal, fast and should be easy to understand. Right now it's only updating variables (with virtual device I think it's more tha enough), but I could add other actions if needed.
Thank you! I will be testing it shortly now that I am done with my object recognition component and fixed a couple of network issues.
-
Hi Guys,
Was on the Lobo beta using Owntracks that Rigpapa was running but he killed it to focus on other projects. I have MQTT broker (Mosquitto) running on my rpi but can't figure out how to get MQTT data into a virtual switch on Vera. Did you ever get this working? Are there compiled files anywhere I can load on my Vera or openluup device?Roger
-
I'm using it exactly for OwnTracks (well, a forked version based on this). I could publish compiled binaries for sure if you are interested.
Since OwnTracks is publishing raw data, you'll need something (ie: some code in a scene) in order to really parse the lat/lon/accuracy and update a virtual sensor.
-
here we are: https://github.com/dbochicchio/luup-mqtt
Try it and let me know. It should be easy to acquire .NET Core SDK and build the app. It's very minimal, fast and should be easy to understand. Right now it's only updating variables (with virtual device I think it's more tha enough), but I could add other actions if needed.
@therealdb I finally decided to try and setup MQTT for my Tasmota and Shelly devices.
After having built the bridge i.a.w. the instructions I have copied it to my Ubuntu PC that also is running OpenLuup. I put all the files in a folder in "Home" and given permissionssudo chmod -R a+rwx /path/to/folder
.
(I built the files on my Win 10 PC in an Ubuntu WSL including-r linux-x64
.)The Tasmota test device I use says "MQT: Connected" in the console so it seems that it connects to the bridge when it starts. I also set up MQTT Explorer and it also connects to the bridge and shows the topics from the Tasmota device.
Despite this no temp value is set for the virtual sensor in OpenLuup I use for the test.
I have double checked the topic name, the topic path and the OpenLuup information and it seems correct.appsettings.json:
{ "MQTT": { "Username": "luup", "Password": "openluup", "Port": 1883 }, "Luup": { "ipAddress": "127.0.0.1", "port": 3480 }, "Devices": [ { "ClientID": "tasmota_test", "TopicName": "tele/tasmota_test/SENSOR", "TopicPath": "AM2301.Temperature", "DeviceID": 216, "Service": "urn:upnp-org:serviceId:TemperatureSensor1", "Variable": "CurrentTemperature" } ], /* remove comment when you're OK with less logs "Serilog": { "MinimumLevel": { "Default": "Information", "Override": { "Microsoft": "Fatal", "System": "Fatal" } } } */ }
Sensor topic on Tasmota console is posted when Tasmota posts the data:
13:58:05 MQT: tele/tasmota_test/SENSOR = {"Time":"2021-01-28T13:58:05","AM2301":{"Temperature":23.5,"Humidity":37.3,"DewPoint":8.1},"TempUnit":"C"}
The log file says:
2021-01-28 12:51:57.992 +01:00 [INF] [MQTTServer] Broker is starting on port 1883... 2021-01-28 12:59:21.709 +01:00 [INF] [MQTTServer] Broker is starting on port 1883... 2021-01-28 13:55:27.236 +01:00 [INF] [MQTTServer] Broker is starting on port 1883... 2021-01-28 13:57:48.402 +01:00 [INF] [MQTTServer] Broker is starting on port 1883...
Any ideas on what could be wrong? I have most likely missed something obvious.
//ArcherS
-
Sorry, nothing to suggest. I took a look at the MQTT code and while ago and it's rather poorly written.
FYI, though, I am in the process of writing a Shelly bridge for openLuup, which will have its own MQTT server and be able to automatically create configured devices for any Shellys that use it.
Turns out that it's rather easier to write a minimal MQTT server than it is an MQTT client.
-
Sorry, nothing to suggest. I took a look at the MQTT code and while ago and it's rather poorly written.
FYI, though, I am in the process of writing a Shelly bridge for openLuup, which will have its own MQTT server and be able to automatically create configured devices for any Shellys that use it.
Turns out that it's rather easier to write a minimal MQTT server than it is an MQTT client.
Just to clarify, what I installed was the stand alone MQTT Bridge from @therealdb and not the old MQTT plugin. Perhaps it was a bit confusing of me to post it here...
I agree that MQTT in some form for sure is a great addition to OpenLuup and Shelly/Tasmota devices.
Automatically adding devices sounds promising!//ArcherS
-
@therealdb I finally decided to try and setup MQTT for my Tasmota and Shelly devices.
After having built the bridge i.a.w. the instructions I have copied it to my Ubuntu PC that also is running OpenLuup. I put all the files in a folder in "Home" and given permissionssudo chmod -R a+rwx /path/to/folder
.
(I built the files on my Win 10 PC in an Ubuntu WSL including-r linux-x64
.)The Tasmota test device I use says "MQT: Connected" in the console so it seems that it connects to the bridge when it starts. I also set up MQTT Explorer and it also connects to the bridge and shows the topics from the Tasmota device.
Despite this no temp value is set for the virtual sensor in OpenLuup I use for the test.
I have double checked the topic name, the topic path and the OpenLuup information and it seems correct.appsettings.json:
{ "MQTT": { "Username": "luup", "Password": "openluup", "Port": 1883 }, "Luup": { "ipAddress": "127.0.0.1", "port": 3480 }, "Devices": [ { "ClientID": "tasmota_test", "TopicName": "tele/tasmota_test/SENSOR", "TopicPath": "AM2301.Temperature", "DeviceID": 216, "Service": "urn:upnp-org:serviceId:TemperatureSensor1", "Variable": "CurrentTemperature" } ], /* remove comment when you're OK with less logs "Serilog": { "MinimumLevel": { "Default": "Information", "Override": { "Microsoft": "Fatal", "System": "Fatal" } } } */ }
Sensor topic on Tasmota console is posted when Tasmota posts the data:
13:58:05 MQT: tele/tasmota_test/SENSOR = {"Time":"2021-01-28T13:58:05","AM2301":{"Temperature":23.5,"Humidity":37.3,"DewPoint":8.1},"TempUnit":"C"}
The log file says:
2021-01-28 12:51:57.992 +01:00 [INF] [MQTTServer] Broker is starting on port 1883... 2021-01-28 12:59:21.709 +01:00 [INF] [MQTTServer] Broker is starting on port 1883... 2021-01-28 13:55:27.236 +01:00 [INF] [MQTTServer] Broker is starting on port 1883... 2021-01-28 13:57:48.402 +01:00 [INF] [MQTTServer] Broker is starting on port 1883...
Any ideas on what could be wrong? I have most likely missed something obvious.
//ArcherS
-
@ArcherS I did some tests. here's what I got:
[09:08:32 VRB] [MQTTServer] Message Received... [sonoff-pool] - tele/tasmota/SENSOR - {"Time":"2020-07-26T08:21:19","DS18B20":{"Id":"02131D86D0AA","Temperature":25.3},"TSL2561":{"Illuminance":0.049},"SR04":{"Distance":45.421},"TempUnit":"C"} [09:08:36 VRB] [MQTTServer] Processed message: got 25.3 [09:08:36 VRB] Matched value [09:08:37 VRB] [LuupWrapper] Calling Uri: http://127.0.0.1:3480/data_request?id=variableset&output_format=json&DeviceNum=501&serviceId=urn:upnp-org:serviceId:TemperatureSensor1&Variable=CurrentTemperature&Value=25.3&RunAsync=1 2 [09:08:37 VRB] [MQTTServer] Message Received... [dbdomoticz] - owntracks/update/daniele - {"t":"c","tst":1611145530,"acc":65,"_type":"transition","event":"enter","lon":xx.615871,"topic":"owntracks\/DB\/daniele\/event","lat":xxx.995452999999998,"wtst":1610963724,"tid":"DB","desc":"Home"}
So, you should see at least the commands being reported. Check for permissions for the deamon and look at the console logs of your device. Maybe there's something (username? password? that's not correct.
EDIT: I just pushed a new release updated to .NET 5. Just get the new SDK, the build procedure is the same.
-
@ArcherS I did some tests. here's what I got:
[09:08:32 VRB] [MQTTServer] Message Received... [sonoff-pool] - tele/tasmota/SENSOR - {"Time":"2020-07-26T08:21:19","DS18B20":{"Id":"02131D86D0AA","Temperature":25.3},"TSL2561":{"Illuminance":0.049},"SR04":{"Distance":45.421},"TempUnit":"C"} [09:08:36 VRB] [MQTTServer] Processed message: got 25.3 [09:08:36 VRB] Matched value [09:08:37 VRB] [LuupWrapper] Calling Uri: http://127.0.0.1:3480/data_request?id=variableset&output_format=json&DeviceNum=501&serviceId=urn:upnp-org:serviceId:TemperatureSensor1&Variable=CurrentTemperature&Value=25.3&RunAsync=1 2 [09:08:37 VRB] [MQTTServer] Message Received... [dbdomoticz] - owntracks/update/daniele - {"t":"c","tst":1611145530,"acc":65,"_type":"transition","event":"enter","lon":xx.615871,"topic":"owntracks\/DB\/daniele\/event","lat":xxx.995452999999998,"wtst":1610963724,"tid":"DB","desc":"Home"}
So, you should see at least the commands being reported. Check for permissions for the deamon and look at the console logs of your device. Maybe there's something (username? password? that's not correct.
EDIT: I just pushed a new release updated to .NET 5. Just get the new SDK, the build procedure is the same.
@therealdb the permissions etc look right, also username password are correct, I get "connected" in the Tasmota console, so it seems to connect.
Is your log above from the MqttBridge logfile? If so I cannot see it, it only says:
2021-01-28 12:51:57.992 +01:00 [INF] [MQTTServer] Broker is starting on port 1883...
I think i will try to build it again. When looking in github I cannot see any updates to the files for some reason.
//ArcherS
-
@therealdb the permissions etc look right, also username password are correct, I get "connected" in the Tasmota console, so it seems to connect.
Is your log above from the MqttBridge logfile? If so I cannot see it, it only says:
2021-01-28 12:51:57.992 +01:00 [INF] [MQTTServer] Broker is starting on port 1883...
I think i will try to build it again. When looking in github I cannot see any updates to the files for some reason.
//ArcherS
-
@archers crazy days at work. push is in progress.
yes, this was from my own logs (where I attached owntracks as well - via a mqtt realy I have to test things around that's pushing mqtt messages from my prod system to my test ones).
@therealdb I tried to buid again from the new files, but I cannot get the Luup.MqttBridge to run the way it did before the update.
Unclear what is wrong, I think I did everything in the same was as before. I noticed that the icon on the Luup.MqttBridge file is different when looking at it in Ubuntu "Files".//ArcherS
-
@therealdb I tried to buid again from the new files, but I cannot get the Luup.MqttBridge to run the way it did before the update.
Unclear what is wrong, I think I did everything in the same was as before. I noticed that the icon on the Luup.MqttBridge file is different when looking at it in Ubuntu "Files".//ArcherS
@archers what's the output of
dotnet publish -c Release -r linux-x64
? You can do it under Windows and it will produce executables for Linux as well.If you want just a single file, go with
dotnet publish -c Release -r linux-x64 -p:PublishSingleFile=true --self-contained true
this will produce a single file with everything inside. I'm updating the doc as well.
-
-
@therealdb thanks for the build!
When using your latest build the Luup.MqttBridge file for some reason is a "shared library (application/x-sharedlib)" and not as when building from the older version "executable (application/x-executable)" despite having set permissions.
Really strange, I managed to get around this by creating a .sh file containing "./Luup.MqttBridge" and running this.
Over first hurdle...However when I launch the new built file I still only get this in the log file:
[19:17:23 INF] [MQTTServer] Broker is starting v 0.30.210109 on port 1883...
It is as if it hangs while trying to start/starting.
In the Tasmota console it says connected so the user/passwd seems ok:
19:17:21 MQT: Connected
So obviously not quite there yet.
Any ideas on what the pronlem could be?//ArcherS
-
@therealdb thanks for the build!
When using your latest build the Luup.MqttBridge file for some reason is a "shared library (application/x-sharedlib)" and not as when building from the older version "executable (application/x-executable)" despite having set permissions.
Really strange, I managed to get around this by creating a .sh file containing "./Luup.MqttBridge" and running this.
Over first hurdle...However when I launch the new built file I still only get this in the log file:
[19:17:23 INF] [MQTTServer] Broker is starting v 0.30.210109 on port 1883...
It is as if it hangs while trying to start/starting.
In the Tasmota console it says connected so the user/passwd seems ok:
19:17:21 MQT: Connected
So obviously not quite there yet.
Any ideas on what the pronlem could be?//ArcherS
-
@therealdb thanks for the build!
When using your latest build the Luup.MqttBridge file for some reason is a "shared library (application/x-sharedlib)" and not as when building from the older version "executable (application/x-executable)" despite having set permissions.
Really strange, I managed to get around this by creating a .sh file containing "./Luup.MqttBridge" and running this.
Over first hurdle...However when I launch the new built file I still only get this in the log file:
[19:17:23 INF] [MQTTServer] Broker is starting v 0.30.210109 on port 1883...
It is as if it hangs while trying to start/starting.
In the Tasmota console it says connected so the user/passwd seems ok:
19:17:21 MQT: Connected
So obviously not quite there yet.
Any ideas on what the pronlem could be?//ArcherS
So I did some more testing and found out that I had still "DVES_%06X" as client in the Tasmota device...
I am sure I had tripple checked everything, stupid...So I changed this to what it should be and now I get it to work , i.e. the device in OpenLuup gets the temp value. Success!
However the log does still not give more that the starting message for some reason.
Any ideas on this? Btw I still have this in the appsettings, not sure if that could be related:?/* remove comment when you're OK with less logs "Serilog": { "MinimumLevel": { "Default": "Information", "Override": { "Microsoft": "Fatal", "System": "Fatal" } } } */
I will do some more testing later on and see.
Thanks for the assistance!//ArcherS