Loxberry icon indicating copy to clipboard operation
Loxberry copied to clipboard

XL: Read MQTT data not by subscription, but from MQTT Gateway data

Open christianTF opened this issue 4 years ago • 0 comments

With reading of MQTT data, XL currently connects to the broker, subscribes the topic the user requested, and waits up to a second for the subscription response. Therefore, data requested needs to have the retain flag set at the broker, as the subscription works like a "database query" in the retain database at the broker. Published data without retain aren't stored at the broker and won't return a value.

It would be more intelligent, to not query the broker for data, but the MQTT Gateway that stores subscription data in memory for 24 hours. As the gateway runs a service, it is available immediately for a data request.

Tradeoffs:

  • MQTT Gateway only stores data for 24 hours (brokers retain database is stored longer)
  • Requested data in XL must be subscribed in the MQTT Gateway. Data subscribed in the MQTT Gateway are forwarded to the Miniserver. Therefore, the XL mqtt requests are not independend to the Gateway's subscriptions anymore. Currently, requested data don't need to be subscribed by the Gateway

Possibly requesting the MQTT Gateway data should be a new function instead of changing the current function.

christianTF avatar Jan 30 '21 07:01 christianTF