本帖最后由 mengyu 于 2022-4-17 14:26 编辑
VX添加公众号:国网四川电力,绑定账号,利用抓包工具抓取cookie_persist,my_asiayak_cookie_wx_openid,cons_no
[{"id":"6a1d3771c0b00662","type":"http request","z":"40c83f28.dc2f6","name":"电费","method":"POST","ret":"obj","paytoqs":"ignore","url":"http://weixin.sc.sgcc.com.cn/SEH/elecAnalysis/getElectricityTariff","tls":"","persist":false,"proxy":"","authType":"","senderr":false,"credentials":{"user":"","password":""},"x":410,"y":1880,"wires":[["b8954038480cfb51","441e46e5958529bd"]]},{"id":"93206fbbdf1c47bb","type":"function","z":"40c83f28.dc2f6","name":"电费","func":"msg.headers = \n{\n'Host': 'weixin.sc.sgcc.com.cn',\n'Content-Length': '236',\n'Accept': 'application/json, text/javascript, */*; q=0.01',\n'Origin': 'http://weixin.sc.sgcc.com.cn',\n'X-Requested-With': 'XMLHttpRequest',\n'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36 NetType/WIFI MicroMessenger/7.0.20.1781(0x6700143B) WindowsWechat(0x63060012)',\n'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',\n'Referer': 'http://weixin.sc.sgcc.com.cn/SEH/elecAnalysis/elecPowerPage',\n'Accept-Encoding': 'gzip, deflate',\n'Accept-Language': 'zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7',\n'Connection': 'keep-alive',\n'Cookie' : 'cookie_persist=; my_asiayak_cookie_wx_openid=',\n}\nmsg.payload=\"cons_no=\"\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":270,"y":1880,"wires":[["6a1d3771c0b00662"]]},{"id":"9f97401bfab8ea53","type":"inject","z":"40c83f28.dc2f6","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"600","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":120,"y":1880,"wires":[["93206fbbdf1c47bb","7245aefea03dcd33"]]},{"id":"b8954038480cfb51","type":"debug","z":"40c83f28.dc2f6","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":610,"y":1880,"wires":[]},{"id":"441e46e5958529bd","type":"ha-entity","z":"40c83f28.dc2f6","name":"电费","server":"7cac8150.6405d","version":2,"debugenabled":false,"outputs":1,"entityType":"sensor","config":[{"property":"name","value":"电费"},{"property":"device_class","value":"device_class_test"},{"property":"icon","value":"mdi:home-lightning-bolt"},{"property":"unit_of_measurement","value":"元"},{"property":"state_class","value":""},{"property":"last_reset","value":""}],"state":"payload.data.money","stateType":"msg","attributes":[{"property":"jieZhiDate","value":"payload.data.jieZhiDate","valueType":"msg"},{"property":"usedDianLiang","value":"payload.data.usedDianLiang","valueType":"msg"},{"property":"totalDay","value":"payload.data.totalDay","valueType":"msg"}],"resend":true,"outputLocation":"","outputLocationType":"none","inputOverride":"allow","outputOnStateChange":false,"outputPayload":"$entity().state ? \"on\": \"off\"","outputPayloadType":"jsonata","x":770,"y":1880,"wires":[[]]},{"id":"1cc65807f5ea4b35","type":"http request","z":"40c83f28.dc2f6","name":"电费","method":"POST","ret":"obj","paytoqs":"ignore","url":"http://weixin.sc.sgcc.com.cn/SEH/elecAnalysis/getElectroCurve","tls":"","persist":false,"proxy":"","authType":"","senderr":false,"credentials":{"user":"","password":""},"x":410,"y":1940,"wires":[["7158f4b13cac20b5"]]},{"id":"7245aefea03dcd33","type":"function","z":"40c83f28.dc2f6","name":"电费","func":"msg.headers = \n{\n'Host': 'weixin.sc.sgcc.com.cn',\n'Content-Length': '236',\n'Accept': 'application/json, text/javascript, */*; q=0.01',\n'Origin': 'http://weixin.sc.sgcc.com.cn',\n'X-Requested-With': 'XMLHttpRequest',\n'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36 NetType/WIFI MicroMessenger/7.0.20.1781(0x6700143B) WindowsWechat(0x63060012)',\n'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',\n'Referer': 'http://weixin.sc.sgcc.com.cn/SEH/elecAnalysis/elecPowerPage',\n'Accept-Encoding': 'gzip, deflate',\n'Accept-Language': 'zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7',\n'Connection': 'keep-alive',\n'Cookie' : 'cookie_persist=; my_asiayak_cookie_wx_openid=',\n}\nmsg.payload=\"cons_no=\"\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":270,"y":1940,"wires":[["1cc65807f5ea4b35"]]},{"id":"7158f4b13cac20b5","type":"debug","z":"40c83f28.dc2f6","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":610,"y":1940,"wires":[]},{"id":"7cac8150.6405d","type":"server","name":"Home Assistant","version":2,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"30"}]
分别填入函数里面对应的代码。
有疑问的可以进群咨询下我
|