How to set a condition that triggers on a mqtt plug?

I have a Sonoff S31 plug flashed with tasmota with a sump pump attached to it. Tasmota monitors the power and can be used to turn the pump off. The sump pump itself has a water sensor to know when to turn on. However, the pump is slightly overpowered for my space (as I am only starting part of my growing space while I confirm everything is working). As it is, it drains the sump too quickly and basically ramps on-off while the water is draining. This is bad of course. So what I’d like to do is have tasmota be a middle man to the power. When the pump turns itself on and drains the sump, it will shut off briefly while the sump refills. I want tasmota to see the voltage or amp drop when the pump drops and set a timer to turn off the power for 30 seconds. While the power is off, the water level rises and when the power switches back on, the pump will sense it and turn on. This isn’t a great fix, but it will keep the pump from cycling so much until I can start the whole growing system and the problem removes itself.

For those wondering why I don’t just get a smaller pump for the interim, I did have one but it died (poor quality chinese pump I guess). Money is tight right now and I don’t want to spend more money on something that I will only use for a few weeks at the most.

Can anyone help me figure out how to do this in Mycodo?

This is exactly what the pump is designed to do, so why do you think this is “bad”?
Can you simply add a valve that reduces the outflow of the pump so that it doesn’t drain too fast? Seems like that would be the easiest way to fix your problem.

Can you please explain in more detail how your system is setup? I don’t understand what the sump is for and why it needs a pump to drain. Are you talking about a drain-to-waste type system for soil growing where you are not recycling your runoff? How large is the sump? Can you disable the water sensor on the pump, or simply leave the pump turned off at the Tasmota device, and then allow the sump to completely fill after your watering cycle and then turn the pump on after a set amount of time has passed after your watering cycle to ensure that everything has drained to the sump? Can you just eliminate the sump altogether and have your water drain directly to the outflow line that is currently connected to your pump? Seems like there should be a few ways to accomplish what you want to do without it being so complicated. But we need more details on how your system is setup.

This is really a Tasmota question, not a Mycodo question. Best place to ask this is in the Tasmota Discord or on their github page. What you want to do could possibly be done using Tasmota Rules. or by writing a Berry script and installing it on your Tasmota device.

Currently, Mycodo can not actively monitor the device state of Tasmota devices… If you want to do this from Mycodo, you would need to write a custom Input or Output that can monitor the Tasmota device state and perform any actions you want it to do. Mycodo can turn on/off an Output attached to a Tasmota device using the MQTT Output module in Mycodo, and Mycodo can receive measurements from a sensor attached to a Tasmota device using the MQTT Input modules in Mycodo. But currently Mycodo has no way of actually monitoring whether that Tasmota device is actually on or off by checking the device state.
I think simply adding a flow restrictor valve on your pump will be the least complicated way to accomplish what you have described.

I believe the pump is normally used to turn on in a flood event, so on/off occassionally. For my setup, each hour the plants get watered and drain to the sump and this pump pumps it back to the main tank. However, it pumps faster than the drain speed. So it will pump once the water starts draining, suck it up, shut off, then turn on 3 seconds later. That cycle continues until the draining stops. So in that time, it turns on-off 15 or so times. Every hour. Perhaps I am remembering incorrectly, but I thought it was not a good idea to cycle pumps so often. Manually timing the pump by unplugging for roughly 15sec once it turns off the first time and I was able to have it drain while only having to turn on 2 more times (3 on periods total). Figuring out how to automate that is the tough part.

The flow restrictor sounds like a MUCH simpler answer. I will look into that.

1 Like

If restricting the flow isn’t an option, you could place a Y fitting in the output pipe and direct some of the water back into the sump. Place a valve on the pipe returning to the reservoir and you can adjust the flow.

1 Like

Is there any way you can raise your plants up on a riser or shelf to a height just above your reservoir so that you can simply drain them directly back into the reservoir? Then you could simply eliminate the sump and pump altogether. Something similar to a Dutch Bucket type setup?
image