Initial content, migrated from the aml gateway rpi7-am-1
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
# print-measurements
|
||||
|
||||
Prints the oven's main signals once a minute
|
||||
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`.
|
||||
|
||||
@@ -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()
|
||||
@@ -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
|
||||
@@ -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 }
|
||||
Reference in New Issue
Block a user