aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--requirements.txt2
-rw-r--r--tasmotaMQTTClient.py9
2 files changed, 8 insertions, 3 deletions
diff --git a/requirements.txt b/requirements.txt
index f8fd590..22dd085 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,4 +1,6 @@
tasmotadevicecontroller
aiohttp
paho-mqtt==1.6.1
+docker
+
diff --git a/tasmotaMQTTClient.py b/tasmotaMQTTClient.py
index e8a43b8..07f7fae 100644
--- a/tasmotaMQTTClient.py
+++ b/tasmotaMQTTClient.py
@@ -73,6 +73,11 @@ parser.add_argument(
required = True
)
parser.add_argument(
+ "-p", "--password",
+ type = str,
+ help = "Password to use in scripts. If ran interactively, omit this option otherwise the password will appear in logs"
+)
+parser.add_argument(
"-t", "--toggle",
action = "store_true",
help = "Toggle current power status"
@@ -88,10 +93,8 @@ if __name__ == "__main__":
args = vars(parser.parse_args())
if args["mqtt_host"] == "<docker>":
args["mqtt_host"] = docker_net.get_mqtt_addr()[0]
- if args["user"] is not None:
+ if args["password"] is None:
args["password"] = getpass.getpass("Input password for %s@%s: " % (args["user"], args["mqtt_host"]))
- else:
- args["password"] = None
if args["toggle"]:
client = MQTTClient(args["mqtt_host"], args["friendlyname"], args["user"], args["password"], "TOGGLE")