Merge pull request #2877 from proddy/dev

fix modbus md doc
This commit is contained in:
Proddy
2026-01-01 13:17:36 +01:00
committed by GitHub
3 changed files with 5913 additions and 2457 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -12,7 +12,7 @@
"dev": "vite dev",
"build": "vite build",
"preview": "vite preview",
"build-hosted": "typesafe-i18n && vite build --mode hosted",
"build-hosted": "typesafe-i18n --no-watch && vite build --mode hosted",
"mock-rest": "bun --watch ../mock-api/restServer.ts",
"preview-standalone": "typesafe-i18n --no-watch && vite build && concurrently -c \"auto\" \"pnpm:mock-rest\" \"vite preview\"",
"standalone": "concurrently -c \"auto\" \"typesafe-i18n\" \"pnpm:mock-rest\" \"vite dev\"",

View File

@@ -94,8 +94,9 @@ def print_device_entities(device_name, device_entities):
type_suffix = split_type[1] if len(split_type) > 1 else ""
# Optimize type_rest extraction and int range detection
type_rest_str = type_suffix
type_rest_str = ""
if "int" in type_base and "(" in type_suffix:
print(type_base)
try:
# Extract inner part of parentheses
range_inner = type_suffix[type_suffix.index("(")+1:type_suffix.index(")")]
@@ -106,14 +107,12 @@ def print_device_entities(device_name, device_entities):
elif "/" in range_inner:
min_value, max_value = range_inner.split("/")
if min_value is not None and max_value is not None:
type_rest_str = f"(>={min_value.strip()}<={max_value.strip()})"
else:
type_rest_str = ""
type_rest_str = f" (>={min_value.strip()}<={max_value.strip()})"
except Exception:
# fallback to original
pass
print(f"| {entity['shortname']} | {entity['fullname']} | {type_base} {type_rest_str} | "
print(f"| {entity['shortname']} | {entity['fullname']} | {type_base}{type_rest_str} | "
f"{entity['uom']} | {entity['writeable']} | {tag_type} | {entity['modbus offset']} | "
f"{entity['modbus count']} | {entity['modbus scale factor']} |")
print()
@@ -135,6 +134,9 @@ def print_device_type_devices(device_type, devices):
def print_header():
"""Print the markdown document header."""
print("---")
print("id: Modbus-Entity-Registers")
print("---")
print("# Modbus Entity/Register Mapping")
print()
print(":::warning")