This commit is contained in:
Valentin Boettcher 2018-02-18 23:02:44 +01:00
parent a537d109f3
commit 0af619ab3e
2 changed files with 59 additions and 1 deletions

58
README.md Normal file
View file

@ -0,0 +1,58 @@
# Wonderful FHEM log parser!
> Use with care. May bite if not fed properly.
## Installation
1. Clone the repo:
`
git clone https://github.com/vale981/Da.git
`
2. Install the requirements (/note that on your system `pip` may be `pip3` etc./):
`
pip -r requirements.txt
`
3. Enjoy!
## Usage
`
usage: parseLogs.py [-h] [--parse FILE [FILE ...]] [--list]
[--heatAmmount HEATER] [--allHeatAmmount]
[--timeSpan t1..t2 | t1 | ..t2] [--verbose]
Parse the FHEM logfiles into a Database.
optional arguments:
-h, --help show this help message and exit
--parse FILE [FILE ...], -p FILE [FILE ...]
List of Logfiles to Parse.
--list, -l List all Heaters in the Database.
--heatAmmount HEATER Sum of the actuator value times a time slice.
--allHeatAmmount Get the heat ammount from all known heaters.
--timeSpan t1..t2 | t1 | ..t2
The time span for the heatAmmount calculation. Either
t1/t2 or both may be supplied.
--verbose, -v Output names and dates.
`
If run without arguments, the script will spit out the total heat amount for all heaters.
### Output Formating, Usage
Get the accumulated heat of `OG2_303_RT_01`:
`
# ./parseLogs.py --heatAmmount OG2_303_RT_01 --timeSpan '1 may 2016'..'1 june 2016' --verbose
OG2_303_RT_01, 0, 1462053600, 1464732000
`
Less info:
`
# ./parseLogs.py --heatAmmount OG2_303_RT_01 --timeSpan '1 may 2016'..'1 june 2016'
OG2_303_RT_01, 0, 1462053600, 1464732000
`
From the earliest record till a given date:
`
# ./parseLogs.py --heatAmmount OG2_303_RT_01 --timeSpan ..'1 june 2016'
OG2_303_RT_01, 285457264, 0, 1464732000
`

View file

@ -13,7 +13,7 @@ argparser.add_argument('--list', '-l', help='List all Heaters in the Database.',
argparser.add_argument('--heatAmmount', help='Sum of the actuator value times a time slice.', nargs=1, metavar='HEATER')
argparser.add_argument('--allHeatAmmount', help='Get the heat ammount from all known heaters.', action='store_true')
argparser.add_argument('--timeSpan', help='The time span for the heatAmmount calculation. Either t1/t2 or both may be supplied.', nargs=1, metavar='t1..t2 | t1 | ..t2')
argparser.add_argument('--verbose', '-v', help='Output more information about the query.', action='store_true')
argparser.add_argument('--verbose', '-v', help='Output names and dates.', action='store_true')
# Parse args. Set name to default.
args = argparser.parse_args()