[SOLVED] Serial to MQTT conversion by Node-red
-
Hi
I'm trying to connect my serial mysensors gateway to orange PC with domoticz
Domoticz accept only USB-serial device, LAN and MQTT.
Now I want to convert serial data to MQTT with node-red and use MQTT gateway in Domoticzserial to mqtt code:
var sensor = msg.payload.split(";"); msg.topic = "MySensors" + "/" + sensor[0] + "/" + sensor[1] + "/" + sensor[2] + "/" + sensor[3] + "/" + sensor[4]; msg.payload = sensor[5]; return msg;
Output MQTT text when the gateway initializing:
object payload: "0 MCO:BGN:INIT GW,CP=RNNGA---,VER=2.2.0↵" port: "/dev/ttyS1" _msgid: "619c024c.85ed8c" topic: "MySensors/0/255/3/0/9"
other messages same like this
Button node
object payload: "328523 TSF:MSG:READ,1-1-0,s=4,c=1,t=16,pt=1,l=1,sg=0:0↵" port: "/dev/ttyS1" _msgid: "11581f7a.7c16b1" topic: "MySensors/0/255/3/0/9" object payload: "0↵" port: "/dev/ttyS1" _msgid: "782972d9.6e0e3c" topic: "MySensors/1/4/1/0/16"
But gateway receiving nothing
Also serial gateway node not foundWhat im doing wrong?
-
I don't have an answer for your question but maybe my python script could help You:
https://github.com/mczerski/MySensorsSerial2MQTT
-
Lol. I just forgot to change the topic in my code from "MySensors" to "domoticz/out/MyMQTT"
Now working fine
1 out of 3
Suggested Topics
-
Arduino Celebrates 10 years (Malmö/Sweden)
Announcements • 29 Mar 2014, 17:08 • hek 29 Mar 2014, 17:08 -
Gateway without a radio
Development • 12 Jan 2025, 23:19 • OldSurferDude 14 Jan 2025, 22:07 -
Radio waking up for no reason.
Development • 4 Jul 2020, 21:09 • Sasquatch 15 Jan 2025, 08:33 -
Saving last known good state, but not in EEPROM
Development • 30 Jan 2024, 18:46 • OldSurferDude 15 Jan 2025, 08:51 -
LAN8720A - will mysensors work with this module
Development • 13 Nov 2024, 17:06 • Marcin 15 Nov 2024, 10:59 -
Sending offset to node
Development • 31 Jan 2025, 00:59 • bsl88k 4 Feb 2025, 12:14