mqtt_lua icon indicating copy to clipboard operation
mqtt_lua copied to clipboard

Added "delay" option for rate limiting

Open jonoxer opened this issue 12 years ago • 1 comments

The label is not final (I don't like the term "delay" in this context) but this is a functional proof of concept at least

jonoxer avatar Mar 07 '12 01:03 jonoxer

I like where this is going. I propose that we attempt something more flexible ...

Command line argument is "-r rule_expression" or "--rule rule_expression", where the equivalent to your code would be "--rule period=10" (instead of "-d 10"). This will allow a variety of rules to be applied in the future.

The rule handling code in your callback would be moved into a library "rules.lua", which would contain the rule expression parser and a "rule_check(rule_expression)" function, which indicates whether the rule conditions have been met (and then publishing the message should occur). This means that the rules could be used by many applications / examples without having to duplicate code in every callback.

In time, the various rules may become extensible plug-ins.

geekscape avatar Mar 07 '12 12:03 geekscape