Skip to content

Instantly share code, notes, and snippets.

@0neday
Created March 27, 2022 10:55
Show Gist options
  • Save 0neday/3db879e2b4eef92cde29b2abc828d70d to your computer and use it in GitHub Desktop.
Save 0neday/3db879e2b4eef92cde29b2abc828d70d to your computer and use it in GitHub Desktop.
for research
[
{
"id": "5bfc1ec08cb3472e",
"type": "tab",
"label": "home assisstant ",
"disabled": false,
"info": "研究用的",
"env": []
},
{
"id": "e83c8705d1e9ae8a",
"type": "server-state-changed",
"z": "5bfc1ec08cb3472e",
"name": "room humidity",
"server": "e8349c19021c66e6",
"version": 4,
"exposeToHomeAssistant": false,
"haConfig": [
{
"property": "name",
"value": ""
},
{
"property": "icon",
"value": ""
}
],
"entityidfilter": "sensor.room_lywsd03mmc_humidity",
"entityidfiltertype": "exact",
"outputinitially": false,
"state_type": "num",
"haltifstate": "",
"halt_if_type": "num",
"halt_if_compare": "gte",
"outputs": 1,
"output_only_on_state_change": true,
"for": "30",
"forType": "num",
"forUnits": "minutes",
"ignorePrevStateNull": false,
"ignorePrevStateUnknown": false,
"ignorePrevStateUnavailable": false,
"ignoreCurrentStateUnknown": false,
"ignoreCurrentStateUnavailable": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
}
],
"x": 90,
"y": 380,
"wires": [
[
"f5617dfc89c5de0a"
]
]
},
{
"id": "e3d497d3b27c89cc",
"type": "bizwechat-push",
"z": "5bfc1ec08cb3472e",
"name": "",
"bizwechat": "6a3117af916e7140",
"x": 680,
"y": 380,
"wires": [
[]
]
},
{
"id": "93509611628bbf2b",
"type": "function",
"z": "5bfc1ec08cb3472e",
"name": "微信消息预处理",
"func": "\nvar message='当前室内湿度为: ' + msg.payload + ' %' + ' ,请注意进行户外活动!';\n\nwechat = {\"touser\" : \"@all\", \"msgtype\": \"text\", \n \"text\": {\n \"content\" : message,\n \"safe\":0,\n \"enable_duplicate_check\": 1,\n \"duplicate_check_interval\": 1800\n\n }\n \n};\nmsg.payload = {};\nmsg.payload = wechat;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 460,
"y": 380,
"wires": [
[
"e3d497d3b27c89cc"
]
]
},
{
"id": "37b6d849fdc17e48",
"type": "server-state-changed",
"z": "5bfc1ec08cb3472e",
"name": "router temperature",
"server": "e8349c19021c66e6",
"version": 4,
"exposeToHomeAssistant": false,
"haConfig": [
{
"property": "name",
"value": ""
},
{
"property": "icon",
"value": ""
}
],
"entityidfilter": "sensor.router_lywsd03mmc_temperature",
"entityidfiltertype": "exact",
"outputinitially": false,
"state_type": "num",
"haltifstate": "",
"halt_if_type": "num",
"halt_if_compare": "gte",
"outputs": 1,
"output_only_on_state_change": true,
"for": "",
"forType": "num",
"forUnits": "seconds",
"ignorePrevStateNull": false,
"ignorePrevStateUnknown": false,
"ignorePrevStateUnavailable": false,
"ignoreCurrentStateUnknown": false,
"ignoreCurrentStateUnavailable": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
}
],
"x": 110,
"y": 160,
"wires": [
[
"30c4f5663ff182e1"
]
]
},
{
"id": "31802368dabcc6a0",
"type": "api-call-service",
"z": "5bfc1ec08cb3472e",
"name": "",
"server": "e8349c19021c66e6",
"version": 5,
"debugenabled": false,
"domain": "fan",
"service": "turn_on",
"areaId": [],
"deviceId": [],
"entityId": [
"fan.living_room_fan"
],
"data": "{\"percentage\":\"50\"}",
"dataType": "json",
"mergeContext": "",
"mustacheAltTags": false,
"outputProperties": [],
"queue": "none",
"x": 510,
"y": 140,
"wires": [
[]
]
},
{
"id": "4af738407b1942db",
"type": "api-call-service",
"z": "5bfc1ec08cb3472e",
"name": "",
"server": "e8349c19021c66e6",
"version": 5,
"debugenabled": false,
"domain": "fan",
"service": "turn_off",
"areaId": [],
"deviceId": [],
"entityId": [
"fan.living_room_fan"
],
"data": "",
"dataType": "jsonata",
"mergeContext": "",
"mustacheAltTags": false,
"outputProperties": [],
"queue": "none",
"x": 510,
"y": 80,
"wires": [
[
"52b85e360aca3d4a"
]
]
},
{
"id": "52b85e360aca3d4a",
"type": "function",
"z": "5bfc1ec08cb3472e",
"name": "",
"func": "\nvar message='路由器当前温度为:' + msg.payload + ' °C,温度过低,已关闭风扇!';\n\nwechat = {\"touser\" : \"@all\", \"msgtype\": \"text\", \n \"text\": {\n \"content\" : message,\n \"safe\":0,\n \"enable_duplicate_check\": 1,\n \"duplicate_check_interval\": 1800\n\n }\n \n};\nmsg.payload = {};\nmsg.payload = wechat;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 690,
"y": 80,
"wires": [
[
"8b33af4a97f5b79e"
]
]
},
{
"id": "8b33af4a97f5b79e",
"type": "bizwechat-push",
"z": "5bfc1ec08cb3472e",
"name": "",
"bizwechat": "6a3117af916e7140",
"x": 860,
"y": 80,
"wires": [
[]
]
},
{
"id": "47b769c5.cb0e28",
"type": "join",
"z": "5bfc1ec08cb3472e",
"name": "",
"mode": "custom",
"build": "object",
"property": "payload",
"propertyType": "msg",
"key": "topic",
"joiner": "\\n",
"joinerType": "str",
"accumulate": false,
"timeout": "",
"count": "2",
"reduceRight": false,
"reduceExp": "",
"reduceInit": "",
"reduceInitType": "",
"reduceFixup": "",
"x": 470,
"y": 500,
"wires": [
[
"0e7a60dec064d06d"
]
]
},
{
"id": "f9afb265.b11b7",
"type": "debug",
"z": "5bfc1ec08cb3472e",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 810,
"y": 560,
"wires": []
},
{
"id": "0e7a60dec064d06d",
"type": "function",
"z": "5bfc1ec08cb3472e",
"name": "diff",
"func": "var array= [];\narray[0] = msg.payload.room;\narray[1] = msg.payload.outdoor;\narray[2] = msg.payload.room - msg.payload.outdoor;\n\nmsg.topic = 'diff';\nmsg.payload = array;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 630,
"y": 500,
"wires": [
[
"85a8e16e33148d49",
"f9afb265.b11b7"
]
]
},
{
"id": "c26f800047bb6958",
"type": "api-current-state",
"z": "5bfc1ec08cb3472e",
"name": "Room humi",
"server": "e8349c19021c66e6",
"version": 3,
"outputs": 1,
"halt_if": "",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "sensor.room_lywsd03mmc_humidity",
"state_type": "num",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "topic",
"propertyType": "msg",
"value": "room",
"valueType": "str"
}
],
"for": "0",
"forType": "num",
"forUnits": "minutes",
"override_topic": false,
"state_location": "payload",
"override_payload": "msg",
"entity_location": "data",
"override_data": "msg",
"x": 310,
"y": 480,
"wires": [
[
"47b769c5.cb0e28"
]
]
},
{
"id": "186467ea8858093f",
"type": "api-current-state",
"z": "5bfc1ec08cb3472e",
"name": "outdoor humi",
"server": "e8349c19021c66e6",
"version": 3,
"outputs": 1,
"halt_if": "",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "sensor.openweathermap_humidity",
"state_type": "num",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "topic",
"propertyType": "msg",
"value": "outdoor",
"valueType": "str"
}
],
"for": "0",
"forType": "num",
"forUnits": "minutes",
"override_topic": false,
"state_location": "payload",
"override_payload": "msg",
"entity_location": "data",
"override_data": "msg",
"x": 310,
"y": 540,
"wires": [
[
"47b769c5.cb0e28"
]
]
},
{
"id": "3d1e7d3f2cbe842e",
"type": "inject",
"z": "5bfc1ec08cb3472e",
"name": "检测湿度差",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "*/30 8-20 * * *",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 110,
"y": 500,
"wires": [
[
"186467ea8858093f",
"c26f800047bb6958"
]
]
},
{
"id": "85a8e16e33148d49",
"type": "switch",
"z": "5bfc1ec08cb3472e",
"name": "",
"property": "payload[2]",
"propertyType": "msg",
"rules": [
{
"t": "gte",
"v": "15",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 790,
"y": 500,
"wires": [
[
"bea839a7730e6cb5"
]
]
},
{
"id": "bea839a7730e6cb5",
"type": "function",
"z": "5bfc1ec08cb3472e",
"name": "微信消息预处理",
"func": "\nvar message='湿度差:' + msg.payload[2]\n+ ' %,湿度差过大,请进行户外活动!';\nmessage += '\\n室内湿度:' + msg.payload[0] + ' %';\nmessage += '\\n户外湿度:' + msg.payload[1] + ' %';\n\nwechat = {\"touser\" : \"@all\", \"msgtype\": \"text\", \n \"text\": {\n \"content\" : message,\n \"safe\":1,\n \"enable_duplicate_check\": 1,\n \"duplicate_check_interval\": 1800\n\n }\n \n};\nmsg.payload = {};\nmsg.payload = wechat;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 980,
"y": 500,
"wires": [
[
"f542d837d88e87d0"
]
]
},
{
"id": "f542d837d88e87d0",
"type": "bizwechat-push",
"z": "5bfc1ec08cb3472e",
"name": "",
"bizwechat": "6a3117af916e7140",
"x": 1180,
"y": 500,
"wires": [
[]
]
},
{
"id": "30c4f5663ff182e1",
"type": "switch",
"z": "5bfc1ec08cb3472e",
"name": "",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "lte",
"v": "20",
"vt": "str"
},
{
"t": "gte",
"v": "24.5",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 310,
"y": 160,
"wires": [
[
"4af738407b1942db"
],
[
"9b4e251487704c52"
]
]
},
{
"id": "59e77fd2aa8f4de4",
"type": "api-call-service",
"z": "5bfc1ec08cb3472e",
"name": "",
"server": "e8349c19021c66e6",
"version": 5,
"debugenabled": false,
"domain": "fan",
"service": "turn_on",
"areaId": [],
"deviceId": [],
"entityId": [
"fan.living_room_fan"
],
"data": "{\"percentage\":\"70\"}",
"dataType": "json",
"mergeContext": "",
"mustacheAltTags": false,
"outputProperties": [],
"queue": "none",
"x": 510,
"y": 200,
"wires": [
[]
]
},
{
"id": "9b4e251487704c52",
"type": "api-call-service",
"z": "5bfc1ec08cb3472e",
"name": "",
"server": "e8349c19021c66e6",
"version": 5,
"debugenabled": false,
"domain": "fan",
"service": "turn_on",
"areaId": [],
"deviceId": [],
"entityId": [
"fan.living_room_fan"
],
"data": "{\"percentage\":\"75\"}",
"dataType": "json",
"mergeContext": "",
"mustacheAltTags": false,
"outputProperties": [],
"queue": "none",
"x": 510,
"y": 260,
"wires": [
[
"d782e3fbb3f06df4"
]
]
},
{
"id": "d782e3fbb3f06df4",
"type": "function",
"z": "5bfc1ec08cb3472e",
"name": "",
"func": "\nvar message='路由器当前温度为:' + msg.payload + ' °C,温度过高,已开启风扇降温!';\n\nwechat = {\"touser\" : \"@all\", \"msgtype\": \"text\", \n \"text\": {\n \"content\" : message,\n \"safe\":0,\n \"enable_duplicate_check\": 1,\n \"duplicate_check_interval\": 1800\n\n }\n \n};\nmsg.payload = {};\nmsg.payload = wechat;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 690,
"y": 260,
"wires": [
[
"34544bae634a2a9b"
]
]
},
{
"id": "34544bae634a2a9b",
"type": "bizwechat-push",
"z": "5bfc1ec08cb3472e",
"name": "",
"bizwechat": "6a3117af916e7140",
"x": 860,
"y": 260,
"wires": [
[]
]
},
{
"id": "f5617dfc89c5de0a",
"type": "switch",
"z": "5bfc1ec08cb3472e",
"name": "",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "gte",
"v": "80",
"vt": "str"
},
{
"t": "lte",
"v": "30",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 270,
"y": 380,
"wires": [
[
"93509611628bbf2b"
],
[
"93509611628bbf2b"
]
]
},
{
"id": "e8349c19021c66e6",
"type": "server",
"name": "Home Assistant",
"version": 2,
"addon": false,
"rejectUnauthorizedCerts": false,
"ha_boolean": "y|yes|true|on|home|open",
"connectionDelay": true,
"cacheJson": true,
"heartbeat": true,
"heartbeatInterval": "30"
},
{
"id": "6a3117af916e7140",
"type": "bizwechat-configurator",
"name": "noedred 企业微信推送",
"port": "3001",
"corpid": "",
"agentid": "",
"corpsecret": "",
"url": "",
"token": "TxuQCi98tY",
"aeskey": "22onCLmGPqdx4eoPXsqLVctbzFE17xOJlBDsVIdvxmj",
"client_id": "",
"client_secret": ""
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment