[{"id":"8b4b4636adde248f","type":"function","z":"ecc4e2aeee811ae9","name":"电视参数","func":"msg.method = "POST";\nmsg.url = "https://public-wxtv.hismarttv.com/mobiletv/device/deviceInfo"\nmsg.payload = {\n "Host": "public-wxtv.hismarttv.com",\n "Connection": "keep-alive",\n "Content-Length": "450",\n "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36 MicroMessenger/7.0.20.1781(0x6700143B) NetType/WIFI MiniProgramEnv/Windows WindowsWechat/WMPF WindowsWechat(0x63090a13) UnifiedPCWindowsWechat(0xf2540611) XWEB/16041",\n "xweb_xhr": "1",\n "Content-Type": "application/json",\n "Accept": "*/*",\n "Sec-Fetch-Site": "cross-site",\n "Sec-Fetch-Mode": "cors",\n "Sec-Fetch-Dest": "empty",\n "Referer": "https://servicewechat.com/wxf488d623a17cd7b5/69/page-frame.html",\n "Accept-Encoding": "gzip, deflate, br",\n "Accept-Language": "zh-CN,zh;q=0.9",\n "_t": 1752198354278,\n "accessToken": msg.payload.data.tokenInfo.token,\n "deviceIds": [\n "86100300000100100000060c5fe97655"\n ],\n "version": "1.2.20.3",\n "deviceType": 3,\n "type": 1,\n "deviceid": "o8zDV5ekrW3UoG3darGHXYPWGRbw",\n "distributeId": 1001,\n "sign": "",\n "appKey": "commonweb"\n}\n\n\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":680,"y":120,"wires":[["e8c89c854963b42b"]]},{"id":"e8c89c854963b42b","type":"http request","z":"ecc4e2aeee811ae9","name":"","method":"use","ret":"obj","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":840,"y":120,"wires":[["0f6bebdad2790bec"]]},{"id":"c0dd6bcd5e8f309d","type":"debug","z":"ecc4e2aeee811ae9","name":"debug 5","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1320,"y":120,"wires":[]},{"id":"0f6bebdad2790bec","type":"function","z":"ecc4e2aeee811ae9","name":"电视状态","func":"if (msg.payload.data[0].status == 0) {\n msg.payload.TVstatus = "关机"\n}\n\nif (msg.payload.data[0].status == 1) {\n msg.payload.TVstatus = "开机"\n}\n\n\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1000,"y":120,"wires":[["e079b3024333623d","f75cf259f59f9687"]]},{"id":"e079b3024333623d","type":"ha-sensor","z":"ecc4e2aeee811ae9","name":"电视状态","entityConfig":"52e95d0d65df81bb","version":0,"state":"payload.TVstatus","stateType":"msg","attributes":[],"inputOverride":"allow","outputProperties":[],"x":1160,"y":120,"wires":[["c0dd6bcd5e8f309d"]]},{"id":"689933d9bfd5a957","type":"ha-button","z":"ecc4e2aeee811ae9","name":"电视刷新按钮","version":0,"debugenabled":false,"outputs":1,"entityConfig":"3952b7ec70b1756e","outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"x":170,"y":60,"wires":[["ead494855c72e6c0"]]},{"id":"85012e4becd39a02","type":"debug","z":"ecc4e2aeee811ae9","name":"debug 2","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":680,"y":80,"wires":[]},{"id":"3d254c6f2b09f796","type":"http request","z":"ecc4e2aeee811ae9","name":"","method":"use","ret":"obj","paytoqs":"ignore","url":"https://portal-account.hismarttv.com/mobile/signon","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":520,"y":120,"wires":[["8b4b4636adde248f","85012e4becd39a02"]]},{"id":"ead494855c72e6c0","type":"function","z":"ecc4e2aeee811ae9","name":"登录参数","func":"// 构建登录请求\nconst timestamp = Date.now();\n\nmsg.url = "https://portal-account.hismarttv.com/mobile/signon";\nmsg.method = "POST";\n\n// 设置查询参数\nmsg.params = {\n "lastUpdateTime": "0",\n "version": "1.0",\n "deviceType": "2",\n "appType": "100",\n "versionCode": "101",\n "adaptertRank": "4130",\n "_": timestamp.toString()\n};\n\n// 设置请求头\nmsg.headers = {\n "Content-Type": "application/json;charset=utf-8"\n};\n\n// 设置请求体\nmsg.payload = {\n "deviceType": "1",\n "distributeId": "2001",\n "loginName": msg.username,\n "serverCode": "9501",\n "signature": msg.password\n};\n\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":360,"y":120,"wires":[["3d254c6f2b09f796"]]},{"id":"75f07673f3ead2df","type":"inject","z":"ecc4e2aeee811ae9","name":"触发流程","props":[{"p":"username","v":"1555XXXXXXX","vt":"str"},{"p":"password","v":"XXXXXXX","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":200,"y":120,"wires":[["ead494855c72e6c0"]]},{"id":"f75cf259f59f9687","type":"debug","z":"ecc4e2aeee811ae9","name":"debug 3","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1130,"y":240,"wires":[]},{"id":"52e95d0d65df81bb","type":"ha-entity-config","server":"55452e83.ae73f","deviceConfig":"348413fe7b203120","name":"电视状态","version":6,"entityType":"sensor","haConfig":[{"property":"name","value":"电视状态"},{"property":"icon","value":"mdi:power"},{"property":"entity_picture","value":""},{"property":"entity_category","value":""},{"property":"device_class","value":""},{"property":"unit_of_measurement","value":""},{"property":"state_class","value":""}],"resend":false,"debugEnabled":false},{"id":"3952b7ec70b1756e","type":"ha-entity-config","server":"55452e83.ae73f","deviceConfig":"348413fe7b203120","name":"电视刷新按钮","version":6,"entityType":"button","haConfig":[{"property":"name","value":"电视刷新按钮"},{"property":"icon","value":"mdi:refresh"},{"property":"entity_picture","value":""},{"property":"entity_category","value":""},{"property":"device_class","value":""}],"resend":false,"debugEnabled":false},{"id":"55452e83.ae73f","type":"server","name":"Home Assistant","addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"","connectionDelay":false,"cacheJson":false,"heartbeat":false,"heartbeatInterval":"","statusSeparator":"","enableGlobalContextStore":false},{"id":"348413fe7b203120","type":"ha-device-config","name":"海信电视","hwVersion":"","manufacturer":"Node-RED","model":"","swVersion":""}]