Problem: Peristaltic Pump:PCF8574 8 channel expander

Hi Kyle,
I am trying to use PCF8574 8 channel expander peristaltic output module but I am facing following issue.
When I Initialize the module the On State = High (by default). So my relay is switched on so as the pump. When I send Duration = 60 secs, the relay is switched off for 60 seconds which is correct as default state is High.
But when I select On State = Low, save the settiings, the relay is switched off which is also correct. But now when I send Duration = 60 Seconds, the relay must be switched on for 60 seconds, which is not happening. There is no change is Output state.
So logically the relay must switch on the pump only for the definite amount of time. But here it is happening exactly in opposite manner.
The On/Off version works perfectly.
I also tried to do some changes in code but then instead of switching on the output for 5 seconds, it is delayed by 5 seconds and then permanently switched on. So I deleted that part.
Please help me as I am unable to proceed further.

I’ve reviewed the code and can’t find anything obvious that would cause this behavior. Mycodo version 8.15.0 was just released that could have changes that fix this issue. After upgrading, delete and readd your output, and if the issue persists, I’ll investigate further.

Providing more information will also help with diagnosing the issue. It’s near impossible to determine the issue without detailed logs. Run the output in debug mode and review the Daemon Log while inducing the issue. Provide the logs here with detailed descriptions of what you are doing at every point of the way.

I will do as per your suggesstion and post it here

Hi Kyle,
This is detailed Log with what I am trying to do at every instance. There is some problem in last instance. I dont know where to do the changes in code. Whatever I do creates a new issue.

Step 1) PCF8574 module initialised

2023-01-15 10:29:04,558 - DEBUG - mycodo.outputs.pump_pcf8574_fe4921e7 - I2C: Address: 0x39, Bus: 1
2023-01-15 10:29:04,559 - INFO - mycodo.outputs.pump_pcf8574_fe4921e7 - Output setup on channel 0 and turned OFF (OFF=LOW)
2023-01-15 10:29:04,559 - INFO - mycodo.outputs.pump_pcf8574_fe4921e7 - Output setup on channel 1 and turned OFF (OFF=LOW)
2023-01-15 10:29:04,559 - INFO - mycodo.outputs.pump_pcf8574_fe4921e7 - Output setup on channel 2 and turned OFF (OFF=LOW)
2023-01-15 10:29:04,559 - INFO - mycodo.outputs.pump_pcf8574_fe4921e7 - Output setup on channel 3 and turned OFF (OFF=LOW)
2023-01-15 10:29:04,559 - INFO - mycodo.outputs.pump_pcf8574_fe4921e7 - Output setup on channel 4 and turned OFF (OFF=LOW)
2023-01-15 10:29:04,559 - INFO - mycodo.outputs.pump_pcf8574_fe4921e7 - Output setup on channel 5 and turned OFF (OFF=LOW)
2023-01-15 10:29:04,559 - INFO - mycodo.outputs.pump_pcf8574_fe4921e7 - Output setup on channel 6 and turned OFF (OFF=LOW)
2023-01-15 10:29:04,560 - INFO - mycodo.outputs.pump_pcf8574_fe4921e7 - Output setup on channel 7 and turned OFF (OFF=LOW)
2023-01-15 10:29:04,560 - DEBUG - mycodo.outputs.pump_pcf8574_fe4921e7 - List sent to device: {0: False, 1: False, 2: False, 3: False, 4: False, 5: False, 6: False, 7: False}
2023-01-15 10:29:04,560 - INFO - mycodo.outputs.pump_pcf8574_fe4921e7 - Initialized in 343.8 ms

All output channels ON STATE set to HIGH by default and realys are turned ON.

Step 2) Channel 1 turned on for 5 seconds

2023-01-15 10:33:59,907 - DEBUG - mycodo.outputs.pump_pcf8574_fe4921e7 - output_on_off(on, 1, sec, 5.0, 0.0, True)
2023-01-15 10:33:59,908 - DEBUG - mycodo.outputs.pump_pcf8574_fe4921e7 - state: on, output_type: sec, amount: 5.0
2023-01-15 10:33:59,908 - DEBUG - mycodo.outputs.pump_pcf8574_fe4921e7 - Output turned on
2023-01-15 10:33:59,909 - DEBUG - mycodo.outputs.pump_pcf8574_fe4921e7 - List sent to device: {0: False, 1: True, 2: False, 3: False, 4: False, 5: False, 6: False, 7: False}
2023-01-15 10:33:59,909 - DEBUG - mycodo.outputs.pump_pcf8574_fe4921e7 - Output fe4921e7-d54e-4c99-81ef-d3913cfd1876 CH1 (Name) on for 5.0 seconds. Output returned: None
2023-01-15 10:34:04,949 - DEBUG - mycodo.outputs.pump_pcf8574_fe4921e7 - output_on_off(off, 1, None, 0.0, 0.0, True)
2023-01-15 10:34:04,949 - DEBUG - mycodo.outputs.pump_pcf8574_fe4921e7 - state: off, output_type: None, amount: None
2023-01-15 10:34:04,950 - DEBUG - mycodo.outputs.pump_pcf8574_fe4921e7 - Output turned off
2023-01-15 10:34:04,951 - DEBUG - mycodo.outputs.pump_pcf8574_fe4921e7 - List sent to device: {0: False, 1: False, 2: False, 3: False, 4: False, 5: False, 6: False, 7: False}
2023-01-15 10:34:04,951 - DEBUG - mycodo.outputs.pump_pcf8574_fe4921e7 - Output fe4921e7-d54e-4c99-81ef-d3913cfd1876 CH1 (Name) OFF at 2023-01-15 10:34:04. Output returned: None

During Step 2) Relay on channel 1 is switched off for 5 seconds. Turned back on after 5 seconds

Step 3) All channels ON STATE set to LOW. All relays are turned OFF

023-01-15 10:38:31,034 - DEBUG - mycodo.outputs.pump_pcf8574_fe4921e7 - I2C: Address: 0x39, Bus: 1
2023-01-15 10:38:31,034 - INFO - mycodo.outputs.pump_pcf8574_fe4921e7 - Output setup on channel 0 and turned OFF (OFF=HIGH)
2023-01-15 10:38:31,035 - INFO - mycodo.outputs.pump_pcf8574_fe4921e7 - Output setup on channel 1 and turned OFF (OFF=HIGH)
2023-01-15 10:38:31,035 - INFO - mycodo.outputs.pump_pcf8574_fe4921e7 - Output setup on channel 2 and turned OFF (OFF=HIGH)
2023-01-15 10:38:31,035 - INFO - mycodo.outputs.pump_pcf8574_fe4921e7 - Output setup on channel 3 and turned OFF (OFF=HIGH)
2023-01-15 10:38:31,035 - INFO - mycodo.outputs.pump_pcf8574_fe4921e7 - Output setup on channel 4 and turned OFF (OFF=HIGH)
2023-01-15 10:38:31,035 - INFO - mycodo.outputs.pump_pcf8574_fe4921e7 - Output setup on channel 5 and turned OFF (OFF=HIGH)
2023-01-15 10:38:31,035 - INFO - mycodo.outputs.pump_pcf8574_fe4921e7 - Output setup on channel 6 and turned OFF (OFF=HIGH)
2023-01-15 10:38:31,035 - INFO - mycodo.outputs.pump_pcf8574_fe4921e7 - Output setup on channel 7 and turned OFF (OFF=HIGH)
2023-01-15 10:38:31,036 - DEBUG - mycodo.outputs.pump_pcf8574_fe4921e7 - List sent to device: {0: True, 1: True, 2: True, 3: True, 4: True, 5: True, 6: True, 7: True}
2023-01-15 10:38:31,036 - INFO - mycodo.outputs.pump_pcf8574_fe4921e7 - Initialized in 395.0 m

Step 4) Channel 1 turned ON for 5 seconds

2023-01-15 10:43:41,413 - DEBUG - mycodo.outputs.pump_pcf8574_fe4921e7 - output_on_off(on, 1, sec, 5.0, 0.0, True)
2023-01-15 10:43:41,414 - DEBUG - mycodo.outputs.pump_pcf8574_fe4921e7 - Output fe4921e7-d54e-4c99-81ef-d3913cfd1876 CH1 (Name) is currently on without an amount. Turning into an amount of 5.0 seconds.
2023-01-15 10:43:46,463 - DEBUG - mycodo.outputs.pump_pcf8574_fe4921e7 - output_on_off(off, 1, None, 0.0, 0.0, True)
2023-01-15 10:43:46,465 - DEBUG - mycodo.outputs.pump_pcf8574_fe4921e7 - state: off, output_type: None, amount: None
2023-01-15 10:43:46,466 - DEBUG - mycodo.outputs.pump_pcf8574_fe4921e7 - Output turned off
2023-01-15 10:43:46,467 - DEBUG - mycodo.outputs.pump_pcf8574_fe4921e7 - List sent to device: {0: True, 1: True, 2: True, 3: True, 4: True, 5: True, 6: True, 7: True}
2023-01-15 10:43:46,468 - DEBUG - mycodo.outputs.pump_pcf8574_fe4921e7 - Output fe4921e7-d54e-4c99-81ef-d3913cfd1876 CH1 (Name) OFF at 2023-01-15 10:43:46. Output returned: None

Now There is no change in output state. The relay should switch ON for 5 Seconds, but it remains off.

Yoy don’t need to edit any code, just upgrade on the upgrade page. You need to do an upgrade to run the latest code. Any logs made before upgrading are no longer relevant since they do not reflect the latest code.

I upgraded to 8.15.1, readdded the module and checked. Still same error.

Hi Kyle.
This Log is when it works perfectly fine. When ON state is initialized as HIGH and Duration 5 sec is send.
2023-01-15 10:33:59,907 - DEBUG - mycodo.outputs.pump_pcf8574_fe4921e7 - output_on_off(on, 1, sec, 5.0, 0.0, True)
2023-01-15 10:33:59,908 - DEBUG - mycodo.outputs.pump_pcf8574_fe4921e7 - state: on, output_type: sec, amount: 5.0
2023-01-15 10:33:59,908 - DEBUG - mycodo.outputs.pump_pcf8574_fe4921e7 - Output turned on
2023-01-15 10:33:59,909 - DEBUG - mycodo.outputs.pump_pcf8574_fe4921e7 - List sent to device: {0: False, 1: True, 2: False, 3: False, 4: False, 5: False, 6: False, 7: False}
2023-01-15 10:33:59,909 - DEBUG - mycodo.outputs.pump_pcf8574_fe4921e7 - Output fe4921e7-d54e-4c99-81ef-d3913cfd1876 CH1 (Name) on for 5.0 seconds. Output returned: None
2023-01-15 10:34:04,949 - DEBUG - mycodo.outputs.pump_pcf8574_fe4921e7 - output_on_off(off, 1, None, 0.0, 0.0, True)
2023-01-15 10:34:04,949 - DEBUG - mycodo.outputs.pump_pcf8574_fe4921e7 - state: off, output_type: None, amount: None
2023-01-15 10:34:04,950 - DEBUG - mycodo.outputs.pump_pcf8574_fe4921e7 - Output turned off
2023-01-15 10:34:04,951 - DEBUG - mycodo.outputs.pump_pcf8574_fe4921e7 - List sent to device: {0: False, 1: False, 2: False, 3: False, 4: False, 5: False, 6: False, 7: False}
2023-01-15 10:34:04,951 - DEBUG - mycodo.outputs.pump_pcf8574_fe4921e7 - Output fe4921e7-d54e-4c99-81ef-d3913cfd1876 CH1 (Name) OFF at 2023-01-15 10:34:04. Output returned: None

This is the log when ON state is initialized as LOW and duration 5 Sec is send. THIS IS WHERE PROBLEM IS. (I GUESS)

2023-01-15 12:37:36,721 - DEBUG - mycodo.outputs.pump_pcf8574_20ab6d01 - output_on_off(on, 1, sec, 5.0, 0.0, True)
2023-01-15 12:37:36,722 - DEBUG -**** mycodo.outputs.pump_pcf8574_20ab6d01 -*** *Output 20ab6d01-0423-4187-b54d-6fb3440c5d45 CH1 (Name) is currently on without an amount. Turning into an amount of 5.0 seconds.
2023-01-15 12:37:41,765 - DEBUG - mycodo.outputs.pump_pcf8574_20ab6d01 - output_on_off(off, 1, None, 0.0, 0.0, True)
2023-01-15 12:37:41,765 - DEBUG - mycodo.outputs.pump_pcf8574_20ab6d01 - state: off, output_type: None, amount: None
2023-01-15 12:37:41,766 - DEBUG - mycodo.outputs.pump_pcf8574_20ab6d01 - Output turned off
2023-01-15 12:37:41,801 - DEBUG - mycodo.outputs.pump_pcf8574_20ab6d01 - List sent to device: {0: False, 1: True, 2: False, 3: False, 4: False, 5: False, 6: False, 7: False}
2023-01-15 12:37:41,802 - DEBUG - mycodo.outputs.pump_pcf8574_20ab6d01 - Output 20ab6d01-0423-4187-b54d-6fb3440c5d45 CH1 (Name) OFF at 2023-01-15 12:37:41. Output returned: None

The differencein two LOGS

-01-15 10:33:59,908 - DEBUG - mycodo.outputs.pump_pcf8574_fe4921e7 - state: on, output_type: sec, amount: 5.0
2023-01-15 10:33:59,908 - DEBUG - mycodo.outputs.pump_pcf8574_fe4921e7 - Output turned on
2023-01-15 10:33:59,909 - DEBUG - mycodo.outputs.pump_pcf8574_fe4921e7 - List sent to device: {0: False, 1: True, 2: False, 3: False, 4: False, 5: False, 6: False, 7: False}

These highlited lines are missing in the problematic instance.

If this is your log line, you are not running the latest code, as this is the log line in the latest code which you should be seeing:


But I am running latest version only.
So what might be the issue?

Sorry, I meant you need to upgrade to master.

Oh… I did that and it is now working absolutely fine.
Thanks for the timely help.

1 Like