Initial content, migrated from the aml gateway rpi7-am-1
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
from i7lib.client import run
|
||||
|
||||
prev_hin = 1.0
|
||||
prev_thact = 610.0
|
||||
|
||||
|
||||
def logic(plant):
|
||||
global prev_hin, prev_thact
|
||||
|
||||
hin = plant.state.get("Hin", 0.0)
|
||||
thact = plant.state.get("THact", 0.0)
|
||||
|
||||
batch = plant.new_write_batch()
|
||||
|
||||
if hin > 0 and prev_hin == 0:
|
||||
batch.add(signal_id=11, value=1.0, name="in-detect-oven")
|
||||
|
||||
if thact > 600 and prev_thact <= 600:
|
||||
batch.add(signal_id=12, value=1.0, name="out-detect-oven")
|
||||
|
||||
if batch.payload:
|
||||
plant.send(batch)
|
||||
|
||||
prev_hin = hin
|
||||
prev_thact = thact
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
run(logic, interval_ms=1000, offset_ms=100)
|
||||
Reference in New Issue
Block a user