Implementing controller for Serial Gateway
-
Hi,
I started to develop a simple controller in Java, implementing node ID assignment and the most basic stuff to let mysensors work. The sensor data is then mirrored to MQTT, similar to the way Openhab 1.6 tutorial shows.With MySensors 1.6 and 2.0, I had about the same problem: flow control between controller and gateway.
Now I have a system having 3 threads:
- sending
- receiving
- listening for ACK packets, resending messages after a timeout
I have 16 relays controlling my lights in my home. If I send a command to each of them too fast, some messages gets lost. (I'm connecting over USB-serial, reproduced on Windows 10 and Raspberry Pi).
It actually turned out, if I wait about 350 milliseconds after sending a command, the system gets pretty stable. But... slow as well.
Can you please advice on how to properly implement flow control on a serial gateway? I know this should have a simple solution and I must be doing something wrong : )About buffering from Java side, I'm flushing my output stream be deterministic when waiting for that 350 ms.
Suggested Topics
-
Arduino Celebrates 10 years (Malmö/Sweden)
Announcements • 29 Mar 2014, 17:08 • hek 29 Mar 2014, 17:08 -
Saving last known good state, but not in EEPROM
Development • 30 Jan 2024, 18:46 • OldSurferDude 15 Jan 2025, 08:51 -
Gateway without a radio
Development • 12 Jan 2025, 23:19 • OldSurferDude 14 Jan 2025, 22:07 -
Sending offset to node
Development • 31 Jan 2025, 00:59 • bsl88k 4 Feb 2025, 12:14 -
Home Assistant/MySensors quirks
Development • 25 days ago • OldSurferDude 25 days ago -
PJON and Minicore not working
Development • 21 days ago • Trand 21 days ago