Skip to content

Instantly share code, notes, and snippets.

@FlashSoft
Created April 3, 2019 12:51
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FlashSoft/f9627dfae7a6ba8c3697d82326d364fa to your computer and use it in GitHub Desktop.
Save FlashSoft/f9627dfae7a6ba8c3697d82326d364fa to your computer and use it in GitHub Desktop.
斐讯M1
[
{
"id": "b021a39b.a7a1f",
"type": "switch",
"z": "3b880a8a.1a7066",
"name": "根据MAC地址区分设备",
"property": "mac",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "B0F89311A9CC",
"vt": "str"
},
{
"t": "eq",
"v": "B0F89311B946",
"vt": "str"
}
],
"checkall": "false",
"repair": false,
"outputs": 2,
"x": 500,
"y": 140,
"wires": [
[
"a866faa4.4c3068"
],
[
"37252c5f.8dcda4"
]
]
},
{
"id": "ce68d15f.0a387",
"type": "link in",
"z": "3b880a8a.1a7066",
"name": "客厅斐讯M1 - out",
"links": [
"f3d9b093.20ee8",
"a866faa4.4c3068"
],
"x": 135,
"y": 470,
"wires": [
[
"71911d03.5cc9f4"
]
]
},
{
"id": "b4d9ea5d.132778",
"type": "link in",
"z": "3b880a8a.1a7066",
"name": "书房斐讯M1 - out",
"links": [
"d6eaf243.99167",
"37252c5f.8dcda4"
],
"x": 135,
"y": 290,
"wires": [
[
"f348ed22.83c6"
]
]
},
{
"id": "7e5dfe50.0b2ac",
"type": "ui_text",
"z": "3b880a8a.1a7066",
"group": "818c5ec8.ccc07",
"order": 3,
"width": "6",
"height": "1",
"name": "PM2.5",
"label": "PM2.5",
"format": "{{msg.payload}} μg/m³",
"layout": "row-spread",
"x": 680,
"y": 350,
"wires": []
},
{
"id": "2fb1b87c.5b7d18",
"type": "ui_text",
"z": "3b880a8a.1a7066",
"group": "818c5ec8.ccc07",
"order": 4,
"width": "6",
"height": "1",
"name": "甲醛",
"label": "甲醛",
"format": "{{msg.payload}} mg/m³",
"layout": "row-spread",
"x": 680,
"y": 390,
"wires": []
},
{
"id": "90b98634.82f308",
"type": "ui_text",
"z": "3b880a8a.1a7066",
"group": "4de8aeb9.733ad",
"order": 3,
"width": "6",
"height": "1",
"name": "PM2.5",
"label": "PM2.5",
"format": "{{msg.payload}} μg/m³",
"layout": "row-spread",
"x": 680,
"y": 530,
"wires": []
},
{
"id": "53585b97.cc9ad4",
"type": "ui_text",
"z": "3b880a8a.1a7066",
"group": "4de8aeb9.733ad",
"order": 4,
"width": "6",
"height": "1",
"name": "甲醛",
"label": "甲醛",
"format": "{{msg.payload}} mg/m³",
"layout": "row-spread",
"x": 680,
"y": 570,
"wires": []
},
{
"id": "de7f8b9.0944e78",
"type": "ui_gauge",
"z": "3b880a8a.1a7066",
"name": "",
"group": "818c5ec8.ccc07",
"order": 1,
"width": "3",
"height": "2",
"gtype": "gage",
"title": "温度",
"label": "°C",
"format": "{{value}}",
"min": "-50",
"max": "50",
"colors": [
"#0080c0",
"#00ff00",
"#ca3838"
],
"seg1": "19",
"seg2": "26",
"x": 680,
"y": 270,
"wires": []
},
{
"id": "a83e1515.284bd8",
"type": "ui_gauge",
"z": "3b880a8a.1a7066",
"name": "",
"group": "818c5ec8.ccc07",
"order": 2,
"width": "3",
"height": "2",
"gtype": "gage",
"title": "湿度",
"label": "%",
"format": "{{value}}",
"min": "0",
"max": "100",
"colors": [
"#0080ff",
"#0080c0",
"#000080"
],
"seg1": "40",
"seg2": "70",
"x": 680,
"y": 310,
"wires": []
},
{
"id": "5264c923.b885f8",
"type": "ui_gauge",
"z": "3b880a8a.1a7066",
"name": "",
"group": "4de8aeb9.733ad",
"order": 1,
"width": "3",
"height": "2",
"gtype": "gage",
"title": "温度",
"label": "°C",
"format": "{{value}}",
"min": "-50",
"max": "50",
"colors": [
"#0080c0",
"#00ff00",
"#ca3838"
],
"seg1": "19",
"seg2": "26",
"x": 680,
"y": 450,
"wires": []
},
{
"id": "288e8854.3ba648",
"type": "ui_gauge",
"z": "3b880a8a.1a7066",
"name": "",
"group": "4de8aeb9.733ad",
"order": 2,
"width": "3",
"height": "2",
"gtype": "gage",
"title": "湿度",
"label": "%",
"format": "{{value}}",
"min": "0",
"max": "100",
"colors": [
"#0080ff",
"#0080c0",
"#000080"
],
"seg1": "40",
"seg2": "70",
"x": 680,
"y": 490,
"wires": []
},
{
"id": "62f2b6f2.c06688",
"type": "tcp in",
"z": "3b880a8a.1a7066",
"name": "",
"server": "server",
"host": "",
"port": "9000",
"datamode": "stream",
"datatype": "buffer",
"newline": "",
"topic": "",
"base64": false,
"x": 90,
"y": 90,
"wires": [
[
"13cf273e.f80aa9",
"57138ec2.53a91",
"49bd6e6c.6877d"
]
]
},
{
"id": "13cf273e.f80aa9",
"type": "function",
"z": "3b880a8a.1a7066",
"name": "上行",
"func": "const hex = Buffer.from(msg.payload)\n// node.warn(hex.toString('hex', 0, 23))\nmsg.payload = Buffer.from(`${hex.toString('hex', 0, 23)}00370000027b2274797065223a352c22737461747573223a317dff23454e4423`, 'hex')\nreturn msg\n",
"outputs": 1,
"noerr": 0,
"x": 310,
"y": 90,
"wires": [
[
"aff9972c.680068"
]
]
},
{
"id": "aff9972c.680068",
"type": "tcp out",
"z": "3b880a8a.1a7066",
"host": "",
"port": "",
"beserver": "reply",
"base64": false,
"end": false,
"name": "响应TCP",
"x": 460,
"y": 90,
"wires": []
},
{
"id": "57138ec2.53a91",
"type": "function",
"z": "3b880a8a.1a7066",
"name": "下行",
"func": "const hex = Buffer.from(msg.payload)\nconst end_flag = Buffer.from('ff23454e4423', 'hex')\nif(hex.length > 50){\n const json = JSON.parse(hex.toString('utf8', hex.indexOf(Buffer.from('{')), hex.indexOf(end_flag)))\n const mac = hex.toString('hex', 17, 23).toUpperCase()\n msg.payload = json\n msg.mac = mac\n node.send(msg)\n}",
"outputs": 1,
"noerr": 0,
"x": 310,
"y": 140,
"wires": [
[
"b021a39b.a7a1f"
]
]
},
{
"id": "49bd6e6c.6877d",
"type": "tcp request",
"z": "3b880a8a.1a7066",
"server": "192.168.200.202",
"port": "9001",
"out": "sit",
"splitc": " ",
"name": "HA",
"x": 310,
"y": 190,
"wires": [
[]
]
},
{
"id": "a866faa4.4c3068",
"type": "link out",
"z": "3b880a8a.1a7066",
"name": "客厅斐讯M1 - in",
"links": [
"ce68d15f.0a387"
],
"x": 655,
"y": 120,
"wires": []
},
{
"id": "37252c5f.8dcda4",
"type": "link out",
"z": "3b880a8a.1a7066",
"name": "书房斐讯M1 - in",
"links": [
"b4d9ea5d.132778"
],
"x": 655,
"y": 160,
"wires": []
},
{
"id": "f348ed22.83c6",
"type": "function",
"z": "3b880a8a.1a7066",
"name": "数据分组",
"func": "node.status({text: `最后更新:${new Date().toLocaleTimeString('zh-cn',{timeZone: \"Asia/Chongqing\"})}`})\nreturn [\n {payload: msg.payload.temperature},\n {payload: msg.payload.humidity},\n {payload: msg.payload.value},\n {payload: msg.payload.hcho}\n]",
"outputs": 4,
"noerr": 0,
"x": 320,
"y": 290,
"wires": [
[
"de7f8b9.0944e78"
],
[
"a83e1515.284bd8"
],
[
"7e5dfe50.0b2ac"
],
[
"2fb1b87c.5b7d18"
]
]
},
{
"id": "71911d03.5cc9f4",
"type": "function",
"z": "3b880a8a.1a7066",
"name": "数据分组",
"func": "node.status({text: `最后更新:${new Date().toLocaleTimeString('zh-cn',{timeZone: \"Asia/Chongqing\"})}`})\nreturn [\n {payload: msg.payload.temperature},\n {payload: msg.payload.humidity},\n {payload: msg.payload.value},\n {payload: msg.payload.hcho}\n]",
"outputs": 4,
"noerr": 0,
"x": 320,
"y": 470,
"wires": [
[
"5264c923.b885f8"
],
[
"288e8854.3ba648"
],
[
"90b98634.82f308"
],
[
"53585b97.cc9ad4"
]
]
},
{
"id": "9152dc7f.6aa76",
"type": "comment",
"z": "3b880a8a.1a7066",
"name": "斐讯M1内网NR帮助",
"info": "### 内网劫持\n\n使用dnsmasq劫持`aircat.phicomm.com`到你NodeRed所在IP\n\n```\naddress=/.aircat.phicomm.com/192.168.200.202\n```",
"x": 120,
"y": 50,
"wires": []
},
{
"id": "818c5ec8.ccc07",
"type": "ui_group",
"z": 0,
"name": "书房",
"tab": "bdb369e9.14a568",
"order": 5,
"disp": true,
"width": "6",
"collapse": false
},
{
"id": "4de8aeb9.733ad",
"type": "ui_group",
"z": 0,
"name": "客厅",
"tab": "bdb369e9.14a568",
"order": 4,
"disp": true,
"width": "6",
"collapse": false
},
{
"id": "bdb369e9.14a568",
"type": "ui_tab",
"z": "3b880a8a.1a7066",
"name": "我的家",
"icon": "group",
"order": 2,
"disabled": false,
"hidden": false
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment