diff --git a/Listen2Arduino.py b/Listen2Arduino.py index 2967930..845575c 100755 --- a/Listen2Arduino.py +++ b/Listen2Arduino.py @@ -34,7 +34,36 @@ while True: # print(f"{key} value={value}") with open(outFile, "w") as file: - for key, value in format_value.items(): - file.write(f"{key} value={value}\n") + for key, value in format_value.items(): + file.write(f"{key} value={value}\n") + if key == "State" : + if value == "0" or value == "1": + file.write(f"preaccl value=1\n") + file.write(f"valve1 value=1\n") + file.write(f"valve2 value=1\n") + file.write(f"hv value=1\n") + file.write(f"boiler value=1\n") + file.write(f"ion value=1\n") + if value == "2": + file.write(f"preaccl value=0\n") + file.write(f"valve1 value=1\n") + file.write(f"valve2 value=1\n") + file.write(f"hv value=0\n") + file.write(f"boiler value=1\n") + file.write(f"ion value=1\n") + if value == "3": + file.write(f"preaccl value=0\n") + file.write(f"valve1 value=0\n") + file.write(f"valve2 value=0\n") + file.write(f"hv value=0\n") + file.write(f"boiler value=1\n") + file.write(f"ion value=0\n") + if value == "4": + file.write(f"preaccl value=0\n") + file.write(f"valve1 value=0\n") + file.write(f"valve2 value=0\n") + file.write(f"hv value=0\n") + file.write(f"boiler value=0\n") + file.write(f"ion value=0\n") os.system(cmd)