From 923fcedf92d2d730b410e45e8c0dab6c6501113f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Etxaniz?= Date: Fri, 2 Oct 2026 19:48:17 +0200 Subject: [PATCH] Initial content, migrated from the aml gateway rpi7-am-1 --- README.md | 8 +++++++- print_measurements.py | 20 ++++++++++++++++++++ schedule.yaml | 11 +++++++++++ signals.yml | 9 +++++++++ 4 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 print_measurements.py create mode 100644 schedule.yaml create mode 100644 signals.yml diff --git a/README.md b/README.md index b6250e1..3347b05 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,9 @@ # print-measurements -Prints the oven's main signals once a minute \ No newline at end of file +Runs every minute and exits. Reads the oven's main signals once and prints them to the job's +log, one line per signal, as a quick look at what the job sandbox sees. + +Three names in `signals.yml` differ from the platform's names for the same ids, which matters +only for what is printed: 1 is `hornoCuenta`, 2 is `hornoCuenta2`, and 11 is +`in-detect-oven`. Runs in `docker.izazpi.cloud/aml/aml-python`; the version is in +`schedule.yaml`. diff --git a/print_measurements.py b/print_measurements.py new file mode 100644 index 0000000..1392455 --- /dev/null +++ b/print_measurements.py @@ -0,0 +1,20 @@ +from i7lib.client import Plant +from i7lib.timeutils import to_datetime, now + +def main(): + plant = Plant() + plant.read_all() + + if not plant.signals: + print("no data") + return + + ts = to_datetime(now()).strftime("%Y-%m-%d %H:%M:%S") + print(f"[{ts}]") + + for s in sorted(plant.signals, key=lambda x: x["id"]): + label = s["name"] if s["name"] else f"signal_{s['id']}" + print(f" {s['id']:<6} {label:<24} {s['value']}") + +if __name__ == "__main__": + main() diff --git a/schedule.yaml b/schedule.yaml new file mode 100644 index 0000000..d0508de --- /dev/null +++ b/schedule.yaml @@ -0,0 +1,11 @@ +name: print-measurements +active: true +schedule: "* * * * *" +action: restart +runOnStartup: true +imageName: docker.izazpi.cloud/aml/aml-python:0.1.0 +command: ["python", "/app/print_measurements.py"] +maxCpuCores: 0.5 +maxMemoryMb: 128 +autoremove: false +logOption: 1 diff --git a/signals.yml b/signals.yml new file mode 100644 index 0000000..a877957 --- /dev/null +++ b/signals.yml @@ -0,0 +1,9 @@ +- { id: 1, name: 'cuenta-entrada', read: 1, write: 0 } +- { id: 2, name: 'cuenta-salida', read: 1, write: 0 } +- { id: 3, name: 'Hin', read: 1, write: 0 } +- { id: 4, name: 'Hout', read: 1, write: 0 } +- { id: 11, name: 'parametro', read: 1, write: 0 } +- { id: 17, name: 'THprocess', read: 1, write: 0 } +- { id: 18, name: 'THact', read: 1, write: 0 } +- { id: 19, name: 'THhead', read: 1, write: 0 } +- { id: 20, name: 'THbox', read: 1, write: 0 }