[
{
"id": "1d46653.604e69b",
"type": "tab",
"label": "流程1",
"disabled": false,
"info": ""
},
{
"id": "f893ac1f8aad8c04",
"type": "inject",
"z": "1d46653.604e69b",
"name": "每天9点发送用电信息",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "00 09 * * *",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payloadType": "date",
"x": 180,
"y": 300,
"wires": [
[
"7591564a577ec462",
"5deba9b47876cdbc",
"bccbc0133730c976",
"97b6d13c343b7466"
]
]
},
{
"id": "7591564a577ec462",
"type": "api-current-state",
"z": "1d46653.604e69b",
"name": "昨天用电量",
"server": "e8349c19021c66e6",
"version": 2,
"outputs": 1,
"halt_if": "",
"halt_if_type": "num",
"halt_if_compare": "is",
"entity_id": "sensor.zuotian",
"state_type": "num",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload1",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data1",
"propertyType": "msg",
"value": "",
"valueType": "entity"
}
],
"override_topic": false,
"state_location": "payload",
"override_payload": "msg",
"entity_location": "data",
"override_data": "msg",
"x": 410,
"y": 240,
"wires": [
[
"751e2708c33ced2c"
]
]
},
{
"id": "c680952d07579b39",
"type": "function",
"z": "1d46653.604e69b",
"name": "",
"func": "\nvar desc='本月已用电量:'+ msg.payload[2] + 'KWH\\r\\n';\ndesc+='本月已用电费:'+ msg.payload[3] + '元\\r\\n';\ndesc+='昨天用电量:'+ msg.payload[0] + 'KWH\\r\\n';\ndesc+='昨天电费:'+ msg.payload[1] + '元';\n\nwechat = {\n 'touser' : '@all',\n 'msgtype': 'textcard',\n 'textcard': {\n 'title': '家庭用电详情',\n 'description' : desc,\n 'url' : `http://你的hass地址:9080`,\n 'btntxt':'查看详情',\n },\n}\n\nmsg.payload = {};\nmsg.payload = wechat;\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1070,
"y": 300,
"wires": [
[
"eb48db2366f3d619"
]
]
},
{
"id": "eb48db2366f3d619",
"type": "bizwechat-push",
"z": "1d46653.604e69b",
"name": "",
"bizwechat": "c36787cd99e1d359",
"x": 1200,
"y": 300,
"wires": [
[]
]
},
{
"id": "5deba9b47876cdbc",
"type": "api-current-state",
"z": "1d46653.604e69b",
"name": "昨天电费",
"server": "e8349c19021c66e6",
"version": 2,
"outputs": 1,
"halt_if": "",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "sensor.zuotian_dianfei",
"state_type": "num",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload2",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data2",
"propertyType": "msg",
"value": "",
"valueType": "entity"
}
],
"override_topic": false,
"state_location": "payload",
"override_payload": "msg",
"entity_location": "data",
"override_data": "msg",
"x": 400,
"y": 280,
"wires": [
[
"751e2708c33ced2c"
]
]
},
{
"id": "bccbc0133730c976",
"type": "api-current-state",
"z": "1d46653.604e69b",
"name": "本月已用电量",
"server": "e8349c19021c66e6",
"version": 2,
"outputs": 1,
"halt_if": "",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "sensor.zong",
"state_type": "num",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload3",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data3",
"propertyType": "msg",
"value": "",
"valueType": "entity"
}
],
"override_topic": false,
"state_location": "payload",
"override_payload": "msg",
"entity_location": "data",
"override_data": "msg",
"x": 420,
"y": 320,
"wires": [
[
"751e2708c33ced2c"
]
]
},
{
"id": "97b6d13c343b7466",
"type": "api-current-state",
"z": "1d46653.604e69b",
"name": "本月已用电费",
"server": "e8349c19021c66e6",
"version": 2,
"outputs": 1,
"halt_if": "",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "sensor.zong_dianfei",
"state_type": "num",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload4",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data4",
"propertyType": "msg",
"value": "",
"valueType": "entity"
}
],
"override_topic": false,
"state_location": "payload",
"override_payload": "msg",
"entity_location": "data",
"override_data": "msg",
"x": 420,
"y": 360,
"wires": [
[
"751e2708c33ced2c"
]
]
},
{
"id": "dbd29a142dd582dd",
"type": "debug",
"z": "1d46653.604e69b",
"name": "",
"active": true,
"tosidebar": true,
"console": true,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 1220,
"y": 180,
"wires": []
},
{
"id": "3070750dc82bb153",
"type": "join",
"z": "1d46653.604e69b",
"name": "合并成数组",
"mode": "custom",
"build": "array",
"property": "payload",
"propertyType": "msg",
"key": "topic",
"joiner": "\\n",
"joinerType": "str",
"accumulate": false,
"timeout": "",
"count": "4",
"reduceRight": false,
"reduceExp": "",
"reduceInit": "",
"reduceInitType": "",
"reduceFixup": "",
"x": 750,
"y": 300,
"wires": [
[
"68ea1d77a313e3b3",
"1ea592885261c0c0"
]
]
},
{
"id": "751e2708c33ced2c",
"type": "function",
"z": "1d46653.604e69b",
"name": "合并",
"func": "\nreturn { payload:[msg.payload1, msg.payload2,msg.payload3,msg.payload4]};\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 610,
"y": 300,
"wires": [
[
"3070750dc82bb153"
]
]
},
{
"id": "68ea1d77a313e3b3",
"type": "debug",
"z": "1d46653.604e69b",
"name": "",
"active": true,
"tosidebar": true,
"console": true,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 1100,
"y": 420,
"wires": []
},
{
"id": "1ea592885261c0c0",
"type": "function",
"z": "1d46653.604e69b",
"name": "合并成一个数组",
"func": "var redata=[0,0,0,0]\nfor (var x in msg.payload)\n{\n var data=msg.payload[x];\n for(var i =0;i<redata.length;i++){\n if(data.length>=i-1 && data[i] && data[i]>0){\n redata[i]=data[i];\n }\n }\n}\nreturn { payload:redata};\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 920,
"y": 300,
"wires": [
[
"dbd29a142dd582dd",
"c680952d07579b39"
]
]
},
{
"id": "e8349c19021c66e6",
"type": "server",
"name": "Home Assistant",
"version": 1,
"legacy": false,
"addon": false,
"rejectUnauthorizedCerts": true,
"ha_boolean": "y|yes|true|on|home|open",
"connectionDelay": true,
"cacheJson": true
},
{
"id": "c36787cd99e1d359",
"type": "bizwechat-configurator",
"name": "企业微信推送",
"port": "3001",
"corpid": "",
"agentid": "",
"corpsecret": "",
"url": "",
"token": "",
"aeskey": "",
"client_id": "",
"client_secret": ""
}
]