{
    "templates": [
        {
            "description": "Turn on something while being present",
            "ruleNameTemplate": "Turn on %1 while %0 reports presence",
            "stateEvaluatorTemplate": {
                "stateDescriptorTemplate": {
                    "interfaceName": "presencesensor",
                    "interfaceState": "isPresent",
                    "selectionId": 0,
                    "operator": "ValueOperatorEquals",
                    "value": true
                }
            },
            "ruleActionTemplates": [
                {
                    "interfaceName": "power",
                    "interfaceAction": "power",
                    "selectionId": 1,
                    "params": [
                        {
                            "name": "power",
                            "value": "true"
                        }
                    ]
                }
            ],
            "ruleExitActionTemplates": [
                {
                    "interfaceName": "power",
                    "interfaceAction": "power",
                    "selectionId": 1,
                    "params": [
                        {
                            "name": "power",
                            "value": "false"
                        }
                    ]
                }
            ]
        },
        {
            "description": "Turn off something when leaving",
            "ruleNameTemplate": "Turn off %1 when %0 reports leaving",
            "eventDescriptorTemplates": [
                {
                    "interfaceName": "presencesensor",
                    "interfaceEvent": "isPresent",
                    "selectionId": 0,
                    "params": [
                        {
                            "name": "isPresent",
                            "value": false,
                            "operator": "ValueOperatorEquals"
                        }
                    ]
                }
            ],
            "ruleActionTemplates": [
                {
                    "interfaceName": "power",
                    "interfaceAction": "power",
                    "selectionId": 1,
                    "params": [
                        {
                            "name": "power",
                            "value": "false"
                        }
                    ]
                }
            ]
        },
        {
            "description": "Turn off everything when leaving",
            "ruleNameTemplate": "Turn off everything when %0 reports leaving",
            "eventDescriptorTemplates": [
                {
                    "interfaceName": "presencesensor",
                    "interfaceEvent": "isPresent",
                    "selectionId": 0,
                    "params": [
                        {
                            "name": "isPresent",
                            "value": false,
                            "operator": "ValueOperatorEquals"
                        }
                    ]
                }
            ],
            "ruleActionTemplates": [
                {
                    "interfaceName": "power",
                    "interfaceAction": "power",
                    "selectionId": 1,
                    "selectionMode": "SelectionModeInterface",
                    "params": [
                        {
                            "name": "power",
                            "value": "false"
                        }
                    ]
                }
            ]
        },
        {
            "description": "Turn off all lights when leaving",
            "ruleNameTemplate": "Turn off all lights when %0 reports leaving",
            "eventDescriptorTemplates": [
                {
                    "interfaceName": "presencesensor",
                    "interfaceEvent": "isPresent",
                    "selectionId": 0,
                    "params": [
                        {
                            "name": "isPresent",
                            "value": false,
                            "operator": "ValueOperatorEquals"
                        }
                    ]
                }
            ],
            "ruleActionTemplates": [
                {
                    "interfaceName": "light",
                    "interfaceAction": "power",
                    "selectionId": 1,
                    "selectionMode": "SelectionModeInterface",
                    "params": [
                        {
                            "name": "power",
                            "value": "false"
                        }
                    ]
                }
            ]
        },
        {
            "description": "Turn on something when arriving",
            "ruleNameTemplate": "Turn on %1 when %0 reports arriving",
            "eventDescriptorTemplates": [
                {
                    "interfaceName": "presencesensor",
                    "interfaceEvent": "isPresent",
                    "selectionId": 0,
                    "params": [
                        {
                            "name": "isPresent",
                            "value": true,
                            "operator": "ValueOperatorEquals"
                        }
                    ]
                }
            ],
            "ruleActionTemplates": [
                {
                    "interfaceName": "power",
                    "interfaceAction": "power",
                    "selectionId": 1,
                    "params": [
                        {
                            "name": "power",
                            "value": "true"
                        }
                    ]
                }
            ]
        }
    ]
}

