현재 페이지는 v1 설명 페이지 입니다. 
v1 버전은 v2가 적용되는 시점에 Deprecate 될 수 있습니다.

소개

해줌 API 서비스에 대한 튜토리얼 문서입니다.
현재 발전소 등록과 발전량 예측에 대한 API를 제공합니다.


ID, PASSWORD 생성

해줌 API 서비스를 이용하기 위해서 먼저 회원 가입을 통해 ID와 PASSWORD를 생성해야 합니다.
테스트 기간에는 해줌에서 직접 ID와 PASSWORD를 발급해드리니 해줌 담당자에게 별도 문의해 주시기 바랍니다.


인증하기

생성된 ID로 인증 토큰을 획득합니다.
발전소 등록 및 발전량 예측 API를 호출할 때, 인증 API를 통해 받은 토큰의 값을 전송해야 합니다.
해당 토큰값은 40자리의 숫자, 문자의 조합으로 되어 있습니다.

curl -X POST "https://api.haezoom.io/v1/api-token-auth/" -H "accept: application/json" -H "Content-Type: application/x-www-form-urlencoded" -d "username=USER_NAME&password=PASSWORD"
import requests

username = 'USER_NAME'
password = 'PASSWORD'
url = 'https://api.haezoom.io/v1/api-token-auth/'
data = {'username': username, 'password': password}
res = requests.post(url, data=data)
const request = require('request');

const options = {
    uri: 'https://api.haezoom.io/v1/api-token-auth/',
    method: 'POST',
    form: {
        'username': 'username',
        'password': 'password',
    },
    headers: {
        'Content-Type': 'application/json; charset=utf-8'
    }
}

request.post(options, function(err,httpResponse,body){
    console.log(body);
});
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.Charset;

import javax.net.ssl.HttpsURLConnection;

public class HttpConn {

    public static void main(String[] args) throws Exception{

        String url = "https://api.haezoom.io/v1/api-token-auth/";
        String urlParameters = "username=username&password=password";
        URL obj = new URL(url);

        HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
        con.setRequestMethod("POST");
        con.setDoOutput(true);

        DataOutputStream wr = new DataOutputStream(con.getOutputStream());
        wr.writeBytes(urlParameters);
        wr.flush();
        wr.close();

        int responseCode = con.getResponseCode();
        System.out.println("\nSending 'POST' request to URL : " + url);
        System.out.println("Post parameters : " + urlParameters);
        System.out.println("Response Code : " + responseCode);

        Charset charset = Charset.forName("UTF-8");
        BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream(),charset));
        String inputLine;
        StringBuffer response = new StringBuffer();

        while ((inputLine = in.readLine()) != null) {
            response.append(inputLine);
        }
        in.close();
        System.out.println(response.toString());
    }
}

Response

{
  "token": "be27e3daf7ee23acdeafd2cebc21a78528373344"
}


발전소 등록

발전량 예측을 하기 위해서 먼저 발전소를 등록해야 합니다.
간편하게 발전소 등록을 할 수 있는 API를 제공합니다.

입력값은 아래와 같습니다.

{
  "plant": {
    "address":          "String - 설치 주소 ",
    "description":      "String - 발전소 설명",
    "latitude":         "(필수)float - 발전소 위도",
    "longitude":        "(필수)float - 발전소 경도",
    "name":             "(필수)String - 발전소 이름",
    "options": {
      "azimuth":        "float - 방위각",
      "tilt":           "float - 각도"
    }
  },
  "inverters": [
    {
      "capacity":       "(필수)float - 인버터 용량, 단위: kW ",
      "description":    "String - 인버터 설명 ",
      "name":           "String - 인버터 이름 ",
      "virtual":        "int (0 or 1, 1이 가상. default는 0) - 가상인버터"
    }
  ]
}


참고

등록시 name, latitude, longitude의 값이 동일한 발전소가 있을 경우 중복으로 처리되어 등록되지 않습니다.

azimuth는 방위각을 의미하며, 정북방향 0도를 기준으로 시계방향으로 계산합니다. tilt는 경사각을 의미하며, 수평이 0도입니다.
(예제코드인 방위각 180도, 경사각 18도는 최대 발전량과는 관계 없는 단순한 예제입니다.)

인버터의 capacity(용량)는 출력용량 기준(모듈 기준)입니다.

ex) 인버터가 여러 대 이고 각 출력값을 정확히 알 경우: 각 인버터의 출력 용량에 정확한 값을 입력 (아래 json 참고)

{
  "plant": {
    "latitude": 37.12451,
    "longitude": 127.05912,
    "name": "발전소 이름",
    "options": {
      "azimuth": 180,
      "tilt": 18
    }
  },
  "inverters": [
    {
      "capacity": 24.3
    },
    {
      "capacity": 24.8
    },
    {
      "capacity": 23.9
    },
    {
      "capacity": 26.1
    }
  ]
}

ex) 인버터가 여러 대 이고 각 출력값을 정확히 모를 경우: 각 인버터의 총 출력 용량 합이 발전소의 총 출력 용량이 되도록 임의로 인버터의 출력 용량을 설정합니다. 그리고 inverter의 virtual 값을 1로 넣습니다. (ex: 발전소 출력 용량: 99.1 kW, 인버터 4대, 인버터의 제품 용량이 25 kW이라고 한다면, 인버터들의 출력 용량을 25, 25, 25, 24.1으로 각각 넣습니다.)

{
  "plant": {
    "latitude": 37.12451,
    "longitude": 127.05912,
    "name": "발전소 이름",
    "options": {
      "azimuth": 180,
      "tilt": 18
    }
  },
  "inverters": [
    {
      "capacity": 25.0,
      "virtual": 1
    },
    {
      "capacity": 25.0,
      "virtual": 1
    },
    {
      "capacity": 25.0,
      "virtual": 1
    },
    {
      "capacity": 24.1,
      "virtual": 1
    }
  ]
}

curl -X POST "https://api.haezoom.io/v1/plant/" -H "accept: application/json" -H "Content-Type: application/json" -H "Authorization: Token be27e3daf7ee23acdeafd2cebc21a78528373344" -d "{ \"inverters\": [ { \"capacity\": 24.1, \"description\": \"basic test1\", \"name\": \"basic test1\" }, { \"capacity\": 25.0, \"description\": \"basic test2\", \"name\": \"basic test2\" }, { \"capacity\": 25.0, \"description\": \"basic test2\", \"name\": \"basic test2\" } ], \"plant\": { \"address\": \"발전소주소\", \"description\": \"\", \"latitude\": 37.11, \"longitude\": 126.11, \"name\": \"해줌발전소\", \"options\": { \"azimuth\": 180, \"tilt\": 18 }}}"
import requests

url = 'https://api.haezoom.io/v1/plant/'
data = json.dumps({
    "plant": {
        "address": "발전소주소",
        "description": "",
        "latitude": 37.11,
        "longitude": 126.11,
        "name": "해줌발전소",
        "options": {
            "azimuth": 180,
            "tilt": 18
        }
    },
    "inverters": [
        {
            "capacity": 24.1,
            "description": "basic test1",
            "name": "basic test1"
        },
        {
            "capacity": 25.0,
            "description": "basic test2",
            "name": "basic test2"
        },
        {
            "capacity": 25.0,
            "description": "basic test2",
            "name": "basic test2"
        }
    ]
})

token = 'be27e3daf7ee23acdeafd2cebc21a78528373344'
headers = {'Authorization': 'Token ' + token, 'Content-Type': 'application/json; charset=utf-8'}

res = requests.post(url, headers=headers, data=data.encode('utf-8'))
var request = require('request');

const token = 'be27e3daf7ee23acdeafd2cebc21a78528373344'

var form = {
    "plant": {
        "latitude": 37.12451,
        "longitude": 127.05912,
        "name": "발전소 이름",
        "options": {
            "azimuth": 180,
            "tilt": 18
        }
    },
    "inverters": [
        {
            "capacity": 24.3
        }
    ]
};

request({
    headers: {
        'Content-Type': 'application/json; charset=utf-8',
        'Authorization': 'Token ' + token
    },
    uri: 'https://api.haezoom.io/v1/plant/',
    body: form,
    method: 'POST',
    json:true
}, function (err, res, body) {
    console.log(body);
});
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.io.OutputStream;
import java.net.MalformedURLException;
import java.io.IOException;

public class HttpConn {

    public static void main(String[] args) throws Exception{

        try {

            URL url = new URL("https://api.haezoom.io/v1/plant/");
            HttpURLConnection conn = (HttpURLConnection) url.openConnection();
            conn.setDoOutput(true);
            conn.setRequestMethod("POST");
            conn.setRequestProperty("Content-Type", "application/json");
            conn.setRequestProperty("accept", "application/json");
            conn.setRequestProperty("Authorization", "Token be27e3daf7ee23acdeafd2cebc21a78528373344");

            String input = "{ \"inverters\": [ { \"capacity\": 24.1, \"description\": \"basic test1\", \"name\": \"basic test1\" }, { \"capacity\": 25.0, \"description\": \"basic test2\", \"name\": \"basic test2\" }, { \"capacity\": 25.0, \"description\": \"basic test2\", \"name\": \"basic test2\" } ], \"plant\": { \"address\": \"발전소주소\", \"description\": \"\", \"latitude\": 37.11, \"longitude\": 126.11, \"name\": \"해줌발전소\", \"options\": { \"azimuth\": 180, \"tilt\": 18 }}}";

            OutputStream os = conn.getOutputStream();
            os.write(input.getBytes());
            os.flush();

            if (conn.getResponseCode() != HttpURLConnection.HTTP_CREATED) {
                throw new RuntimeException("Failed : HTTP error code : "
                        + conn.getResponseCode());
            }

            BufferedReader br = new BufferedReader(new InputStreamReader(
                    (conn.getInputStream())));

            String output;
            System.out.println("Output from Server .... \n");
            while ((output = br.readLine()) != null) {
                System.out.println(output);
            }
            conn.disconnect();
        } catch (MalformedURLException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

Response

{
  "status": "success",
  "code": 201,
  "result": {
    "plant": {
      "id": 2,
      "created": "2019-05-23T10:10:10+09:00",
      "name": "해줌발전소",
      "description": "",
      "install_date": "2019-05-23",
      "address": "발전소주소",
      "latitude": 37.11,
      "longitude": 126.11,
      "capacity": 74.1,
      "options": {
        "azimuth": 180,
        "tilt": 18
      }
    },
    "inverters": [
      {
        "id": 4,
        "name": "basic test1",
        "capacity": 24.1,
        "description": "basic test1",
        "virtual": 0
      },
      {
        "id": 5,
        "name": "basic test2",
        "capacity": 25,
        "description": "basic test2",
        "virtual": 0
      },
      {
        "id": 6,
        "name": "basic test2",
        "capacity": 25,
        "description": "basic test2",
        "virtual": 0
      }
    ]
  }
}

발전소 조회

발전소를 조회합니다.
등록한 전체 발전소의 정보를 리스트로 반환합니다.

curl -X GET https://api.haezoom.io/v1/plant/ -H "Authorization: Token be27e3daf7ee23acdeafd2cebc21278528373344" -H "accept: application/json" -H "Content-Type: application/x-www-form-urlencoded"
import requests

url = 'https://api.haezoom.io/v1/plant/'
token = 'be27e3daf7ee23acdeafd2cebc21a78528373344'
headers = {'Authorization': 'Token ' + token, 'Content-Type': 'application/json; charset=utf-8'}

res = requests.get(url, headers=headers)
const request = require('request');
const token = 'be27e3daf7ee23acdeafd2cebc21a78528373344'

const options = {
    uri: 'https://api.haezoom.io/v1/plant/',
    headers: {
        'Content-Type': 'application/json; charset=utf-8',
        'Authorization': 'Token ' + token,
    }
};

request(options,function(err,response,body){
    console.log(body);
})
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.io.OutputStream;
import java.net.MalformedURLException;
import java.io.IOException;

public class HttpConn {

    public static void main(String[] args) throws Exception{

        try {

            URL url = new URL("https://api.haezoom.io/v1/plant/");
            HttpURLConnection conn = (HttpURLConnection) url.openConnection();
            conn.setDoOutput(true);
            conn.setRequestMethod("GET");
            conn.setRequestProperty("Content-Type", "application/json");
            conn.setRequestProperty("accept", "application/json");
            conn.setRequestProperty("Authorization", "Token be27e3daf7ee23acdeafd2cebc21278528373344");
            int responseCode = conn.getResponseCode();

            BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
            String inputLine;
            StringBuffer response = new StringBuffer();
            while ((inputLine = in.readLine()) != null) {
                response.append(inputLine);
            }
            in.close();

            System.out.println("HTTP 응답 코드 : " + responseCode);
            System.out.println("HTTP body : " + response.toString());


        } catch (MalformedURLException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

Response

{
  "status": "success",
  "code": 200,
  "result": {
    "total": 159,
    "last_page": 159,
    "page": 1,
    "limit": 1,
    "data": [
      {
        "id": 1,
        "created": "2019-05-23T10:10:10+09:00",
        "name": "해줌발전소",
        "description": "",
        "install_date": "2019-05-23",
        "address": "발전소주소",
        "latitude": 37.11,
        "longitude": 126.11,
        "capacity": 74.1,
        "options": {
          "modules": {
            "azimuth": 180,
            "capacity": 360,
            "tilt": 18
          },
          "strings": {
            "azimuth": 180,
            "tilt": 18
          }
        }
      },
      {
        "id": 2,
        "created": "2019-06-04T14:10:48+09:00",
        "name": "해줌발전소2",
        "description": "",
        "install_date": "2019-06-04",
        "address": "발전소주소",
        "latitude": 37.11,
        "longitude": 126.11,
        "capacity": 222.3,
        "options": {
          "modules": {
            "azimuth": 180,
            "capacity": 360,
            "tilt": 18
          },
          "strings": {
            "azimuth": 180,
            "tilt": 18
          }
        }
      }
    ]
  }
}

등록한 발전소를 조회합니다.
발전소 ID에 따라 해당 발전소의 정보를 반환합니다.

curl -X GET https://api.haezoom.io/v1/plant/1/ -H "Authorization: Token be27e3daf7ee23acdeafd2cebc21278528373344" -H "accept: application/json" -H "Content-Type: application/x-www-form-urlencoded"
import requests

url = 'https://api.haezoom.io/v1/plant/1/'
token = 'be27e3daf7ee23acdeafd2cebc21a78528373344'
headers = {'Authorization': 'Token ' + token, 'Content-Type': 'application/json; charset=utf-8'}

res = requests.get(url, headers=headers)
const request = require('request');
const token = 'be27e3daf7ee23acdeafd2cebc21a78528373344'

const options = {
    uri: 'https://api.haezoom.io/v1/plant/1/',
    headers: {
        'Content-Type': 'application/json; charset=utf-8',
        'Authorization': 'Token ' + token,
    }
};

request(options,function(err,response,body){
    console.log(body);
})
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.io.OutputStream;
import java.net.MalformedURLException;
import java.io.IOException;

public class HttpConn {

    public static void main(String[] args) throws Exception{

        try {

            URL url = new URL("https://api.haezoom.io/v1/plant/1/");
            HttpURLConnection conn = (HttpURLConnection) url.openConnection();
            conn.setDoOutput(true);
            conn.setRequestMethod("GET");
            conn.setRequestProperty("Content-Type", "application/json");
            conn.setRequestProperty("accept", "application/json");
            conn.setRequestProperty("Authorization", "Token be27e3daf7ee23acdeafd2cebc21278528373344");
            int responseCode = conn.getResponseCode();

            BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
            String inputLine;
            StringBuffer response = new StringBuffer();
            while ((inputLine = in.readLine()) != null) {
                response.append(inputLine);
            }
            in.close();

            System.out.println("HTTP 응답 코드 : " + responseCode);
            System.out.println("HTTP body : " + response.toString());


        } catch (MalformedURLException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

Response

{
  "status": "success",
  "code": 200,
  "result": {
    "plant": {
      "id": 1,
      "created": "2019-05-23T10:10:10+09:00",
      "name": "해줌발전소",
      "description": "",
      "install_date": "2019-05-23",
      "address": "발전소주소",
      "latitude": 37.11,
      "longitude": 126.11,
      "capacity": 74.1,
      "options": {
        "modules": {
          "azimuth": 180,
          "capacity": 360,
          "tilt": 18
        },
        "strings": {
          "azimuth": 180,
          "tilt": 18
        }
      }
    },
    "inverters": [
      {
        "id": 1,
        "name": "basic test1",
        "capacity": 24.1,
        "description": "basic test1",
        "virtual": 0
      },
      {
        "id": 2,
        "name": "basic test2",
        "capacity": 25,
        "description": "basic test2",
        "virtual": 0
      },
      {
        "id": 3,
        "name": "basic test2",
        "capacity": 25,
        "description": "basic test2",
        "virtual": 0
      }
    ]
  }
}


발전량 예측

현재 시간으로부터 +3일 시간까지 예측된 발전량을 구합니다.
시간 포맷은 ISO 8601 형태로 출력됩니다. (+09:00은 한국시간을 의미합니다)

curl -X GET "https://api.haezoom.io/v1/predict/?pid=2" -H "accept: application/json" -H "Authorization: Token be27e3daf7ee23acdeafd2cebc21a78528373344"
import requests

url = 'https://api.haezoom.io/v1/predict/'

token = 'be27e3daf7ee23acdeafd2cebc21a78528373344'
headers = {'Authorization': 'Token ' + token, 'Content-Type': 'application/json; charset=utf-8'}
res = requests.get(url, {'pid': 2}, headers=headers)
const request = require('request');
const token = 'be27e3daf7ee23acdeafd2cebc21a78528373344'

const options = {
    uri: 'https://api.haezoom.io/v1/predict/',
    headers: {
        'Content-Type': 'application/json; charset=utf-8',
        'Authorization': 'Token ' + token,
    },
    qs: {
        pid:2
    }
};

request(options,function(err,response,body){
    console.log(body);
})
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.MalformedURLException;
import java.io.IOException;

public class HttpConn {

    public static void main(String[] args) throws Exception{

        try {

            URL url = new URL("https://api.haezoom.io/v1/predict/?pid=2");
            HttpURLConnection conn = (HttpURLConnection) url.openConnection();
            conn.setDoOutput(true);

            conn.setRequestMethod("GET");
            conn.setRequestProperty("Content-Type", "application/json");
            conn.setRequestProperty("accept", "application/json");
            conn.setRequestProperty("Authorization", "Token be27e3daf7ee23acdeafd2cebc21278528373344");
            int responseCode = conn.getResponseCode();

            BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
            String inputLine;
            StringBuffer response = new StringBuffer();
            while ((inputLine = in.readLine()) != null) {
                response.append(inputLine);
            }
            in.close();

            System.out.println("HTTP 응답 코드 : " + responseCode);
            System.out.println("HTTP body : " + response.toString());


        } catch (MalformedURLException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

Response

{
  "status": "success",
  "code": 200,
  "result": {
      "conditions": {
        "pid": "2",
        "timestampType": "end",
        "start": "2019-05-23T18:00:00+09:00",
        "end": "2019-05-26T16:00:00+09:00",
        "ref": "2019-05-22T18:00:00+00:00",
        "timezone": "Asia/Seoul",
        "interval": 60,
        "applied": {
          "tilt": [
            18,
            18,
            18
          ],
          "azimuth": [
            180,
            180,
            180
          ]
        }
      },
      "predict": {
        "date": [
          "2019-05-23T18:00:00+09:00",
          "2019-05-23T19:00:00+09:00",
          "2019-05-23T20:00:00+09:00",
          "2019-05-23T21:00:00+09:00",
          "2019-05-23T22:00:00+09:00",
          "2019-05-23T23:00:00+09:00",
          "2019-05-24T00:00:00+09:00",
          "2019-05-24T01:00:00+09:00",
          "2019-05-24T02:00:00+09:00",
          "2019-05-24T03:00:00+09:00",
          "2019-05-24T04:00:00+09:00",
          "2019-05-24T05:00:00+09:00",
          "2019-05-24T06:00:00+09:00",
          "2019-05-24T07:00:00+09:00",
          "2019-05-24T08:00:00+09:00",
          "2019-05-24T09:00:00+09:00",
          "2019-05-24T10:00:00+09:00",
          "2019-05-24T11:00:00+09:00",
          "2019-05-24T12:00:00+09:00",
          "2019-05-24T13:00:00+09:00",
          "2019-05-24T14:00:00+09:00",
          "2019-05-24T15:00:00+09:00",
          "2019-05-24T16:00:00+09:00",
          "2019-05-24T17:00:00+09:00",
          "2019-05-24T18:00:00+09:00",
          "2019-05-24T19:00:00+09:00",
          "2019-05-24T20:00:00+09:00",
          "2019-05-24T21:00:00+09:00",
          "2019-05-24T22:00:00+09:00",
          "2019-05-24T23:00:00+09:00",
          "2019-05-25T00:00:00+09:00",
          "2019-05-25T01:00:00+09:00",
          "2019-05-25T02:00:00+09:00",
          "2019-05-25T03:00:00+09:00",
          "2019-05-25T04:00:00+09:00",
          "2019-05-25T05:00:00+09:00",
          "2019-05-25T06:00:00+09:00",
          "2019-05-25T07:00:00+09:00",
          "2019-05-25T08:00:00+09:00",
          "2019-05-25T09:00:00+09:00",
          "2019-05-25T10:00:00+09:00",
          "2019-05-25T11:00:00+09:00",
          "2019-05-25T12:00:00+09:00",
          "2019-05-25T13:00:00+09:00",
          "2019-05-25T14:00:00+09:00",
          "2019-05-25T15:00:00+09:00",
          "2019-05-25T16:00:00+09:00",
          "2019-05-25T17:00:00+09:00",
          "2019-05-25T18:00:00+09:00",
          "2019-05-25T19:00:00+09:00",
          "2019-05-25T20:00:00+09:00",
          "2019-05-25T21:00:00+09:00",
          "2019-05-25T22:00:00+09:00",
          "2019-05-25T23:00:00+09:00",
          "2019-05-26T00:00:00+09:00",
          "2019-05-26T01:00:00+09:00",
          "2019-05-26T02:00:00+09:00",
          "2019-05-26T03:00:00+09:00",
          "2019-05-26T04:00:00+09:00",
          "2019-05-26T05:00:00+09:00",
          "2019-05-26T06:00:00+09:00",
          "2019-05-26T07:00:00+09:00",
          "2019-05-26T08:00:00+09:00",
          "2019-05-26T09:00:00+09:00",
          "2019-05-26T10:00:00+09:00",
          "2019-05-26T11:00:00+09:00",
          "2019-05-26T12:00:00+09:00",
          "2019-05-26T13:00:00+09:00",
          "2019-05-26T14:00:00+09:00",
          "2019-05-26T15:00:00+09:00",
          "2019-05-26T16:00:00+09:00"
        ],
        "plant": {
          "id": "2",
          "name": "해줌발전소",
          "predictYield": {
            "total": 1086.5361070897613,
            "data": [
              17.307674527773884,
              5.872145005939646,
              0.6959894049484202,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              1.815830395419205,
              8.078328300044046,
              20.324897916195617,
              33.176876425902655,
              41.22027673896458,
              48.01500974215932,
              52.340578750470485,
              51.994946178359804,
              49.07296539068097,
              42.30435904202727,
              30.841638031188214,
              17.276840398806513,
              5.92627556543516,
              0.6961027010546167,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              1.4806364319705683,
              5.787219805081821,
              11.612000516572213,
              19.94416797003828,
              29.54104874597961,
              38.370933210421335,
              44.23425065525295,
              45.658896990672275,
              43.619497934603395,
              37.20724479310887,
              27.539063063815462,
              16.679093896621517,
              6.3160658217478165,
              0.6950065039979153,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              1.825587392928441,
              8.060142099535197,
              20.178180154999385,
              32.277654437612256,
              39.26079970552459,
              45.167272475828966,
              49.25375452406557,
              49.497307986247165,
              46.28948918038841,
              39.08005827737682
            ]
          }
        },
        "inverters": [
          {
            "id": 4,
            "name": "basic test1",
            "capacity": 24.1,
            "predictYield": {
              "total": 353.38083914795214,
              "data": [
                5.629081729006081,
                1.909833935804932,
                0.22636092657566706,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0.5905737183482165,
                2.6273645348321386,
                6.610391899869289,
                10.790320133120838,
                13.406324823333959,
                15.616217743401346,
                17.023049229235337,
                16.910637016173702,
                15.960303183743742,
                13.758907596664738,
                10.030816147795358,
                5.619053355077422,
                1.9274391515113007,
                0.2263977745670211,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0.48155651836019836,
                1.8822131889672316,
                3.776642543176657,
                6.486564751388968,
                9.607817473388778,
                12.479615254671444,
                14.386578148334634,
                14.849924662283424,
                14.186638329607852,
                12.101141693845124,
                8.956699323049293,
                5.424644573665028,
                2.054213040541463,
                0.22604125163764857,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0.5937470468228803,
                2.621449724680138,
                6.562673977536911,
                10.497860620060125,
                12.769032022984382,
                14.690030589304698,
                16.019102348582734,
                16.098314743165407,
                15.05501604922214,
                12.710248373613783
              ]
            }
          },
          {
            "id": 5,
            "name": "basic test2",
            "capacity": 25,
            "predictYield": {
              "total": 366.57763397090457,
              "data": [
                5.839296399383901,
                1.981155535067357,
                0.2348142391863766,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0.6126283385354944,
                2.725481882605953,
                6.8572530081631635,
                11.19327814639091,
                13.90697595781531,
                16.19939599937899,
                17.658764760617572,
                17.54215458109305,
                16.556331103468615,
                14.272725722681265,
                10.405410941696427,
                5.828893521864545,
                1.9994182069619302,
                0.2348524632437978,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0.499539956805185,
                1.9525033080572947,
                3.9176789866977773,
                6.728801609324656,
                9.966615636295414,
                12.945658977874945,
                14.92383625345916,
                15.404486164194424,
                14.716429802497771,
                12.55305154963187,
                9.291181870383083,
                5.627224661478245,
                2.1309263906031766,
                0.23448262618013335,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0.6159201730527804,
                2.7193461874275293,
                6.8077530887312365,
                10.889896908776066,
                13.245883841270105,
                15.238620943262132,
                16.61732608774142,
                16.699496621540877,
                15.617236565583134,
                13.184904951881517
              ]
            }
          },
          {
            "id": 6,
            "name": "basic test2",
            "capacity": 25,
            "predictYield": {
              "total": 366.57763397090457,
              "data": [
                5.839296399383901,
                1.981155535067357,
                0.2348142391863766,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0.6126283385354944,
                2.725481882605953,
                6.8572530081631635,
                11.19327814639091,
                13.90697595781531,
                16.19939599937899,
                17.658764760617572,
                17.54215458109305,
                16.556331103468615,
                14.272725722681265,
                10.405410941696427,
                5.828893521864545,
                1.9994182069619302,
                0.2348524632437978,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0.499539956805185,
                1.9525033080572947,
                3.9176789866977773,
                6.728801609324656,
                9.966615636295414,
                12.945658977874945,
                14.92383625345916,
                15.404486164194424,
                14.716429802497771,
                12.55305154963187,
                9.291181870383083,
                5.627224661478245,
                2.1309263906031766,
                0.23448262618013335,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0.6159201730527804,
                2.7193461874275293,
                6.8077530887312365,
                10.889896908776066,
                13.245883841270105,
                15.238620943262132,
                16.61732608774142,
                16.699496621540877,
                15.617236565583134,
                13.184904951881517
              ]
            }
          }
        ]
      }
    }
}

참고

발전량 시간 구분방법
- 2019-05-25T13:00:00+09:00의 값은 12시~13까지의 발전량을 의미합니다.

발전량 시간 타입(timestampType): 13:00~14:00의 발전량일 때, start일 경우 13:00로 표기되고, end일 경우 14:00로 표기 됩니다. 기본값은 end입니다.

최초 발전소 등록 후 발전량 예측에 필요한 데이터 수집에 최소 20분에서 최대 6시간이 소요되며, 수집 이후부터 발전량 예측 데이터를 확인 할 수 있습니다.

ref는 발전량 예측에 사용한 gfs 데이터의 시간이며, 데이터에 표기된 시간으로 출력하고 있습니다.(+00:00)
ref의 데이터 업데이트 시점은 다음과 같습니다. (UTC 00:00, 06:00. 12:00, 18:00)

발전량 예측 데이터가 없을시 API의 http code 반환 값은 204이며 body 데이터는 없습니다.


데이터

현재 시간으로부터 최대 +3일 시간까지 예측 발전량에 쓰이는 데이터를 반환합니다.

파라미터 필수여부 타입 default 설명
id O int 발전소 id
type O string preprocess 데이터 종류 (origin_gfs / origin_ldaps / preprocess)
start X datetime 현재시간 데이터 시작일 (ex: 2022-03-10T00:00:00+09:00)
end X datetime 현재시간+3일 데이터 종료일 (ex: 2022-03-11T00:00:00+09:00)
ref X datetime 현재시간 예측 기준 (ex: 2022-03-10T00:00:00+09:00)
type의 선택에 따라 다음의 데이터를 제공합니다.

* preprocess는 해줌의 알고리즘을 적용한 예측 일사량
* origin_gfs는 미국 국립 해양 기상청의 수치예보 데이터
* origin_ldpas는 한국 기상청의 국지예보모델 데이터
  • gfs / preprocess 데이터는 start와 end는 최대 3일의 간격을 넘을 수 없습니다.
  • ldaps 데이터는 start와 end는 최대 2일의 간격을 넘을 수 없습니다.
  • ref는 데이터를 보는 기준점으로 데이터가 생성된 시간입니다.
    가장 최적의 값은 start 파라미터와 동일한 값입니다.
  • 모든 데이터는 plant를 등록한 시점부터 생성됩니다.

시간 포맷은 ISO 8601 형태로 출력됩니다. (+09:00은 한국시간을 의미합니다)

curl -X GET "https://api.haezoom.io/v1/weather/?id=2" -H "accept: application/json" -H "Authorization: Token be27e3daf7ee23acdeafd2cebc21a78528373344"
import requests

url = 'https://api.haezoom.io/v1/weather/'

token = 'be27e3daf7ee23acdeafd2cebc21a78528373344'
headers = {'Authorization': 'Token ' + token, 'Content-Type': 'application/json; charset=utf-8'}
res = requests.get(url, {'id': 2}, headers=headers)
const request = require('request');
const token = 'be27e3daf7ee23acdeafd2cebc21a78528373344'

const options = {
    uri: 'https://api.haezoom.io/v1/weather/',
    headers: {
        'Content-Type': 'application/json; charset=utf-8',
        'Authorization': 'Token ' + token,
    },
    qs: {
        id:2
    }
};

request(options,function(err,response,body){
    console.log(body);
})
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.MalformedURLException;
import java.io.IOException;

public class HttpConn {

    public static void main(String[] args) throws Exception{

        try {

            URL url = new URL("https://api.haezoom.io/v1/weather/?id=2");
            HttpURLConnection conn = (HttpURLConnection) url.openConnection();
            conn.setDoOutput(true);

            conn.setRequestMethod("GET");
            conn.setRequestProperty("Content-Type", "application/json");
            conn.setRequestProperty("accept", "application/json");
            conn.setRequestProperty("Authorization", "Token be27e3daf7ee23acdeafd2cebc21278528373344");
            int responseCode = conn.getResponseCode();

            BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
            String inputLine;
            StringBuffer response = new StringBuffer();
            while ((inputLine = in.readLine()) != null) {
                response.append(inputLine);
            }
            in.close();

            System.out.println("HTTP 응답 코드 : " + responseCode);
            System.out.println("HTTP body : " + response.toString());


        } catch (MalformedURLException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

Response

{
    "status": "success",
    "code": 200,
    "result": {
        "conditions": {
            "id": "2",
            "timestampType": "end",
            "start": "2022-03-08 12:00:00+09:00",
            "end": "2022-03-11 12:00:00+09:00",
            "ref": "2022-03-07T18:00:00+00:00",
            "timezone": "Asia/Seoul",
            "interval": 60,
            "use": "GnL"
        },
        "predict": {
            "datetime": [
                "2022-03-08T12:00:00+09:00",
                "2022-03-08T13:00:00+09:00",
                "2022-03-08T14:00:00+09:00",
                "2022-03-08T15:00:00+09:00",
                "2022-03-08T16:00:00+09:00",
                "2022-03-08T17:00:00+09:00",
                "2022-03-08T18:00:00+09:00",
                "2022-03-08T19:00:00+09:00",
                "2022-03-08T20:00:00+09:00",
                "2022-03-08T21:00:00+09:00",
                "2022-03-08T22:00:00+09:00",
                "2022-03-08T23:00:00+09:00",
                "2022-03-09T00:00:00+09:00",
                "2022-03-09T01:00:00+09:00",
                "2022-03-09T02:00:00+09:00",
                "2022-03-09T03:00:00+09:00",
                "2022-03-09T04:00:00+09:00",
                "2022-03-09T05:00:00+09:00",
                "2022-03-09T06:00:00+09:00",
                "2022-03-09T07:00:00+09:00",
                "2022-03-09T08:00:00+09:00",
                "2022-03-09T09:00:00+09:00",
                "2022-03-09T10:00:00+09:00",
                "2022-03-09T11:00:00+09:00",
                "2022-03-09T12:00:00+09:00",
                "2022-03-09T13:00:00+09:00",
                "2022-03-09T14:00:00+09:00",
                "2022-03-09T15:00:00+09:00",
                "2022-03-09T16:00:00+09:00",
                "2022-03-09T17:00:00+09:00",
                "2022-03-09T18:00:00+09:00",
                "2022-03-09T19:00:00+09:00",
                "2022-03-09T20:00:00+09:00",
                "2022-03-09T21:00:00+09:00",
                "2022-03-09T22:00:00+09:00",
                "2022-03-09T23:00:00+09:00",
                "2022-03-10T00:00:00+09:00",
                "2022-03-10T01:00:00+09:00",
                "2022-03-10T02:00:00+09:00",
                "2022-03-10T03:00:00+09:00",
                "2022-03-10T04:00:00+09:00",
                "2022-03-10T05:00:00+09:00",
                "2022-03-10T06:00:00+09:00",
                "2022-03-10T07:00:00+09:00",
                "2022-03-10T08:00:00+09:00",
                "2022-03-10T09:00:00+09:00",
                "2022-03-10T10:00:00+09:00",
                "2022-03-10T11:00:00+09:00",
                "2022-03-10T12:00:00+09:00",
                "2022-03-10T13:00:00+09:00",
                "2022-03-10T14:00:00+09:00",
                "2022-03-10T15:00:00+09:00",
                "2022-03-10T16:00:00+09:00",
                "2022-03-10T17:00:00+09:00",
                "2022-03-10T18:00:00+09:00",
                "2022-03-10T19:00:00+09:00",
                "2022-03-10T20:00:00+09:00",
                "2022-03-10T21:00:00+09:00",
                "2022-03-10T22:00:00+09:00",
                "2022-03-10T23:00:00+09:00",
                "2022-03-11T00:00:00+09:00",
                "2022-03-11T01:00:00+09:00",
                "2022-03-11T02:00:00+09:00",
                "2022-03-11T03:00:00+09:00",
                "2022-03-11T04:00:00+09:00",
                "2022-03-11T05:00:00+09:00",
                "2022-03-11T06:00:00+09:00",
                "2022-03-11T07:00:00+09:00",
                "2022-03-11T08:00:00+09:00",
                "2022-03-11T09:00:00+09:00",
                "2022-03-11T10:00:00+09:00",
                "2022-03-11T11:00:00+09:00",
                "2022-03-11T12:00:00+09:00"
            ],
            "temp_air": [
                13.140625,
                12.8046875,
                12.4765625,
                12.1484375,
                10.6484375,
                9.15625,
                7.65625,
                6.7734375,
                5.89453125,
                5.01171875,
                4.7734375,
                4.53515625,
                4.296875,
                4.12109375,
                3.947265625,
                3.771484375,
                3.6328125,
                3.494140625,
                3.35546875,
                5.0,
                6.64453125,
                8.2890625,
                10.0625,
                11.8359375,
                13.6171875,
                13.625,
                13.640625,
                13.6484375,
                11.9609375,
                10.265625,
                8.578125,
                7.65625,
                6.7421875,
                5.82421875,
                5.6015625,
                5.6015625,
                5.3515625,
                5.1015625,
                5.1015625,
                4.8515625,
                4.8515625,
                4.8515625,
                4.8515625,
                6.1015625,
                7.1015625,
                8.3515625,
                9.6015625,
                11.1015625,
                12.3515625,
                12.3515625,
                12.6015625,
                12.6015625,
                11.3515625,
                10.1015625,
                8.8515625,
                8.3515625,
                7.6015625,
                7.1015625,
                6.8515625,
                6.6015625,
                6.3515625,
                6.1015625,
                6.1015625,
                5.8515625,
                5.6015625,
                5.6015625,
                5.3515625,
                6.8515625,
                8.6015625,
                10.1015625,
                11.8515625,
                13.8515625,
                15.6015625
            ],
            "ghi": [
                794.0,
                809.5,
                752.5,
                621.0,
                469.75,
                270.5,
                78.875,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                2.376953125,
                87.75,
                279.25,
                512.0,
                698.5,
                800.0,
                822.5,
                775.5,
                663.0,
                499.5,
                291.0,
                87.5,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                17.34375,
                116.1875,
                264.75,
                327.0,
                381.0,
                369.0,
                414.25,
                402.5,
                368.75,
                258.75,
                132.625,
                50.96875,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                0.0,
                31.828125,
                139.0,
                320.25,
                488.75,
                662.0,
                720.0
            ]
        }
    }
}

참고

반환 데이터 중 conditions의 use는 사용된 파일을 의미합니다. gfs는 미국 기상청 데이터, GnL은 gfs와 한국기상청(ldaps)의 데이터를 활용해 계산된 값입니다.

최초 발전소 등록 후 발전량 예측에 필요한 데이터 수집에 최소 20분에서 최대 6시간이 소요되며, 수집 이후부터 발전량 예측 데이터를 확인 할 수 있습니다.