[{"id":"e44045d984eb8506","type":"tab","label":"欢迎回家自动开灯","disabled":false,"info":"","env":[]},{"id":"a3997102.a99ae","type":"function","z":"e44045d984eb8506","name":"保存格言到flow变量","func":"flow.set('wisdom',msg.payload.info + msg.payload.author);\nreturn null;","outputs":0,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":770,"y":320,"wires":[]},{"id":"f06e376.5aeb3c8","type":"inject","z":"e44045d984eb8506","name":"每小时获取一次名言","repeat":"3600","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"{}","payloadType":"json","x":160,"y":320,"wires":[["7cb2402.cc4ffc"]]},{"id":"2059008f.5f398","type":"comment","z":"e44045d984eb8506","name":"获取名言flow变量","info":"flow变量名为 token\n获取方法 msg.access_token = flow.get('token');","x":137.8333282470703,"y":275.666561126709,"wires":[]},{"id":"7cb2402.cc4ffc","type":"http request","z":"e44045d984eb8506","name":"名言api","method":"GET","ret":"txt","paytoqs":"ignore","url":"http://api.bunian.cn/yulu/?fun=json","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":400,"y":320,"wires":[["890e20cf.7c3a8"]]},{"id":"890e20cf.7c3a8","type":"json","z":"e44045d984eb8506","name":"","property":"payload","action":"","pretty":false,"x":590,"y":320,"wires":[["a3997102.a99ae"]]},{"id":"7f426214.3934ac","type":"api-current-state","z":"e44045d984eb8506","name":"获取室内温度","server":"94f0c0a9.629b6","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.temperature_158d0000fd539c","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"for":0,"forType":"num","forUnits":"minutes","x":1120,"y":420,"wires":[["3be3eef7.4d5332","aa8942b8.c7e5c"]]},{"id":"48b9cd54.e89c84","type":"api-current-state","z":"e44045d984eb8506","name":"获取室内湿度","server":"94f0c0a9.629b6","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.humidity_158d0000fd539c","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"for":0,"forType":"num","forUnits":"minutes","x":1120,"y":480,"wires":[["d1a55952.33b9d8"]]},{"id":"3be3eef7.4d5332","type":"function","z":"e44045d984eb8506","name":"温度","func":"var result='';\nif(msg.data.state>=23){\n result = msg.data.state + '摄氏度,炎热'; \n}\nelse if(msg.data.state>=18 && msg.data.state<=23){\n result = msg.data.state + '摄氏度,舒适'; \n}\nelse if(msg.data.state>12 && msg.data.state<18){\n result = msg.data.state + '摄氏度,较冷';\n}\nelse{\n result = msg.data.state + '摄氏度,寒冷,请注意保暖';\n}\n\nmsg.payload = {"temperature":result};\nreturn msg;","outputs":1,"noerr":0,"x":1310,"y":420,"wires":[["d1c941a9.52593"]]},{"id":"d1a55952.33b9d8","type":"function","z":"e44045d984eb8506","name":"湿度","func":"var result='';\nif(msg.data.state>=60){\n result = msg.data.state + '潮湿'; \n}\nelse if(msg.data.state>30 && msg.data.state<60){\n result = msg.data.state + '适中';\n}\nelse{\n result = msg.data.state + '干燥';\n}\nmsg.payload = {"humidity":result};\nreturn msg;","outputs":1,"noerr":0,"x":1310,"y":480,"wires":[["d1c941a9.52593"]]},{"id":"a583519b.c8397","type":"api-call-service","z":"e44045d984eb8506","name":"小爱TTS","server":"94f0c0a9.629b6","version":5,"domain":"hello_miai","service":"add2msgqueue","areaId":[],"deviceId":[],"entityId":[],"data":"","mergeContext":"","outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"data"}],"queue":"none","output_location":"payload","output_location_type":"msg","x":1880,"y":460,"wires":[[]]},{"id":"1bfadb64.9eb5a5","type":"function","z":"e44045d984eb8506","name":"TTS内容","func":"var wisdom = flow.get('wisdom');\n\n\nvar message = `欢迎回家:现在室内温度${msg.payload.temperature},湿度为百分之${msg.payload.humidity}。${wisdom}`;\nmsg.payload = {};\nmsg.payload.data = {"message":message,"miai_num":"0"};\nreturn msg;","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":1660,"y":460,"wires":[["a583519b.c8397","71d25351.12058c"]]},{"id":"d1c941a9.52593","type":"join","z":"e44045d984eb8506","name":"","mode":"custom","build":"merged","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":1510,"y":460,"wires":[["1bfadb64.9eb5a5"]]},{"id":"71d25351.12058c","type":"debug","z":"e44045d984eb8506","name":"调式信息","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":1860,"y":520,"wires":[]},{"id":"7051732.489678c","type":"server-state-changed","z":"e44045d984eb8506","name":"监测大门状态","server":"94f0c0a9.629b6","version":5,"outputs":1,"exposeAsEntityConfig":"","entityId":"binary_sensor.door_window_sensor_158d0000d6de14","entityIdType":"exact","outputInitially":false,"stateType":"str","ifState":"","ifStateType":"str","ifStateOperator":"is","for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":110,"y":500,"wires":[["b0d0837f.90c33"]]},{"id":"f2134b3d.fcfde8","type":"switch","z":"e44045d984eb8506","name":"大门新状态为开启","property":"data.new_state.state","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":570,"y":500,"wires":[["3ae5dab8.d82b16"]]},{"id":"b0d0837f.90c33","type":"switch","z":"e44045d984eb8506","name":"大门原状态为关闭","property":"data.old_state.state","propertyType":"msg","rules":[{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":350,"y":500,"wires":[["f2134b3d.fcfde8"]]},{"id":"45d250f3.aa2a6","type":"api-current-state","z":"e44045d984eb8506","name":"获取客厅光照度","server":"94f0c0a9.629b6","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.illumination_158d0001a2520d","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"for":0,"forType":"num","forUnits":"minutes","x":1120,"y":540,"wires":[["c72b5594.329e38"]]},{"id":"c72b5594.329e38","type":"switch","z":"e44045d984eb8506","name":"低于20lx","property":"payload","propertyType":"msg","rules":[{"t":"lt","v":"20.0","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":1340,"y":540,"wires":[["80610ff5.d5bb8"]]},{"id":"80610ff5.d5bb8","type":"api-call-service","z":"e44045d984eb8506","name":"打开客厅灯","server":"94f0c0a9.629b6","version":5,"domain":"switch","service":"turn_on","areaId":[],"deviceId":[],"entityId":["switch.wall_switch_right_158d00014cf47a"],"data":"","mergeContext":"","outputProperties":[{"value":"","valueType":"data"}],"queue":"none","x":1530,"y":540,"wires":[[]]},{"id":"9c104446.36be18","type":"api-call-service","z":"e44045d984eb8506","name":"小爱TTS","server":"94f0c0a9.629b6","version":5,"domain":"hello_miai","service":"add2msgqueue","areaId":[],"deviceId":[],"entityId":[],"data":"","mergeContext":"","outputProperties":[{"value":"","valueType":"data"}],"queue":"none","x":1460,"y":640,"wires":[[]]},{"id":"44aea020.1882d","type":"function","z":"e44045d984eb8506","name":"推送内容","func":"var message = flow.get('wisdom');\n\nmsg.payload = {};\nmsg.payload.data = {"message":message,"miai_num":"0"};\nreturn msg;\n","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":1120,"y":640,"wires":[["83b8982b.a5dae8"]]},{"id":"83b8982b.a5dae8","type":"trigger","z":"e44045d984eb8506","name":"","op1":"","op2":"","op1type":"pay","op2type":"nul","duration":"10","extend":false,"units":"min","reset":"","bytopic":"all","outputs":1,"x":1290,"y":640,"wires":[["9c104446.36be18"]]},{"id":"ea2db4d3.5c92b8","type":"comment","z":"e44045d984eb8506","name":"开门播报室内温湿度","info":"","x":137.77777099609375,"y":434.4443359375,"wires":[]},{"id":"3ae5dab8.d82b16","type":"api-current-state","z":"e44045d984eb8506","name":"防盗门状态","server":"94f0c0a9.629b6","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"binary_sensor.door_window_sensor_158d0001f34db6","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"for":0,"forType":"num","forUnits":"minutes","x":730,"y":420,"wires":[["2deae646.e72e1a"]]},{"id":"2deae646.e72e1a","type":"switch","z":"e44045d984eb8506","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":870,"y":480,"wires":[["7f426214.3934ac","48b9cd54.e89c84","45d250f3.aa2a6"],["44aea020.1882d"]]},{"id":"aa8942b8.c7e5c","type":"debug","z":"e44045d984eb8506","name":"调式信息","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":1280,"y":360,"wires":[]},{"id":"94f0c0a9.629b6","type":"server","name":"Home Assistant","rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open"}]
这是改好的 ,我这边可以导入。