Commit graph

9 commits

Author SHA1 Message Date
Greg Troxel
aed3b6ff20
examples: Add dup filtering to mqtt_relay ()
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.
2024-08-09 19:03:35 -04:00
Greg Troxel
d3975a47c6
examples: Add ability for mqtt_relay to use a config file ()
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.
2024-07-30 19:26:58 -04:00
Greg Troxel
ea7e7329b1
examples: Change mqtt_relay to always use id in topic () ()
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.
2024-07-29 13:04:53 -04:00
Greg Troxel
367378fabe
examples: Improve mqtt_relay to make individual and json topics optional ()
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.
2024-06-23 07:25:23 -04:00
Ben Winslow
8be3ef1507
Add HA script compat for paho-mqtt 2.0.0 via legacy callback API () 2024-05-02 20:24:58 +02:00
Greg Troxel
54f0ebe486 examples/rtl_433_mqtt_relay: Comment and support MQTT security
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.
2022-07-26 09:30:08 -04:00
Christian W. Zuckschwerdt
ef2d37cf51
Change old battery keys to battery_ok () 2021-06-12 12:05:07 +02:00
Wilmer van der Gaast
e9fbb92c2e
Add Prometheus/OpenMetrics relay example () 2020-05-04 14:13:17 +02:00
Christian W. Zuckschwerdt
9ae2db7e38 Add bridge/relay example scripts 2019-03-19 15:05:22 +01:00