Run pump x min on, x min off on continuous loop?

Hello, @mpnret

Another approach that you could try to develop your automation, is the Rules API. With it, you can define your conditional statements in a simple JSON format.

See the example below that describes the next workflow:

  1. If GE-SmartSwith is ON
  2. Wait 1 minute and turn OFF
  3. Wait 19 minutes and turn ON

This basic Rule will maintain the loop active, as it detects the switch state as ON.

{
    "name": "Example Pump Automation - Turn ON for 1 minute - Turn OFF for 19 minutes",
    "actions": [
        {
            "if": {
                "equals": {
                    "left": {
                        "device": {
                            "devices": ["Your-GE-SmartSwitch-ID"],
                            "component": "main",
                            "capability": "switch",
                            "attribute": "switch"
                        }
                    },
                    "right": {
                        "string": "on"
                    }
                }
            },
            "then": [
                {
                    "sleep": {
                        "duration": {
                            "value": {
                                "integer": 1
                            },
                            "unit": "Minute"
                        }
                    }
                },
                {
                    "command": {
                        "devices": ["Your-GE-SmartSwitch-ID"],
                        "commands": {
                            "component": "main",
                            "capability": "switch",
                            "command": "off",
                            "arguments": []
                        }
                    }
                },
                {
                    "sleep": {
                        "duration": {
                            "value": {
                                "integer": 19
                            },
                            "unit": "Minute"
                        }
                    }
                },
                {
                    "command": {
                        "devices": ["Your-GE-SmartSwitch-ID"],
                        "commands": {
                            "component": "main",
                            "capability": "switch",
                            "command": "on",
                            "arguments": []
                        }
                    }
                }
            ]
        }
    ]
}

I hope this results useful to you,
Erick.

1 Like