diff options
author | Dennis Eriksen <d@ennis.no> | 2023-03-29 21:20:40 +0200 |
---|---|---|
committer | Dennis Eriksen <d@ennis.no> | 2023-03-29 21:20:44 +0200 |
commit | b561663aba8c69b30ff14fb985df4cbf28ef0e6a (patch) | |
tree | 67e7e50f7310e27114e03af08f15a40e89409e73 /scripts/mqtt_watch.py | |
parent | entsoe has new api-url (diff) | |
download | energyscripts-b561663aba8c69b30ff14fb985df4cbf28ef0e6a.tar.gz |
adding user/pass for mqtt, made a service for neohub
Diffstat (limited to 'scripts/mqtt_watch.py')
-rw-r--r-- | scripts/mqtt_watch.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/scripts/mqtt_watch.py b/scripts/mqtt_watch.py index 371debd..d61ecc0 100644 --- a/scripts/mqtt_watch.py +++ b/scripts/mqtt_watch.py @@ -11,6 +11,8 @@ mqtt_server = os.environ['el_mqtt_server'] mqtt_port = int(os.environ['el_mqtt_port']) keepalive = int(os.environ['el_mqtt_keepalive']) mqtt_topic = os.environ['el_mqtt_topic'] +mqtt_user = os.environ['el_mqtt_user'] +mqtt_pass = os.environ['el_mqtt_pass'] # The callback for when the client receives a CONNACK response from the server. def on_connect(client, userdata, flags, rc): @@ -45,6 +47,8 @@ client = mqtt.Client() client.on_connect = on_connect client.on_message = on_message +client.username_pw_set(mqtt_user, password=mqtt_pass) + client.connect(mqtt_server, mqtt_port, keepalive) # Blocking call that processes network traffic, dispatches callbacks and |