# Vicki LoRa

### Get device data

*Request URL:*

```
POST /provider/fetch
```

*Headers:*

```
Content-Type: application/json
Authorization: Bearer {access_token}
```

*Body*:

```
{
  "serial_number" : "{Vicki Serial Number}"
}
```

*Response:*

```
{
    "provider": {
        "mac": "0******6",
        "version": 1,
        "uptime": "2020-11-24T17:35:20.024Z",
        "displayDigits": 23, //digits in range 5-30; to be regarded as Target Temperature
        "temperature": 15.4296875, // ambient temperature in celsius
        "humidity": 99.609375, // relative ambient humidity in %
        "motorRange": 506, // total range of the step motor
        "motorPosition": 0, // current position of the step motor
        "batteryVoltage": 3,
        "ip": "",
        "port": 24189,
        "openWindow": false, //If open window event was detected and the settings
                          are currently executed, field “openWindow” will be true;
        "childLock": false,
        "pendingCommandStatus": {
            "statusOfLastDisplayDigitsCommand": "sent",
            "statusOfLastMotorPositionCommand": "sent",
            "pendingDisplayDigits": null,
            "pendingMotorPosition": null,
            "lastUnsentToDeviceCommand": null
        },
        "online": true,
        "timeOfRecord": "2020-11-24T17:36:00.905Z"
    },
    "_links": {
        "self": {
            "href": "/v1/provider/fetch"
        }
    }
}
```

Vicki high priority command&#x73;**:**

{% content-ref url="vicki/vicki-high-priority-commands" %}
[vicki-high-priority-commands](https://docs.mclimate.eu/mclimate-api-documentation/control-devices-1/vicki/vicki-high-priority-commands)
{% endcontent-ref %}

### Set motor position Only

*Request URL:*

```
POST /provider/send
```

*Headers:*

```
Content-Type: application/json
Authorization: Bearer {access_token}
```

*Body*:

```
{
  "serial_number": “{Vicki Serial Number}”,
  "command" : "set_motor_position_only",
  "position" : 240 // range 0 to motorRange
}
```

*Response:*

```
{
    "provider": [],
    "_links": {
        "self": {
            "href": "/v1/provider/send"
        }
    }
}
```

### Set Target Temperature

*Request URL:*

```
POST /provider/send
```

*Headers:*

```
Content-Type: application/json
Authorization: Bearer {access_token}
```

*Body*:

```
{
  "serial_number": “{Vicki Serial Number}”,
  "command" : "set_motor_position",
  "position" : 25 // digits in range 5-30
}
```

*Response:*

```
{
    "provider": [],
    "_links": {
        "self": {
            "href": "/v1/provider/send"
        }
    }
}
```

### Set Motor Position and Target Temperature

*Request URL:*

```
POST /provider/send
```

*Headers:*

```
Content-Type: application/json
Authorization: Bearer {access_token}
```

*Body*:

```
{
  "serial_number": “{Vicki Serial Number}”,
  "command" : "set_mp_and_tt",
  "motor_position" : 250, // range 0 to motorRange
  "target_temperature": 25 // digits in range 5-30
}
```

*Response:*

```
{
    "provider": [],
    "_links": {
        "self": {
            "href": "/v1/provider/send"
        }
    }
}
```

### Set Open Window

*Request URL:*

```
POST /provider/send
```

*Headers:*

```
Content-Type: application/json
Authorization: Bearer {access_token}
```

*Body*:

```
{
  "serial_number": “{Vicki Serial Number}”,
  "command" : "set_open_window",
  "enabled" : true, // true if we want to enable it or false if we want to 
          disable it
  "close_time": 20, //for how long should the device keep the set motor position
         after it detected an open window event (example value: 20 (if we want
         to have the Vicki at the defined position for 20 minutes));
  "motor_position": 300, //the motor position of the device for the specified time
         after an open window event was detected
  "delta" : 1 // the value of the desired difference in the measured temperature
         (degrees in Celsius)
}
```

*Response:*

```
{
  "provider": [
      254,
      5,
      0,
      0
  ],
  "_links": {
      "self": {
          "href": "/v1/provider/send"
      }
  }
}
```

### Get Open Window

*Request URL:*

```
POST /provider/send
```

*Headers:*

```
Content-Type: application/json
Authorization: Bearer {access_token}
```

*Body*:

```
{
  "serial_number": “{Vicki Serial Number}”,
  "command" : "get_open_window"
}
```

*Response:*

```
{
    "provider": {
        "enabled": true,
        "close_time": 20,
        "motor_position": 300,
        "delta": 1
    },
    "_links": {
        "self": {
            "href": "/v1/provider/send"
        }
    }
}

```

### Child Lock

*Request URL:*

```
POST /provider/send
```

*Headers:*

```
Content-Type: application/json
Authorization: Bearer {access_token}
```

*Body*:

```
{
  "serial_number": “{Vicki Serial Number}”,
  "command" : "child_lock",
  "enabled" : true, // true if we want to enable it or false if we want to 
          disable it
}
```

*Response:*

```
{
  "provider": [
      254,
      5,
      0,
      0
  ],
  "_links": {
      "self": {
          "href": "/v1/provider/send"
      }
  }
}
```

### Set Min/Max Range

*Request URL:*

```
POST /provider/send
```

*Headers:*

```
Content-Type: application/json
Authorization: Bearer {access_token}
```

*Body*:

```
{
  "serial_number": “{Vicki Serial Number}”,
  "command" : "set_range",
  "min" : 10, // the minimum value* for the device range
  "max" : 20 // the maximum value* for the device range
}
```

*\*Note that the min/max values should be between 5 and 30!*

*Response:*

```
{
  "provider": [
      254,
      5,
      0,
      0
  ],
  "_links": {
      "self": {
          "href": "/v1/provider/send"
      }
  }
}
```

### Get Min/Max Range

*Request URL:*

```
POST /provider/send
```

*Headers:*

```
Content-Type: application/json
Authorization: Bearer {access_token}
```

*Body*:

```
{
  "serial_number": “{Vicki Serial Number}”,
  "command" : "get_range"
}
```

*Response:*

```
{
    "provider": {
        "min": 10,
        "max": 20
    },
    "_links": {
        "self": {
            "href": "/v1/provider/send"
        }
    }
}
```

### Summer Mode&#x20;

*Request URL:*

```
POST /provider/send
```

*Headers:*

```
Content-Type: application/json
Authorization: Bearer {access_token}
```

*Body*:

```
{
  "serial_number": “{Vicki Serial Number}”,
  "command" : "summer_mode",
  "enabled:" : true
}
```

*Response:*

```
{
    "provider": {
        "success": true,
        "message": "Vicki was succesfully updated."
    },
    "_links": {
        "self": {
            "href": "/v1/provider/send"
        }
    }
}
```

More info about summer mode command:

{% content-ref url="vicki/summer-mode" %}
[summer-mode](https://docs.mclimate.eu/mclimate-api-documentation/control-devices-1/vicki/summer-mode)
{% endcontent-ref %}

### Force Close Vicki&#x20;

*Request URL:*

```
POST /provider/send
```

*Headers:*

```
Content-Type: application/json
Authorization: Bearer {access_token}
```

*Body*:

```
{
  "serial_number": “{Vicki Serial Number}”,
    "command" : "force_close_vicki"
}
```

*Response:*

```
{
    "provider": [
        254,
        5,
        0,
        0
    ],
    "_links": {
        "self": {
            "href": "/v1/provider/send"
        }
    }
}
```

### Set KeepAlive Time

*Request URL:*

```
POST /provider/send
```

*Headers:*

```
Content-Type: application/json
Authorization: Bearer {access_token}
```

*Body*:

```
{
  "serial_number": “{Vicki Serial Number}”,
  "command" : "set_keepalive_time",
  "time" : 30 // in seconds
}
```

*Response:*

```
{
    "provider": [
        254,
        5,
        0,
        0
    ],
    "_links": {
        "self": {
            "href": "/v1/provider/send"
        }
    }
}
```

### Assign Vicki to Mom

*Request URL:*

```
PATCH /vickies/{Vicki Serial Number}
```

*Headers:*

```
Content-Type: application/json
Authorization: Bearer {access_token}
```

*Body*:

```
{
    "mom_id": 16***3
}
```

*Response:*

```
{
    "vicki": {
        "id": 2*7,
        "controller_id": 1***4,
        "mom_id": 1***3,
        "display_digits": 18,
        "motor_position": 0,
        "motor_range": 0,
        "battery_level": 0,
        "keepalive_time": 60,
        "open_window": "{\"delta\": 1, \"enabled\": false, \"close_time\": 20}",
        "temp_range_min": 5,
        "temp_range_max": 30,
        "algorithm_status": "v1",
        "force_close": 0,
        "dev_eui": null,
        "app_eui": null,
        "app_key": null,
        "network_provider": null
    },
    "_links": {
        "self": {
            "href": "/v1/vickies/ZA*********4L"
        }
    }
}
```
