I am looking to build opemqttgateway for lilygo-rtl_433 with the standalone serial mode that sends received data over serial without a MQTT broker. I was wondering if it is possible to send data over the builtin USB serial connection instead of GPIO pins so that I can connect it to a program running on a laptop. I haven’t had any luck with this so far. The log messages for the device itself show up in the console, but not any json data from 433mhz devices. The logs also show that serial is being initialized on UART 0, which should be the USB port on an ESP32. Here is what options I currently use to build.
I added this line to my build flags.
'-DZgatewaySERIAL="SERIAL"'
I also set DEFAULT_OFFLINE to true and DEFAULT_SERIAL to true in User_config.h and set SERIAL_UART to 0 and SERIALBaud to 115200 in config_SERIAL.h.
You should be able at least to use the logs output, by playing with the log level you would get less or more data (you don’t need gatewaySERIAL for this) :
This is not the most structured way of getting the data through Serial but it could work as a proof of concept.
I haven’t tried the gatewaySERIAL on the USB port, maybe something that we can look in the future.
In MQTT connected mode, it did give logs that I could parse in my program when in notice logging mode. However, in offline mode even with verbose logging, it did not give the decoded json.
T: isAdupl?
T: Enqueue JSON
T: Queue length: 1
T: Min ind: 4
T: store code : 47114 / 82827
T: Col: val/timestamp
T: mem code : 47114 / 8424
T: mem code : 10254 / 8495
T: mem code : 47114 / 44060
T: mem code : 95 / 58710
T: mem code : 47114 / 82827
T: mem code : 0 / 0
T: mem code : 0 / 0
T: mem code : 0 / 0
T: mem code : 0 / 0
T: mem code : 0 / 0
T: mem code : 0 / 0
T: mem code : 0 / 0
T: Dequeue JSON
I ended up adding this to the end of the enqueueJsonObject function so I could have this functionality in offline mode as well.
if (SYSConfig.offline){
Log.notice(F("msg: %s" CR), jsonString.c_str());
}
I set the DEFAULT_SERIAL option to false, but left the DEFAULT_OFFLINE option set to true and removed the
‘-DZgatewaySERIAL=“SERIAL”’ build flag, then it was able to output the json messages in offline mode like it does in MQTT-connected mode.