Disable output before taking timelapse photo

Not a super important thing, but it is possible to disable an output before taking a timelapse photo?

I have a humidifier that tends to fog up the chamber, so it would be nice to disable it 120 sec before taking the timelapse photo. Its triggered by a VPD function, so could also disable that and activate it again after.

I see a pre and post command, maybe these could be used?

With humidifier on


Aaaand without

1 Like

The Pre-Output option turns an Output on for a specified duration prior to taking a photo. This is typically used to turn on a light, but you could set up a dummy Output, then create a Trigger that responds to that dummy Output activating by Deactivating your VPD Function, pausing for x seconds, then Activating the VPD Function.

Good idea. I can use the Python On/Off function.

How do I activate / deactivate a function from python?
How do I turn on / off an output from python? (I still need to turn the light on while capturing the photo)

1 Like
control.output_on(OUTPUT_ID, output_channel=0)
control.output_off(OUTPUT_ID, output_channel=0)

control.controller_activate(CONTROLLER_ID)
control.controller_deactivate(CONTROLLER_ID)

Though if you’re using a PID for your VPD regulation, it would be better to pause and resume the PID, since PID controllers can take a while to recover from being restarted. In that case, you can use:

control.pid_pause(PID_ID)
control.pid_resume(PID_ID)

Odd, I thought it was working, but now, if I add a control command to the on or off script I get the following error. I tried a blank function, but as soon as I add a control (on/off/pause/resume) it fails:

2021-05-29 22:18:06,173 - DEBUG - mycodo.outputs.on_off_python_8524b5bb - output_on_off(on, 0, sec, 0.0, 0.0, True)
2021-05-29 22:18:06,173 - ERROR - mycodo.outputs.on_off_python_8524b5bb - Cannot manipulate Output 8524b5bb-aaf7-46f5-a42d-6cb634de4731: Output not set up.

Strings need to be enclosed in quotes. I suppose I didn’t have quotes in my example code. As written, your code is passing a variable (the ID in your screenshot, I’m not typing it out) to the output function, which of course doesn’t exist and causes an exception. This is why you should always enclose your Python code in try/except blocks to catch exceptions.