This flow was submitted before accounts existed, so nobody owns it yet. If you submitted it, open the edit link you were given — it still works — and you can attach the flow to an account from there. There is no deadline, and attaching it retires the link for good.
Gas Price China
Show the local Gas Price in China Mainland.
| System | Node-RED |
|---|---|
| Firmware | AWTRIX 3 |
| Topic | Miscellaneous |
| Built by | Tony Chang |
| File | yNg0OGpX5X6D.json · 6.1 KB |
| Icons | 1 |
| Published | 26 Dec 2023 |
| Downloads | 36 |
Show the local Gas Price in China Mainland.
Go to https://www.tianapi.com/apiview/104 .
Apply the API for Gas price.
Buy VIP if you need.
Get your API Key in the website.
Set API Key in the API Key & Province node.
Set Province using Chinese characters in the API Key & Province node.
Modify which gas you need in the Parser node.
Set IP address of your Awtrix Light in the AwtrixLight/Custom node.
yNg0OGpX5X6D.json
[
{
"id": "685fdf2dae87971b",
"type": "group",
"z": "b83fa85f42197aac",
"name": "App: Gas Price in China Mainland",
"style": {
"label": true
},
"nodes": [
"cf6327d3f1a7485f",
"4616cc6ebc93b6c7",
"061625bc33bf672a",
"543e8d24f000f854",
"3130056d99563c0a",
"d3e2ea0e467a1dfc",
"38429859c23c330e",
"3d6eccc80848310f",
"3a2ff232cb5965e5"
],
"x": 14,
"y": 19,
"w": 742,
"h": 182
},
{
"id": "cf6327d3f1a7485f",
"type": "inject",
"z": "b83fa85f42197aac",
"g": "685fdf2dae87971b",
"name": "1x/2hour",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "7200",
"crontab": "",
"once": true,
"onceDelay": "1",
"topic": "gas_price",
"payload": "",
"payloadType": "date",
"x": 120,
"y": 100,
"wires": [
[
"061625bc33bf672a"
]
]
},
{
"id": "4616cc6ebc93b6c7",
"type": "http request",
"z": "b83fa85f42197aac",
"g": "685fdf2dae87971b",
"name": "Gas Price API",
"method": "GET",
"ret": "obj",
"paytoqs": "query",
"url": "https://apis.tianapi.com/oilprice/index",
"tls": "",
"persist": false,
"proxy": "",
"insecureHTTPParser": false,
"authType": "",
"senderr": false,
"headers": [
{
"keyType": "User-Agent",
"keyValue": "",
"valueType": "other",
"valueValue": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.1 Safari/605.1.15"
}
],
"x": 560,
"y": 100,
"wires": [
[
"3d6eccc80848310f"
]
]
},
{
"id": "061625bc33bf672a",
"type": "function",
"z": "b83fa85f42197aac",
"g": "685fdf2dae87971b",
"name": "API Key & Province",
"func": "msg.payload = {\n \"key\": \"YOUR_API_KEY_HERE\",\n \"prov\": \"北京\",\n}\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 330,
"y": 100,
"wires": [
[
"4616cc6ebc93b6c7"
]
]
},
{
"id": "543e8d24f000f854",
"type": "function",
"z": "b83fa85f42197aac",
"g": "685fdf2dae87971b",
"name": "Parser",
"func": "let json_data = msg.payload;\nvar code = json_data.code;\nvar mssg = json_data.msg;\nif (code == 200 && mssg == \"success\") {\n var result = json_data.result;\n var p92 = result.p92;\n var p95 = result.p95;\n var p98 = result.p98;\n msg.payload = {\n \"icon\": \"gaspump\",\n \"text\": p92,\n \"rainbow\": true,\n };\n}else {\n msg.payload = {\n \"icon\": \"gaspump\",\n \"text\": \"N/A\",\n \"color\": \"gray\",\n };\n}\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 210,
"y": 160,
"wires": [
[
"3130056d99563c0a"
]
]
},
{
"id": "3130056d99563c0a",
"type": "http request",
"z": "b83fa85f42197aac",
"g": "685fdf2dae87971b",
"name": "AwtrixLight/Custom",
"method": "POST",
"ret": "txt",
"paytoqs": "body",
"url": "http://10.0.0.1/api/custom?name=gasprice",
"tls": "",
"persist": false,
"proxy": "",
"insecureHTTPParser": false,
"authType": "",
"senderr": false,
"headers": [
{
"keyType": "Content-Type",
"keyValue": "",
"valueType": "other",
"valueValue": "application/json"
}
],
"x": 420,
"y": 160,
"wires": [
[
"d3e2ea0e467a1dfc"
]
]
},
{
"id": "d3e2ea0e467a1dfc",
"type": "debug",
"z": "b83fa85f42197aac",
"g": "685fdf2dae87971b",
"name": "Response",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 640,
"y": 160,
"wires": []
},
{
"id": "38429859c23c330e",
"type": "comment",
"z": "b83fa85f42197aac",
"g": "685fdf2dae87971b",
"name": "Gas Price in China Mainland",
"info": "Go to https://www.tianapi.com/apiview/104 . \nApply the API for Gas price. \nBuy VIP if you need. \nGet your **API Key** in the website.\n\nSet **API Key** in the **_API Key & Province_** node. \nSet **Province** using Chinese characters in the **_API Key & Province_** node. \nModify which gas you need in the **_Parser_** node. \nSet IP address of your Awtrix Light in the **_AwtrixLight/Custom_** node.\n",
"x": 180,
"y": 60,
"wires": []
},
{
"id": "3d6eccc80848310f",
"type": "link out",
"z": "b83fa85f42197aac",
"g": "685fdf2dae87971b",
"name": "Link Out Gas",
"mode": "link",
"links": [
"3a2ff232cb5965e5"
],
"x": 715,
"y": 100,
"wires": []
},
{
"id": "3a2ff232cb5965e5",
"type": "link in",
"z": "b83fa85f42197aac",
"g": "685fdf2dae87971b",
"name": "Link In Gas",
"links": [
"3d6eccc80848310f"
],
"x": 85,
"y": 160,
"wires": [
[
"543e8d24f000f854"
]
]
}
]
These icons belong on the device, in /ICONS. Each one is at
most 32×8
pixels — shown here magnified, at their real proportions.
8×8 px
More flows for Node-RED or Miscellaneous
Something wrong with this flow? Report it.