Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Jaxom
DataConnect-NodeRED
Commits
b38ef35f
Commit
b38ef35f
authored
May 31, 2019
by
Jaxom
Browse files
Flows initiaux
parent
b6765fd5
Changes
1
Hide whitespace changes
Inline
Side-by-side
20190530-FlowsAuthEtRecupData_Nodered.json
0 → 100644
View file @
b38ef35f
[
{
"id"
:
"4e190166.121e28"
,
"type"
:
"tab"
,
"label"
:
"Auth-Token"
,
"disabled"
:
false
,
"info"
:
""
},
{
"id"
:
"ce910788.3497c"
,
"type"
:
"tab"
,
"label"
:
"Valeurs"
,
"disabled"
:
false
,
"info"
:
""
},
{
"id"
:
"1f19d480.92fc74"
,
"type"
:
"ui_tab"
,
"z"
:
""
,
"name"
:
"DataConnect-Proto"
,
"icon"
:
"fa-fire"
,
"disabled"
:
false
,
"hidden"
:
false
},
{
"id"
:
"8448d19a.8ec28"
,
"type"
:
"ui_group"
,
"z"
:
""
,
"name"
:
"Data"
,
"tab"
:
"1f19d480.92fc74"
,
"order"
:
2
,
"disp"
:
false
,
"width"
:
"12"
,
"collapse"
:
false
},
{
"id"
:
"66d80aab.85fa1c"
,
"type"
:
"ui_base"
,
"theme"
:
{
"name"
:
"theme-dark"
,
"lightTheme"
:
{
"default"
:
"#0094CE"
,
"baseColor"
:
"#0094CE"
,
"baseFont"
:
"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif"
,
"edited"
:
true
,
"reset"
:
false
},
"darkTheme"
:
{
"default"
:
"#097479"
,
"baseColor"
:
"#097479"
,
"baseFont"
:
"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif"
,
"edited"
:
true
,
"reset"
:
false
},
"customTheme"
:
{
"name"
:
"Untitled Theme 1"
,
"default"
:
"#4B7930"
,
"baseColor"
:
"#4B7930"
,
"baseFont"
:
"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif"
},
"themeState"
:
{
"base-color"
:
{
"default"
:
"#097479"
,
"value"
:
"#097479"
,
"edited"
:
false
},
"page-titlebar-backgroundColor"
:
{
"value"
:
"#097479"
,
"edited"
:
false
},
"page-backgroundColor"
:
{
"value"
:
"#111111"
,
"edited"
:
false
},
"page-sidebar-backgroundColor"
:
{
"value"
:
"#000000"
,
"edited"
:
false
},
"group-textColor"
:
{
"value"
:
"#0eb8c0"
,
"edited"
:
false
},
"group-borderColor"
:
{
"value"
:
"#555555"
,
"edited"
:
false
},
"group-backgroundColor"
:
{
"value"
:
"#333333"
,
"edited"
:
false
},
"widget-textColor"
:
{
"value"
:
"#eeeeee"
,
"edited"
:
false
},
"widget-backgroundColor"
:
{
"value"
:
"#097479"
,
"edited"
:
false
},
"widget-borderColor"
:
{
"value"
:
"#333333"
,
"edited"
:
false
},
"base-font"
:
{
"value"
:
"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif"
}
},
"angularTheme"
:
{
"primary"
:
"indigo"
,
"accents"
:
"blue"
,
"warn"
:
"red"
,
"background"
:
"grey"
}
},
"site"
:
{
"name"
:
"Node-RED Dashboard"
,
"hideToolbar"
:
"false"
,
"allowSwipe"
:
"false"
,
"lockMenu"
:
"false"
,
"allowTempTheme"
:
"true"
,
"dateFormat"
:
"DD/MM/YYYY"
,
"sizes"
:
{
"sx"
:
48
,
"sy"
:
48
,
"gx"
:
6
,
"gy"
:
6
,
"cx"
:
6
,
"cy"
:
6
,
"px"
:
0
,
"py"
:
0
}
}
},
{
"id"
:
"40994a81.7d443c"
,
"type"
:
"ui_group"
,
"z"
:
""
,
"name"
:
"Charts"
,
"tab"
:
"5ed59e22.4fe368"
,
"order"
:
2
,
"disp"
:
false
,
"width"
:
"6"
},
{
"id"
:
"f6c2c6bb.7f4cf"
,
"type"
:
"ui_group"
,
"z"
:
""
,
"name"
:
"Inputs"
,
"tab"
:
"5ed59e22.4fe368"
,
"order"
:
1
,
"disp"
:
false
,
"width"
:
"6"
},
{
"id"
:
"5ed59e22.4fe368"
,
"type"
:
"ui_tab"
,
"z"
:
""
,
"name"
:
"Charts"
,
"icon"
:
"dashboard"
,
"order"
:
2
},
{
"id"
:
"3350c8e.cd02338"
,
"type"
:
"ui_group"
,
"z"
:
""
,
"name"
:
"Login"
,
"tab"
:
"1f19d480.92fc74"
,
"order"
:
1
,
"disp"
:
true
,
"width"
:
"12"
,
"collapse"
:
false
},
{
"id"
:
"f0824586.ce1b38"
,
"type"
:
"function"
,
"z"
:
"4e190166.121e28"
,
"name"
:
"IDENTIFIANTS"
,
"func"
:
"global.set(
\"
client_id
\"
,
\"
CHANGEME
\"
);
\n
global.set(
\"
client_secret
\"
,
\"
CHANGEME
\"
);
\n
global.set(
\"
redirect_uri
\"
,
\"
CHANGEME
\"
);
\n\n\n\n
return msg;"
,
"outputs"
:
1
,
"noerr"
:
0
,
"x"
:
290
,
"y"
:
45
,
"wires"
:
[
[]
]
},
{
"id"
:
"193e6967.e32ba7"
,
"type"
:
"inject"
,
"z"
:
"4e190166.121e28"
,
"name"
:
"Init"
,
"topic"
:
""
,
"payload"
:
""
,
"payloadType"
:
"date"
,
"repeat"
:
""
,
"crontab"
:
""
,
"once"
:
true
,
"onceDelay"
:
0.1
,
"x"
:
100
,
"y"
:
45
,
"wires"
:
[
[
"f0824586.ce1b38"
]
]
},
{
"id"
:
"71a7788a.270858"
,
"type"
:
"http request"
,
"z"
:
"4e190166.121e28"
,
"name"
:
"AuthCode"
,
"method"
:
"GET"
,
"ret"
:
"txt"
,
"paytoqs"
:
false
,
"url"
:
"https://gw.hml.api.enedis.fr/group/espace-particuliers/consentement-linky/oauth2/authorize?client_id=388bb9e0-58ee-4faf-88bd-49f6d49f1927&state=fz80ac793&duration=P4M&response_type=code&redirect_uri=https://v.tchack.xyz/Linky"
,
"tls"
:
""
,
"proxy"
:
""
,
"authType"
:
"basic"
,
"x"
:
105
,
"y"
:
180
,
"wires"
:
[
[
"350b0f9b.62adb"
]
]
},
{
"id"
:
"350b0f9b.62adb"
,
"type"
:
"split"
,
"z"
:
"4e190166.121e28"
,
"name"
:
""
,
"splt"
:
";"
,
"spltType"
:
"str"
,
"arraySplt"
:
1
,
"arraySpltType"
:
"len"
,
"stream"
:
false
,
"addname"
:
""
,
"x"
:
290
,
"y"
:
180
,
"wires"
:
[
[
"95c801ec.5b6f7"
]
]
},
{
"id"
:
"95c801ec.5b6f7"
,
"type"
:
"function"
,
"z"
:
"4e190166.121e28"
,
"name"
:
"Recup_Code_et_UP"
,
"func"
:
"regex = new RegExp(global.get(
\"
redirect_uri
\"
),'g');
\n\n
if (msg.payload.match(regex)) {
\n\n
chaine = msg.payload.split(
\"
=
\"
);
\n
code = chaine[2].split(
\"
&
\"
);
\n
global.set(
\"
code
\"
,code[0]);
\n
up_id = chaine[4].split('
\"
')[0];
\n
global.set(
\"
up_id
\"
,up_id);
\n
\n
return { payload : code[0],
\"
up_id
\"
: up_id };
\n
\n
}
\n\n
else {return 0;}"
,
"outputs"
:
1
,
"noerr"
:
0
,
"x"
:
550
,
"y"
:
180
,
"wires"
:
[
[
"5e8217b4.f724a"
]
],
"info"
:
"Ce bloc récupère les paramètres complémentaires d'authentification, qui sont renvoyés par l'API DataConnect dans une requête GET."
},
{
"id"
:
"69eb392.1ade7c8"
,
"type"
:
"http request"
,
"z"
:
"4e190166.121e28"
,
"name"
:
"AuthToken"
,
"method"
:
"POST"
,
"ret"
:
"txt"
,
"paytoqs"
:
false
,
"url"
:
""
,
"tls"
:
""
,
"proxy"
:
""
,
"authType"
:
"basic"
,
"x"
:
520
,
"y"
:
255
,
"wires"
:
[
[
"d5362a0f.fc7f2"
]
]
},
{
"id"
:
"5e8217b4.f724a"
,
"type"
:
"function"
,
"z"
:
"4e190166.121e28"
,
"name"
:
"Headers POST"
,
"func"
:
"msg.headers = {};
\n
msg.headers['Content-Type'] = 'application/x-www-form-urlencoded';
\n
msg.headers['accept'] = 'text/html';
\n\n\n
return msg;"
,
"outputs"
:
1
,
"noerr"
:
0
,
"x"
:
125
,
"y"
:
255
,
"wires"
:
[
[
"be24459e.16c428"
]
]
},
{
"id"
:
"559feee8.4184f"
,
"type"
:
"debug"
,
"z"
:
"4e190166.121e28"
,
"name"
:
""
,
"active"
:
true
,
"tosidebar"
:
true
,
"console"
:
false
,
"tostatus"
:
false
,
"complete"
:
"true"
,
"targetType"
:
"full"
,
"x"
:
500
,
"y"
:
375
,
"wires"
:
[]
},
{
"id"
:
"be24459e.16c428"
,
"type"
:
"function"
,
"z"
:
"4e190166.121e28"
,
"name"
:
"URL+Data"
,
"func"
:
"
\n\n
msg.url={}
\n
msg.url =
\"
https://gw.hml.api.enedis.fr/v1/oauth2/token?redirect_uri=
\"
+global.get(
\"
redirect_uri
\"
);
\n\n
msg.payload =
\"
grant_type=authorization_code&client_id=
\"
+global.get(
\"
client_id
\"
)+
\"
&client_secret=
\"
+global.get(
\"
client_secret
\"
)+
\"
&code=
\"
+msg.payload;
\n\n
return msg;"
,
"outputs"
:
1
,
"noerr"
:
0
,
"x"
:
310
,
"y"
:
255
,
"wires"
:
[
[
"69eb392.1ade7c8"
]
]
},
{
"id"
:
"1d17f313.6f768d"
,
"type"
:
"http request"
,
"z"
:
"ce910788.3497c"
,
"name"
:
""
,
"method"
:
"GET"
,
"ret"
:
"txt"
,
"paytoqs"
:
false
,
"url"
:
""
,
"tls"
:
""
,
"proxy"
:
""
,
"authType"
:
"basic"
,
"x"
:
130
,
"y"
:
270
,
"wires"
:
[
[
"4ad4d5d0.24a274"
]
]
},
{
"id"
:
"4ad4d5d0.24a274"
,
"type"
:
"json"
,
"z"
:
"ce910788.3497c"
,
"name"
:
""
,
"property"
:
"payload"
,
"action"
:
""
,
"pretty"
:
false
,
"x"
:
286
,
"y"
:
270
,
"wires"
:
[
[
"56757e3f.0e9ee"
]
]
},
{
"id"
:
"8d74cd01.096ec"
,
"type"
:
"ui_chart"
,
"z"
:
"ce910788.3497c"
,
"name"
:
""
,
"group"
:
"8448d19a.8ec28"
,
"order"
:
4
,
"width"
:
0
,
"height"
:
0
,
"label"
:
"CourbeCharge"
,
"chartType"
:
"line"
,
"legend"
:
"false"
,
"xformat"
:
"auto"
,
"interpolate"
:
"linear"
,
"nodata"
:
""
,
"dot"
:
false
,
"ymin"
:
""
,
"ymax"
:
""
,
"removeOlder"
:
1
,
"removeOlderPoints"
:
""
,
"removeOlderUnit"
:
"3600"
,
"cutout"
:
0
,
"useOneColor"
:
false
,
"colors"
:
[
"#1f77b4"
,
"#aec7e8"
,
"#ff7f0e"
,
"#2ca02c"
,
"#98df8a"
,
"#d62728"
,
"#ff9896"
,
"#9467bd"
,
"#c5b0d5"
],
"useOldStyle"
:
false
,
"outputs"
:
1
,
"x"
:
588.5
,
"y"
:
373
,
"wires"
:
[
[]
]
},
{
"id"
:
"d5362a0f.fc7f2"
,
"type"
:
"json"
,
"z"
:
"4e190166.121e28"
,
"name"
:
""
,
"property"
:
"payload"
,
"action"
:
""
,
"pretty"
:
false
,
"x"
:
95
,
"y"
:
330
,
"wires"
:
[
[
"6e073dda.206c7c"
]
]
},
{
"id"
:
"6e073dda.206c7c"
,
"type"
:
"function"
,
"z"
:
"4e190166.121e28"
,
"name"
:
"Global_Token"
,
"func"
:
"global.set(
\"
refresh_token
\"
,msg.payload.refresh_token);
\n
global.set(
\"
access_token
\"
,msg.payload.access_token);
\n\n
return {payload :
\"
OK
\"
};"
,
"outputs"
:
1
,
"noerr"
:
0
,
"x"
:
320
,
"y"
:
330
,
"wires"
:
[
[
"559feee8.4184f"
,
"a4aa882f.a44f8"
]
]
},
{
"id"
:
"c16cf9d8.77c76"
,
"type"
:
"ui_button"
,
"z"
:
"ce910788.3497c"
,
"name"
:
""
,
"group"
:
"8448d19a.8ec28"
,
"order"
:
3
,
"width"
:
0
,
"height"
:
0
,
"passthru"
:
false
,
"label"
:
"Requete Valeurs"
,
"tooltip"
:
""
,
"color"
:
""
,
"bgcolor"
:
""
,
"icon"
:
"fa-cogs"
,
"payload"
:
"1"
,
"payloadType"
:
"str"
,
"topic"
:
""
,
"x"
:
123.5
,
"y"
:
178
,
"wires"
:
[
[
"258a405b.f3814"
]
]
},
{
"id"
:
"258a405b.f3814"
,
"type"
:
"function"
,
"z"
:
"ce910788.3497c"
,
"name"
:
"URL+token"
,
"func"
:
"msg.url =
\"
https://gw.hml.api.enedis.fr/v3/metering_data/consumption_load_curve
\"
;
\n
msg.url +=
\"
?start=
\"
+flow.get(
\"
start
\"
)+
\"
&end=
\"
+flow.get(
\"
end
\"
)+
\"
&usage_point_id=
\"
+global.get(
\"
up_id
\"
);
\n\n
msg.headers = {} ;
\n
msg.headers[
\"
Accept
\"
] =
\"
application/json
\"
;
\n
msg.headers[
\"
Authorization
\"
] =
\"
Bearer
\"
+ global.get(
\"
access_token
\"
);
\n\n
return msg;"
,
"outputs"
:
1
,
"noerr"
:
0
,
"x"
:
308.5
,
"y"
:
178
,
"wires"
:
[
[
"1d17f313.6f768d"
]
]
},
{
"id"
:
"6ed7e8fa.bba13"
,
"type"
:
"debug"
,
"z"
:
"ce910788.3497c"
,
"name"
:
""
,
"active"
:
true
,
"tosidebar"
:
true
,
"console"
:
false
,
"tostatus"
:
false
,
"complete"
:
"true"
,
"targetType"
:
"full"
,
"x"
:
440
,
"y"
:
90
,
"wires"
:
[]
},
{
"id"
:
"172e4748.571b89"
,
"type"
:
"ui_date_picker"
,
"z"
:
"ce910788.3497c"
,
"name"
:
""
,
"label"
:
"Start"
,
"group"
:
"8448d19a.8ec28"
,
"order"
:
1
,
"width"
:
0
,
"height"
:
0
,
"passthru"
:
true
,
"topic"
:
""
,
"x"
:
97
,
"y"
:
67
,
"wires"
:
[
[
"ce0c3659.b7a67"
]
]
},
{
"id"
:
"ea05fb71.b37338"
,
"type"
:
"ui_date_picker"
,
"z"
:
"ce910788.3497c"
,
"name"
:
""
,
"label"
:
"End"
,
"group"
:
"8448d19a.8ec28"
,
"order"
:
2
,
"width"
:
0
,
"height"
:
0
,
"passthru"
:
true
,
"topic"
:
""
,
"x"
:
97
,
"y"
:
112
,
"wires"
:
[
[
"a51324b3.9e71f8"
]
]
},
{
"id"
:
"ce0c3659.b7a67"
,
"type"
:
"function"
,
"z"
:
"ce910788.3497c"
,
"name"
:
"setStartDate"
,
"func"
:
"
\n
start = new Date(msg.payload);
\n
start = start.toISOString().slice(0,10);
\n
flow.set(
\"
start
\"
, start)
\n\n
return msg;"
,
"outputs"
:
1
,
"noerr"
:
0
,
"x"
:
252
,
"y"
:
67
,
"wires"
:
[
[
"6ed7e8fa.bba13"
]
]
},
{
"id"
:
"a51324b3.9e71f8"
,
"type"
:
"function"
,
"z"
:
"ce910788.3497c"
,
"name"
:
"setEndDate"
,
"func"
:
"
\n
end = new Date(msg.payload);
\n
end = end.toISOString().slice(0,10);
\n
flow.set(
\"
end
\"
, end)
\n\n
return msg;"
,
"outputs"
:
1
,
"noerr"
:
0
,
"x"
:
252
,
"y"
:
112
,
"wires"
:
[
[
"6ed7e8fa.bba13"
]
]
},
{
"id"
:
"5d01c454.4cb734"
,
"type"
:
"inject"
,
"z"
:
"ce910788.3497c"
,
"name"
:
"ClearChart"
,
"topic"
:
""
,
"payload"
:
"[]"
,
"payloadType"
:
"json"
,
"repeat"
:
""
,
"crontab"
:
""
,
"once"
:
true
,
"onceDelay"
:
0.1
,
"x"
:
398.5
,
"y"
:
418
,
"wires"
:
[
[
"8d74cd01.096ec"
]
]
},
{
"id"
:
"a6c2badb.c1e018"
,
"type"
:
"ui_button"
,
"z"
:
"4e190166.121e28"
,
"name"
:
""
,
"group"
:
"3350c8e.cd02338"
,
"order"
:
1
,
"width"
:
"4"
,
"height"
:
"1"
,
"passthru"
:
false
,