Prompt for dimmability; record it in metrics.json
y / n / Enter-if-unknown at the station; only known values are written, and the scaffolded device page gets a Dimmable spec.
This commit is contained in:
@@ -181,6 +181,8 @@ def write_bundle(reading, out_dir, meta, n_readings, supply=None):
|
||||
if meta.get("type"):
|
||||
# Lamp technology: led, halogen, cfl, incandescent, ...
|
||||
metrics["type"] = meta["type"]
|
||||
if meta.get("dimmable") is not None:
|
||||
metrics["dimmable"] = meta["dimmable"]
|
||||
if meta.get("variant"):
|
||||
metrics["variant"] = meta["variant"]
|
||||
if meta.get("rated"):
|
||||
|
||||
+9
-3
@@ -196,6 +196,8 @@ def scaffold_device_page(web_repo, lamp_id, meta):
|
||||
specs.append(("EAN", meta["ean"]))
|
||||
if meta.get("type"):
|
||||
specs.append(("Type", meta["type"].upper() if meta["type"] in ("led", "cfl") else meta["type"].capitalize()))
|
||||
if meta.get("dimmable") is not None:
|
||||
specs.append(("Dimmable", "Yes" if meta["dimmable"] else "No"))
|
||||
if meta["variant"]:
|
||||
specs.append(("Variant", meta["variant"]))
|
||||
if "Power_W" in rated:
|
||||
@@ -271,6 +273,10 @@ def measure_one(ean, args, data_repo):
|
||||
model = prompt("Model", model)
|
||||
lamp_type = prompt("Type (led / halogen / cfl / incandescent / ...)",
|
||||
previous.get("type", "led")).lower().strip()
|
||||
prev_dim = previous.get("dimmable")
|
||||
dim_default = "" if prev_dim is None else ("y" if prev_dim else "n")
|
||||
dim_raw = prompt("Dimmable? (y / n, Enter if unknown)", dim_default).lower()
|
||||
dimmable = True if dim_raw.startswith("y") else False if dim_raw.startswith("n") else None
|
||||
variant = prompt("Variant (e.g. daylight / warm white, Enter if none)",
|
||||
previous.get("variant", "")).lower()
|
||||
notes = prompt("Notes", previous.get("notes", "retailer-internal barcode, brand unknown"
|
||||
@@ -293,9 +299,9 @@ def measure_one(ean, args, data_repo):
|
||||
"enable": True}
|
||||
readings, supply = readings_from_device(port, args.readings, False, psu)
|
||||
reading = average_readings(readings)
|
||||
meta = {"name": lamp_id, "ean": ean or "", "type": lamp_type, "variant": variant,
|
||||
"manufacturer": manufacturer, "model": model, "notes": notes,
|
||||
"rated": rated}
|
||||
meta = {"name": lamp_id, "ean": ean or "", "type": lamp_type, "dimmable": dimmable,
|
||||
"variant": variant, "manufacturer": manufacturer, "model": model,
|
||||
"notes": notes, "rated": rated}
|
||||
out_dir = data_repo / "lamps" / lamp_id
|
||||
tm30 = write_bundle(reading, out_dir, meta, len(readings), supply)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user