Restructure param docs (#15)

* Update build-docs.yaml

* .

* moved files

* .

* Update build-docs.yaml

* Update build-docs.yaml

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>
This commit is contained in:
CaCO3
2023-02-04 01:10:11 +01:00
committed by GitHub
parent a58f7df35f
commit 3d5aee189f
77 changed files with 22 additions and 11 deletions

View File

@@ -0,0 +1,48 @@
"""
Grab all parameter files and concat them into a single file.
The header structure gets moved down 1 level
"""
import os
import shutil
import glob
parameterDocsFolder = "parameter-pages"
parameterOverviewFile = "../docs/Parameters.md"
parameterOverviewTemplateFile = "./templates/overview.md"
def appendParameterFile(folder, file):
#print(folder, file)
with open(file, 'r') as parameterFileHandle:
parameterDoc = parameterFileHandle.read()
parameterDoc = parameterDoc.replace("# ", "### ") # Move all headings 2 level down
# Add parameter doc to overview page
with open(parameterOverviewFile, 'a') as overviewFileHandle:
overviewFileHandle.write(parameterDoc + "\n---\n\n")
# Create templated overview markdown file
if os.path.exists(parameterOverviewFile):
os.remove(parameterOverviewFile)
shutil.copy(parameterOverviewTemplateFile, parameterOverviewFile)
"""
Append all parameter pages in a sorted manner
"""
folders = sorted( filter( os.path.isdir, glob.glob(parameterDocsFolder + '/*') ) )
for folder in folders:
folder = folder.split("/")[-1]
# print(folder)
# Add section
with open(parameterOverviewFile, 'a') as overviewFileHandle:
overviewFileHandle.write("\n## [%s]\n\n" % folder)
files = sorted(filter(os.path.isfile, glob.glob(parameterDocsFolder + "/" + folder + '/*')))
for file in files:
# print(" %s" % file)
appendParameterFile(folder, file)

View File

@@ -0,0 +1,71 @@
"""
For each parameter which can be found in the config file,
create a markdown file with a templated content it does not exist yet.
The files are grouped in sub folders representing the config sections.
"""
import os
import configparser
import urllib.request
configFileUrl = "https://raw.githubusercontent.com/jomjol/AI-on-the-edge-device/rolling/sd-card/config/config.ini"
parameterDocsFolder = "parameter-pages"
parameterTemplateFile = "./templates/parameter.md"
# Fetch default config file from URL
print("Fetching %r..." % configFileUrl)
with urllib.request.urlopen(configFileUrl) as response:
content = response.read().decode("utf-8")
lines = str(content).split("\n")
for l in range(len(lines)):
lines[l] = lines[l].strip() + "\n"
if lines[l][0] == ";":
lines[l] = lines[l][1:] # Remove comment
content = "".join(lines)
config = configparser.ConfigParser(allow_no_value=True)
config.optionxform = str # Make it case-insensitive
config.read_string(content)
#shutil.rmtree(parameterDocsFolder)
if not os.path.exists(parameterDocsFolder):
os.mkdir(parameterDocsFolder)
with open(parameterTemplateFile, 'r') as parameterTemplateFileHandle:
parameterTemplate = parameterTemplateFileHandle.read()
print("For each section/parameter, check if there is already a documentation page in the folder %r..." % (os.getcwd() + "/" + parameterDocsFolder))
for section in config:
if section != "DEFAULT":
#print(section)
subFolder = parameterDocsFolder + "/" + section
if not os.path.exists(subFolder):
os.mkdir(subFolder)
for parameter in config[section]:
if not " " in parameter: # Ignore parameters with whitespaces in them (special format, not part of editable config)
value = config[section][parameter]
#print(" %s = %s" % (parameter, value))
"""
For each config line, create a markdown file
"""
parameterDocFile = subFolder + '/' + parameter + ".md"
if not os.path.exists(parameterDocFile): # File does not exist yet, generate template
print("%r does not exit yet, generating a templated file for it" % (os.getcwd() + "/" + parameterDocFile))
with open(parameterDocFile, 'w') as paramFileHandle:
content = parameterTemplate
content = content.replace("$NAME", parameter)
content = content.replace("$DEFAULT", value)
paramFileHandle.write(content)

View File

@@ -0,0 +1,6 @@
# Parameter `AlignmentAlgo`
Default Value: `Default`
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,6 @@
# Parameter `FlipImageSize`
Default Value: `false`
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,6 @@
# Parameter `InitialMirror`
Default Value: `false`
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,6 @@
# Parameter `InitialRotate`
Default Value: `179`
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,6 @@
# Parameter `SearchFieldX`
Default Value: `20`
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,6 @@
# Parameter `SearchFieldY`
Default Value: `20`
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,6 @@
# Parameter `CNNGoodThreshold`
Default Value: `0.5`
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,6 @@
# Parameter `ExtendedResolution`
Default Value: `true`
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,6 @@
# Parameter `LogImageLocation`
Default Value: `/log/analog`
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,6 @@
# Parameter `LogfileRetentionInDays`
Default Value: `3`
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,6 @@
# Parameter `Model`
Default Value: `/config/ana-cont_11.3.1_s2.tflite`
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,6 @@
# Parameter `AutoStart`
Default Value: `true`
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,6 @@
# Parameter `Intervall`
Default Value: `5`
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,6 @@
# Parameter `DataLogActive`
Default Value: `true`
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,6 @@
# Parameter `DataLogRetentionInDays`
Default Value: `3`
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,6 @@
# Parameter `Logfile`
Default Value: `1`
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,6 @@
# Parameter `LogfileRetentionInDays`
Default Value: `3`
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,6 @@
# Parameter `CNNGoodThreshold`
Default Value: `0.5`
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,6 @@
# Parameter `LogImageLocation`
Default Value: `/log/digit`
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,6 @@
# Parameter `LogfileRetentionInDays`
Default Value: `3`
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,6 @@
# Parameter `Model`
Default Value: `/config/dig-cont_0600_s3.tflite`
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,6 @@
# Parameter `IO0`
Default Value: `input disabled 10 false false`
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,6 @@
# Parameter `IO1`
Default Value: `input disabled 10 false false`
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,6 @@
# Parameter `IO12`
Default Value: `input-pullup disabled 10 false false`
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,6 @@
# Parameter `IO13`
Default Value: `input-pullup disabled 10 false false`
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,6 @@
# Parameter `IO3`
Default Value: `input disabled 10 false false`
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,6 @@
# Parameter `IO4`
Default Value: `built-in-led disabled 10 false false`
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,6 @@
# Parameter `LEDColor`
Default Value: `150 150 150`
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,6 @@
# Parameter `LEDNumbers`
Default Value: `2`
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,6 @@
# Parameter `LEDType`
Default Value: `WS2812`
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,6 @@
# Parameter `MainTopicMQTT`
Default Value: `wasserzaehler/GPIO`
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,6 @@
# Parameter `Database`
Default Value: ``
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,6 @@
# Parameter `Measurement`
Default Value: `undefined`
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,6 @@
# Parameter `Uri`
Default Value: `undefined`
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,6 @@
# Parameter `password`
Default Value: `undefined`
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,6 @@
# Parameter `user`
Default Value: `undefined`
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,6 @@
# Parameter `ClientID`
Default Value: `watermeter`
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,6 @@
# Parameter `HomeassistantDiscovery`
Default Value: `true`
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,6 @@
# Parameter `MainTopic`
Default Value: `watermeter`
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,6 @@
# Parameter `MeterType`
Default Value: `other`
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,6 @@
# Parameter `SetRetainFlag`
Default Value: `true`
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,6 @@
# Parameter `Uri`
Default Value: `mqtt://IP-ADRESS:1883`
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,6 @@
# Parameter `password`
Default Value: `PASSWORD`
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,6 @@
# Parameter `user`
Default Value: `USERNAME`
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,6 @@
# Parameter `Brightness`
Default Value: `0`
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,6 @@
# Parameter `Contrast`
Default Value: `0`
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,6 @@
# Parameter `Demo`
Default Value: `true`
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,6 @@
# Parameter `FixedExposure`
Default Value: `false`
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,6 @@
# Parameter `ImageQuality`
Default Value: `12`
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,6 @@
# Parameter `ImageSize`
Default Value: `VGA`
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,6 @@
# Parameter `LEDIntensity`
Default Value: `50`
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,6 @@
# Parameter `LogImageLocation`
Default Value: `/log/source`
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,6 @@
# Parameter `LogfileRetentionInDays`
Default Value: `15`
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,6 @@
# Parameter `Saturation`
Default Value: `0`
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,6 @@
# Parameter `WaitBeforeTakingPicture`
Default Value: `5`
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,6 @@
# Parameter `AllowNegativeRates`
Default Value: `false`
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,6 @@
# Parameter `CheckDigitIncreaseConsistency`
Default Value: `false`
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,6 @@
# Parameter `ErrorMessage`
Default Value: `true`
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,6 @@
# Parameter `PreValueAgeStartup`
Default Value: `720`
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,6 @@
# Parameter `PreValueUse`
Default Value: `true`
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,6 @@
# Parameter `main.AnalogDigitalTransitionStart`
Default Value: `9.2`
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,6 @@
# Parameter `main.DecimalShift`
Default Value: `0`
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,6 @@
# Parameter `main.ExtendedResolution`
Default Value: `false`
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,6 @@
# Parameter `main.IgnoreLeadingNaN`
Default Value: `true`
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,6 @@
# Parameter `main.MaxRateType`
Default Value: `AbsoluteChange`
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,6 @@
# Parameter `main.MaxRateValue`
Default Value: `0.05`
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,6 @@
# Parameter `AutoAdjustSummertime`
Default Value: `false`
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,6 @@
# Parameter `Hostname`
Default Value: `undefined`
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,6 @@
# Parameter `SetupMode`
Default Value: `true`
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,6 @@
# Parameter `TimeServer`
Default Value: `pool.ntp.org`
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,6 @@
# Parameter `TimeZone`
Default Value: `CET-1CEST,M3.5.0,M10.5.0/3`
## Description
Please fill me with an explanation and useful links

View File

@@ -0,0 +1,7 @@
# Parameters
This page lists all available [Configuration](../Configuration) Parameters.
!!! Note
This is an auto-generated page! See the [README](https://github.com/jomjol/AI-on-the-edge-device-docs/blob/main/README.md) for details!
---

View File

@@ -0,0 +1,6 @@
# Parameter `$NAME`
Default Value: `$DEFAULT`
## Description
Please fill me with an explanation and useful links