Compare commits
6 Commits
v0.1.0
...
a408bb05a4
Author | SHA1 | Date | |
---|---|---|---|
a408bb05a4 | |||
5af51ab79f | |||
c68e1e23fb | |||
231d95a0f7 | |||
b9eaf0928a | |||
9ed7c53b33 |
37
README.md
37
README.md
@@ -11,13 +11,48 @@ Maybe it's straightforward or obvious, but just for completeness: the name comes
|
||||
2. The ability to turn on and off tasmota devices ("on" and "off" pronounced directly one after the other sounds (a bit) like "onov")
|
||||
|
||||
|
||||
## Dependencies
|
||||
## CLI Usage
|
||||
|
||||
```
|
||||
usage: Tasmotonov - simply toggle multiple tasmota lights [-h] [-v] [--version] {file,inline} data {on,off,toggle}
|
||||
|
||||
A very simple script which allows you to turn on/off multiple tasmota devices specified.
|
||||
|
||||
positional arguments:
|
||||
{file,inline} Select either to read the adresses (of the devices) from a "file" or from "inline"
|
||||
data Either the path to the file, or a comma- or semicolon-separated list of tasmota adresses.
|
||||
{on,off,toggle} Select to turn all tasmota devices "on" or "off" or "toggle" (case insensitive)
|
||||
|
||||
options:
|
||||
-h, --help show this help message and exit
|
||||
-v, --verbose Turn on verbose file output
|
||||
--version show program's version number and exit
|
||||
|
||||
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!
|
||||
|
||||
© Benjamin Burkhardt, 2025
|
||||
```
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
The CLI script ([tasmotonov.py](tasmotonov.py)) relies on two libaries apart from python3's standard libraries:
|
||||
|
||||
- `fqdn`: for validating the FQDN
|
||||
- `requests`: for making the HTTP requests
|
||||
|
||||
To use it, just execute the following command:
|
||||
|
||||
```bash
|
||||
pip install fqdn requests
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
The GUI application is based on Qt with it's python3 bindings PyQt6.
|
||||
|
||||
TODO
|
||||
|
||||
|
||||
## License
|
||||
|
||||
|
@@ -1,13 +1,34 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
"""
|
||||
Tasmotonov - A very simple script which allows you to turn on/off (or toggle) multiple tasmota devices specified.
|
||||
Copyright (C) 2025 Benjamin Burkhardt
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
"""
|
||||
|
||||
import sys # for exiting with the correct exit code
|
||||
import argparse # to parse the cli args!
|
||||
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')
|
||||
|
||||
@@ -15,6 +36,7 @@ parser.add_argument('source', help='Select either to read the adresses (of the d
|
||||
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 +81,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 = []
|
||||
|
Reference in New Issue
Block a user