Device timer with reset

Hi, @Positiveground

You can create this automation based on the Rules API. The next Rule example will handle the condition you have specified:

{
    "name": "Timer Rule - Turn off light after 30 minutes",
    "actions": [
        {
            "if": {
                "equals": {
                    "left": {
                        "device": {
                            "devices": ["<deviceId>"],
                            "component": "main",
                            "capability": "switch",
                            "attribute": "switch"
                        }
                    },
                    "right": {
                        "string": "on"
                    }
                },
                "then": [
                    {
                        "sleep": {
                            "durations": {
                                "value": {
                                    "integer": 30
                                },
                                "unit": "Minute"
                            }
                        }
                    },
                    {
                        "command": {
                            "devices": ["<deviceId>"],
                            "commands": [
                                {
                                    "component": "main",
                                    "capability": "switch",
                                    "command": "off",
                                    "arguments": []
                                }
                            ]
                        }
                    }
                ],
                "else": []
            }
        }
    ]
}

At this thread you’ll find a brief step-by-step to create your Rule automation.