Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions mqtt.dhtsensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@

MOSQUITTO_HOST = 'servername'
MOSQUITTO_PORT = 1883
MOSQUITTO_USER = 'USERNAME' #change to your credentials if needed
MOSQUITTO_PWD = 'PASSWORD'

MOSQUITTO_TEMP_MSG = str(sys.argv[1]) # Old channel name in here
MOSQUITTO_HUMI_MSG = str(sys.argv[2]) # Old channel name now passed by argument
print('Mosquitto Temp MSG {0}'.format(MOSQUITTO_TEMP_MSG))
Expand Down Expand Up @@ -90,6 +93,7 @@
print('Humidity: {0:0.2f} %'.format(humidity))

# Publish to the MQTT channel
mqttc.username_pw_set(MOSQUITTO_USER,MOSQUITTO_PWD) # deactivate if not needed
try:
mqttc.connect(MOSQUITTO_HOST,MOSQUITTO_PORT);
print 'Updating {0}'.format(MOSQUITTO_TEMP_MSG)
Expand Down