MQTT alternative topic structure proposal #346
Replies: 3 comments 6 replies
-
Actually, I don't really see the advantages here, but that may be because I don't use MQTT ;). Maybe you could make them a bit more clear. As for sniffing the bus, I'm not sure whether that makes sense because it's easily possible that we "miss" a broadcast telegram because the Arduino is doing something else at that moment. That could mean that a cached value is no longer accurate which is why I would always recommend to read a specific parameter when it's required. |
Beta Was this translation helpful? Give feedback.
-
@Luposoft63 @dukess What do you think about this idea? |
Beta Was this translation helpful? Give feedback.
-
Just for bringing closure to this discussion: Most of the suggestions in the first post have now been implemented, including the topic hierarchy with sub-topics etc. Individual update intervals are still not possible since BSB-LAN does not support that "under the hood", but a new sub-topic |
Beta Was this translation helpful? Give feedback.
-
Hi there,
while thinking about autodiscovery and related topics (#333), I mused about an alternative approache to structuring the MQTT topic landscape. Right now, the world we have is simple, which has its own advantages, but it makes more dynamic integration scenarios more demanding on the other hand. The idea would be to introduce another MQTT mode, (keeping backwards compatibility), that does something like this:
To illustrate this with an example, using /bsb as a root topic (less typing)
If a topic is not configured (in whatever way), there will be no MQTT messages to
/bsb/700
or/bsb/700/update-interval
, the topics will be dead.As soon as the topic is activated either by static configuration or by a dynamic message to set-update-interval, things will go live. BSB-LAN would have to keep track of all active topics of course, so there will be some limits to this, but that should be manageable.
Additional idea: This would also allow us to opportunistically dump any value with sniff out of the bus traffic to the MQTT layer. In addition, any time we read a value of the bus, we could dump it into the broker.
More generally, if we take advantage of retained messages, we could even make the MQTT topic structure sort of an external state where we protocol whatever we see. We can also use idle time on the main loop to cycle heater functions and update them f.x. daily (enough for most parameters) one at a time.
It would have to take a bit of experimentation how to balance this idea against the rather vast number of heater functions available, but assuming that we have a long running system, this shouldn't be that bad. Also, with a almost continuously running broker, we don't have to keep track of too many things in an Arduinos limited system memory, most of the heavy lifting would be done by the broker.
What do you think?
Best regards, Torben
Beta Was this translation helpful? Give feedback.
All reactions