projects
/
openhab-process.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
a2f5003
)
"Умная" генерация ID клиента для возможности одновременной работы нескольких экземпля...
author
Roman Bazalevskiy
<rvb@rvb.name>
Tue, 31 Oct 2017 05:55:16 +0000
(08:55 +0300)
committer
Roman Bazalevskiy
<rvb@rvb.name>
Tue, 31 Oct 2017 05:55:16 +0000
(08:55 +0300)
mqtt-agi/mqtt
patch
|
blob
|
history
diff --git
a/mqtt-agi/mqtt
b/mqtt-agi/mqtt
index 6f69c7edcf1ee07607a4bbe9d81290cebf10aa85..cbb3e25fb2c9f884275452ddb9a02fe5140416a1 100755
(executable)
--- a/
mqtt-agi/mqtt
+++ b/
mqtt-agi/mqtt
@@
-13,8
+13,12
@@
import paho.mqtt.client as paho
import json
import json
+from os import getpid,uname
from pprint import pprint
from pprint import pprint
+client_name='agi-'+uname()[1]+'-'+str(getpid())
+print client_name
+
conffile, topic = sys.argv[1:3]
config = ConfigParser()
conffile, topic = sys.argv[1:3]
config = ConfigParser()
@@
-55,7
+59,7
@@
def on_publish(mosq, *args):
# done
agi_exit(0)
# done
agi_exit(0)
-client = paho.Client(
'agi'
)
+client = paho.Client(
client_name
)
client.username_pw_set(mqtt_username, mqtt_password)
client.connect(mqtt_server, port=mqtt_port)
client.on_connect = on_connect
client.username_pw_set(mqtt_username, mqtt_password)
client.connect(mqtt_server, port=mqtt_port)
client.on_connect = on_connect