Skip to content

Instantly share code, notes, and snippets.

@taktamur
Created October 29, 2018 02:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save taktamur/00b0714bfa893a92dd6131482c10420b to your computer and use it in GitHub Desktop.
Save taktamur/00b0714bfa893a92dd6131482c10420b to your computer and use it in GitHub Desktop.
時刻判定をしてGHKitのAPIを呼び出すNode-RED
[
{
"id": "30155774.268828",
"type": "tab",
"label": "フロー 1",
"disabled": false,
"info": ""
},
{
"id": "e06cf7c7.32e1c8",
"type": "tls-config",
"z": "",
"name": "",
"cert": "",
"key": "",
"ca": "",
"certname": "",
"keyname": "",
"caname": "",
"servername": "",
"verifyservercert": true
},
{
"id": "150235c9.904b8a",
"type": "http in",
"z": "30155774.268828",
"name": "IFTTTからの受け口",
"url": "webhook",
"method": "post",
"upload": false,
"swaggerDoc": "",
"x": 98.5,
"y": 168,
"wires": [
[
"8cafc4b8.23cbc8",
"1e41a040.7a5e7",
"849dd031.fd7d4"
]
]
},
{
"id": "849dd031.fd7d4",
"type": "http response",
"z": "30155774.268828",
"name": "",
"statusCode": "",
"headers": {},
"x": 410.5,
"y": 153,
"wires": []
},
{
"id": "b36c395a.20a7a8",
"type": "inject",
"z": "30155774.268828",
"name": "デバッグ実行",
"topic": "",
"payload": "{\"message\":\"vgchj5y2i4e てすつ\"}",
"payloadType": "json",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 134.5,
"y": 401,
"wires": [
[
"8cafc4b8.23cbc8"
]
]
},
{
"id": "1e41a040.7a5e7",
"type": "debug",
"z": "30155774.268828",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"x": 607.5,
"y": 236,
"wires": []
},
{
"id": "8cafc4b8.23cbc8",
"type": "function",
"z": "30155774.268828",
"name": "時刻チェック",
"func": "var utc = new Date();\n//現在時刻とUTCの時差を求める。ハワイなら600分 * 60秒 * 1000ミリ秒\nvar offset = utc.getTimezoneOffset() * 60 * 1000;\nutc = new Date(utc.getTime() + offset);\n\nvar timeJP = new Date(utc.getTime() + 9 * 60 * 60 * 1000);\nvar jpHour = timeJP.getHours();\n\nif( 8<jpHour && jpHour<23 ){\n return msg;\n}else{\n return\n}\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 203.5,
"y": 252,
"wires": [
[
"d4acb777.a16f98",
"1e41a040.7a5e7"
]
]
},
{
"id": "d4acb777.a16f98",
"type": "http request",
"z": "30155774.268828",
"name": "GHKitのwebhook呼び出し",
"method": "POST",
"ret": "obj",
"url": "https://ifttt.ghkit.jp/",
"tls": "e06cf7c7.32e1c8",
"x": 317.5,
"y": 331,
"wires": [
[
"1e41a040.7a5e7"
]
]
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment