Keep information about the previous value sent. If it's been 5
seconds, or new value is different (ignoring keys like snr and
frequency), then send it. Otherwise, just don't. This causes bursts
of e.g. 4 transmissions to result in one MQTT message, on the theory
that the 4 transmissions are not actually 4 messags, but a strategy to
transmit one message more reliably.
Define a new configuration option to enable duplicate filtering, and
default it to True.
Steal logging config from mqtt_filter.py, and add a configuration
option DEBUG that if True results in debug logging instead of info.
This commit adds the ability to read config values from
rtl_433_mqtt_relay.yaml (overriding defaults). This read is skipped
if the yaml module can't be loaded or the config file can't be read,
so those without PyYAML or a config file see no change.
Those with a config file can set parameters for address/port to listen
for json-in-sylog, MQTT credentials, whether to post individual
values, a json dictionary, or both.
While rudimentary, this is a huge functional improvement, allowing
those using TLS and broker passwords (as arguably all should be) to
use the script without modifying it.
Previously, this example program appended /channel if present, and if
not present and id was present, appended /id. Typically channel is
from an A/B/C switch on the device or fixed for kind of device, and id
is from a 16 bit or larger space, sometimes static, and sometimes
random on powerup. Using only channel is bad if 1) one has more than
one device, or more than 3 if A/B/C or 2) one's neighbor gets such a
device. Because it is essentially impossible to rule out point 2, id
should always be used.
Add variables to control publishing individual topics and the json
topic. Default both to on, so that there is no behavior change.
This eases use now, as one's local diff is cleaner. It is also on the
path to reading these variables from a config file.
Define additional broker failures for username/password and use of
TLS, defaulting to not used, matching the previous behavior.
Rototill comments to help those later trying to modify the code.