Turn on lights for fixed time only?

Hello @ironglass,

Below you can find a sample with the time condition.

{
    "name": "Turn lights on with timer when the garage door is opened",
    "actions": [
        {
            "if": {
                "and":[
                    {
                        "equals": {
                            "left": {
                                "device": {
                                    "devices": [
                                        "device-id-garageDoor"
                                    ],
                                    "component": "main",
                                    "capability": "doorControl",
                                    "attribute": "door"
                                }
                            },
                            "right": {
                                "string": "open"
                            }
                        }
                    },
                    {
                      "between": {
                        "value": {
                          "time": {
                            "reference": "Now"
                          }
                        },
                        "start": {
                          "time": {
                            "reference": "Sunset"
                          }
                        },
                        "end": {
                          "time": {
                            "reference": "Sunrise"
                          }
                        }
                      }
                    }
                ],
                "then": [
                    {
                        "command": {
                            "devices": [
                                "device-id-light1","device-id-light2",...
                            ],
                            "commands": [
                                {
                                    "component": "main",
                                    "capability": "switch",
                                    "command": "on"
                                }
                            ]
                        }
                    },
                    {
                        "sleep": {
                            "duration": {
                                "value": {
                                    "integer": 10
                                },
                                "unit": "Minute"
                            }
                        }
                    },
                    {
                        "command": {
                            "devices": [
                                "device-id-light1","device-id-light2",...
                            ],
                            "commands": [
                                {
                                    "component": "main",
                                    "capability": "switch",
                                    "command": "off"
                                }
                            ]
                        }
                    }
                ]
            }
        }
    ]
}

About the rule syntax, you can check this document where you can find the different conditions and commands you can use.

In this post, you can find another example using this type of condition.