L298N DC Motor Controller stays turned on

Hi,
I faced strange behavior of the L298N Output. I use a a Daily Time point as trigger, see below:

I expect that both outputs getting turned off after 60s or in case of the L298N after dispensing 10l. In case of my Valve (self implemented python code) it works as expected but the pump controller stays turned on forever, see below the log:

2024-01-07 14:47:26,507 - INFO - mycodo.controllers.controller_trigger_f5bbebdf - Refreshing trigger settings
2024-01-07 14:49:00,631 - DEBUG - mycodo.outputs.on_off_python_29ab6753 - output_on_off(on, 0, sec, 60.0, 0.0, True)
2024-01-07 14:49:00,631 - INFO - mycodo.outputs.on_off_python_29ab6753 - ID: 29ab6753-da36-4051-8d8e-d4733aad271c: ON
2024-01-07 14:49:00,794 - DEBUG - mycodo.outputs.pump_l298n_a5442304 - output_on_off(on, 0, vol, 10000.0, 0.0, True)
2024-01-07 14:49:00,795 - DEBUG - mycodo.outputs.pump_l298n_a5442304 - Turning pump on for 60.0 seconds to dispense 10000.0 ml (at 10000.0 ml/min).
2024-01-07 14:49:00,796 - DEBUG - mycodo.outputs.pump_l298n_a5442304 - Output turned on
2024-01-07 14:49:01,132 - DEBUG - mycodo.outputs.on_off_python_29ab6753 - Output 29ab6753-da36-4051-8d8e-d4733aad271c CH0 (Valve) on for 60.0 seconds. Output returned: None
2024-01-07 14:50:00,678 - DEBUG - mycodo.outputs.on_off_python_29ab6753 - output_on_off(off, 0, None, 0.0, 0.0, True)
2024-01-07 14:50:00,679 - INFO - mycodo.outputs.on_off_python_29ab6753 - ID: 29ab6753-da36-4051-8d8e-d4733aad271c: OFF
2024-01-07 14:50:01,180 - DEBUG - mycodo.outputs.on_off_python_29ab6753 - Output 29ab6753-da36-4051-8d8e-d4733aad271c CH0 (Valve) OFF at 2024-01-07 14:50:01. Output returned: None

When I try to turn off manually I also see this error:

image

To get rid of this, I have to go to the configuration page click once save and then it is ok again.

When I use the Output Control (Channel) Widget and send a volume value it works as expected:

2024-01-07 15:15:28,690 - DEBUG - mycodo.outputs.pump_l298n_a5442304 - Turning pump on for 60.0 seconds to dispense 10000.0 ml (at 10000.0 ml/min).
2024-01-07 15:15:28,691 - DEBUG - mycodo.outputs.pump_l298n_a5442304 - Output turned on
2024-01-07 15:16:28,700 - DEBUG - mycodo.outputs.pump_l298n_a5442304 - Output turned off

My Setup/Configuration:

Thanks

Further investigation brought me to the point that it is side effect from the valve (Output Configuration: On/Off: Python Code).

At the end of On/Off command I added:

GPIO.cleanup()

Which is a RPi.GPIO built-in function to clean up all the ports you’ve used.
It is not a problem if your trigger just turns on this dedicated output but in case if you use one trigger for two outputs it cleans up also the L298N GPIO’s. My understanding is, the scope includes all GPIO’s called from one trigger (python program).

The solution is to just clean the pin I used for the valve:

GPIO.cleanup(servoPIN)