{
    "category": "Camera",
    "device_type": "CCD",
    "version": "1.0",
    "templates": [
        {
            "id": "camera_cool",
            "name": "Cool Camera",
            "description": "Cool camera to target temperature with controlled ramping",
            "version": "1.0",
            "category": "Camera",
            "supported_interfaces": [
                2
            ],
            "parameters": [
                {
                    "name": "target_temperature",
                    "type": "number",
                    "default": -10,
                    "min": -50,
                    "max": 50,
                    "step": 1,
                    "unit": "°C",
                    "description": "Target cooling temperature"
                },
                {
                    "name": "tolerance",
                    "type": "number",
                    "default": 0.5,
                    "min": 0.1,
                    "max": 5.0,
                    "step": 0.1,
                    "unit": "°C",
                    "description": "Acceptable temperature deviation"
                },
                {
                    "name": "ramp_slope",
                    "type": "number",
                    "default": 10,
                    "min": 0,
                    "max": 30,
                    "step": 1,
                    "unit": "°C/min",
                    "description": "Maximum temperature change rate"
                },
                {
                    "name": "ramp_threshold",
                    "type": "number",
                    "default": 0.2,
                    "min": 0.1,
                    "max": 2.0,
                    "step": 0.1,
                    "unit": "°C",
                    "description": "Temperature threshold for ramp control"
                },
                {
                    "name": "max_wait_time",
                    "type": "number",
                    "default": 600,
                    "min": 60,
                    "max": 1800,
                    "step": 60,
                    "unit": "seconds",
                    "description": "Maximum time to wait for stabilization"
                }
            ],
            "actions": [
                {
                    "type": "SET",
                    "property": "CCD_TEMP_RAMP",
                    "element": "RAMP_SLOPE",
                    "value": "${ramp_slope}",
                    "timeout": 30,
                    "retries": 2,
                    "failure_action": 1
                },
                {
                    "type": "SET",
                    "property": "CCD_TEMP_RAMP",
                    "element": "RAMP_THRESHOLD",
                    "value": "${ramp_threshold}",
                    "timeout": 30,
                    "retries": 2,
                    "failure_action": 1
                },
                {
                    "type": "SET",
                    "property": "CCD_TEMPERATURE",
                    "element": "CCD_TEMPERATURE_VALUE",
                    "value": "${target_temperature}",
                    "timeout": 30,
                    "retries": 2,
                    "failure_action": 0
                },
                {
                    "type": "EVALUATE",
                    "property": "CCD_TEMPERATURE",
                    "element": "CCD_TEMPERATURE_VALUE",
                    "property_type": 0,
                    "condition": 6,
                    "target": "${target_temperature}",
                    "margin": "${tolerance}",
                    "timeout": "${max_wait_time}",
                    "retries": 0,
                    "failure_action": 0
                },
                {
                    "type": "EVALUATE",
                    "property": "CCD_TEMPERATURE",
                    "element": "STATE",
                    "property_type": 4,
                    "condition": 0,
                    "target": "OK",
                    "timeout": 60,
                    "retries": 2,
                    "failure_action": 0
                }
            ]
        },
        {
            "id": "camera_warm",
            "name": "Warm Camera",
            "description": "Warm camera to ambient temperature with controlled ramping",
            "version": "1.0",
            "category": "Camera",
            "supported_interfaces": [
                2
            ],
            "parameters": [
                {
                    "name": "target_temperature",
                    "type": "number",
                    "default": 20,
                    "min": -10,
                    "max": 50,
                    "step": 1,
                    "unit": "°C",
                    "description": "Target warming temperature (usually ambient)"
                },
                {
                    "name": "tolerance",
                    "type": "number",
                    "default": 2.0,
                    "min": 0.5,
                    "max": 5.0,
                    "step": 0.5,
                    "unit": "°C",
                    "description": "Acceptable temperature deviation"
                },
                {
                    "name": "ramp_slope",
                    "type": "number",
                    "default": 15,
                    "min": 0,
                    "max": 30,
                    "step": 1,
                    "unit": "°C/min",
                    "description": "Maximum temperature change rate"
                },
                {
                    "name": "ramp_threshold",
                    "type": "number",
                    "default": 0.5,
                    "min": 0.1,
                    "max": 2.0,
                    "step": 0.1,
                    "unit": "°C",
                    "description": "Temperature threshold for ramp control"
                },
                {
                    "name": "max_wait_time",
                    "type": "number",
                    "default": 600,
                    "min": 60,
                    "max": 1800,
                    "step": 60,
                    "unit": "seconds",
                    "description": "Maximum time to wait for warming"
                }
            ],
            "actions": [
                {
                    "type": "SET",
                    "property": "CCD_TEMP_RAMP",
                    "element": "RAMP_SLOPE",
                    "timeout": 30,
                    "retries": 2,
                    "failure_action": 1,
                    "value": "${ramp_slope}"
                },
                {
                    "type": "SET",
                    "property": "CCD_TEMP_RAMP",
                    "element": "RAMP_THRESHOLD",
                    "value": "${ramp_threshold}",
                    "timeout": 30,
                    "retries": 2,
                    "failure_action": 1
                },
                {
                    "type": "SET",
                    "property": "CCD_TEMPERATURE",
                    "element": "CCD_TEMPERATURE_VALUE",
                    "value": "${target_temperature}",
                    "timeout": 30,
                    "retries": 2,
                    "failure_action": 0
                },
                {
                    "type": "EVALUATE",
                    "property": "CCD_TEMPERATURE",
                    "element": "CCD_TEMPERATURE_VALUE",
                    "property_type": 0,
                    "condition": 6,
                    "target": "${target_temperature}",
                    "margin": "${tolerance}",
                    "timeout": "${max_wait_time}",
                    "retries": 0,
                    "failure_action": 0
                },
                {
                    "type": "EVALUATE",
                    "property": "CCD_TEMPERATURE",
                    "element": "STATE",
                    "property_type": 4,
                    "condition": 0,
                    "target": "OK",
                    "timeout": 60,
                    "retries": 2,
                    "failure_action": 0
                }
            ]
        },
        {
            "id": "camera_warm_passive",
            "name": "Warm Camera (Passive)",
            "description": "Warm camera by disabling cooling and waiting for the sensor to reach or exceed the target temperature",
            "version": "1.0",
            "category": "Camera",
            "supported_interfaces": [
                2
            ],
            "parameters": [
                {
                    "name": "target_temperature",
                    "type": "number",
                    "default": 20,
                    "min": -10,
                    "max": 50,
                    "step": 1,
                    "unit": "°C",
                    "description": "Target warming temperature (usually ambient)"
                },
                {
                    "name": "max_wait_time",
                    "type": "number",
                    "default": 600,
                    "min": 60,
                    "max": 1800,
                    "step": 60,
                    "unit": "seconds",
                    "description": "Maximum time to wait for passive warming"
                }
            ],
            "actions": [
                {
                    "type": "SET",
                    "property": "CCD_COOLER",
                    "element": "COOLER_OFF",
                    "value": true,
                    "timeout": 30,
                    "retries": 2,
                    "failure_action": 1
                },
                {
                    "type": "EVALUATE",
                    "property": "CCD_TEMPERATURE",
                    "element": "CCD_TEMPERATURE_VALUE",
                    "property_type": 0,
                    "condition": 4,
                    "target": "${target_temperature}",
                    "timeout": "${max_wait_time}",
                    "retries": 0,
                    "failure_action": 0
                }
            ]
        }
    ]
}