From 9ed7c53b333c5f5409658f2b5421a87411c5d62f Mon Sep 17 00:00:00 2001 From: BlueFox Date: Sat, 17 May 2025 00:08:47 +0200 Subject: [PATCH] [Tasmotonov.py] Improved cli interface @v0.1.1 --- addresses | 5 +++++ tasmotonov.py | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 addresses diff --git a/addresses b/addresses new file mode 100644 index 0000000..43ef2af --- /dev/null +++ b/addresses @@ -0,0 +1,5 @@ +192.168.30.69 +192.168.30.71 + + + diff --git a/tasmotonov.py b/tasmotonov.py index a22c2e1..3370793 100755 --- a/tasmotonov.py +++ b/tasmotonov.py @@ -6,15 +6,19 @@ import requests # needed to access the http endpoints import ipaddress # to validate IP addresses from fqdn import FQDN # validate FQDNs +version = "v0.1.1" + parser = argparse.ArgumentParser( prog='Tasmotonov - simply toggle multiple tasmota lights', + formatter_class=argparse.RawDescriptionHelpFormatter, description='A very simple script which allows you to turn on/off multiple tasmota devices specified.', - epilog='Info: if you choose a file as source, this files needs to contain the addresses of the tasmota devices either comma-separated, semicolon-separated, or newline-separated!\n\n© Benjamin Burkhardt, 2025') + epilog='Info: if you choose a file as source, this files needs to contain the addresses of the tasmota devices either comma-separated, semicolon-separated, or newline-separated!\n\n © Benjamin Burkhardt, 2025') parser.add_argument('source', help='Select either to read the adresses (of the devices) from a "file" or from "inline"', choices=['file', 'inline']) parser.add_argument('data', help='Either the path to the file, or a comma- or semicolon-separated list of tasmota adresses.') parser.add_argument('action', help='Select to turn all tasmota devices "on" or "off" or "toggle" (case insensitive)', choices=['on', 'off', 'toggle']) parser.add_argument('-v', '--verbose', help='Turn on verbose file output', action='store_true') +parser.add_argument('--version', action='version', version=f'Tasmotonov.py {version}') # some helpers / utils @@ -59,6 +63,7 @@ def log_success(to_log, end='\n'): if __name__ == '__main__': args = parser.parse_args() # parse all given arguments + log(f'Parsed args: {args}') # convert the given adresses to a list tasmota_addresses = []