Skip to content

Commit

Permalink
examples: Change mqtt_relay to always use id in topic (#3014) (#3014)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
gdt authored Jul 29, 2024
1 parent db2db90 commit ea7e732
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion examples/rtl_433_mqtt_relay.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def publish_sensor_to_mqtt(mqttc, data, line):
path += "/" + sanitize(data["model"])
if "channel" in data:
path += "/" + str(data["channel"])
elif "id" in data:
if "id" in data:
path += "/" + str(data["id"])

if MQTT_INDIVIDUAL_TOPICS:
Expand Down

0 comments on commit ea7e732

Please sign in to comment.