Python script runs but emoncms.org does not update (Hangs at end of script)

Ahh ok I had no idea that my_input was a button, yes with the current code you would need to hold it down until the next iteration (up to 60secs). If it was moved out to the outer loop it could still be missed as the code is looping once a second, unless you hold it for 1 sec each push. So you would need to remove or decrease the time.sleep(1) but this will significantly increase the cpu load.

The correct way to do it is to set up an interrupt for the button press and an “onButtonPress” function that sets the “my_input” variable, that way the code can remain as it is (calm) and the button push will be registered no matter when it’s pushed or how fast it is pushed.

Take a look at the Pulse monitoring on a Pi and Directly connecting to Optical Pulse Counter with RPi? threads for ideas on how that’s done. Those threads are about pulse counting, but a button press is just a single pulse that instead of counting them you could just toggle 1 and 0 giving you a manual “off” if you choose to turn boost off after it’s only been on a couple of mins.