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.
This commit is contained in:
parent
db2db908f3
commit
ea7e7329b1
1 changed files with 1 additions and 1 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Reference in a new issue