『瀚思彼岸』» 智能家居技术论坛

 找回密码
 立即注册
查看: 6642|回复: 30

[新奇玩法] 分享一个四川电力NR

[复制链接]

16

主题

223

帖子

1868

积分

金牌会员

Rank: 6Rank: 6

积分
1868
金钱
1645
HASS币
0
发表于 2022-4-16 17:27:59 | 显示全部楼层 |阅读模式
本帖最后由 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"}]


分别填入函数里面对应的代码。



微信截图_20220416172110.png

有疑问的可以进群咨询下我

微信图片_20220417142511.jpg

评分

参与人数 1金钱 +1 收起 理由
大胡子 + 1 分享给详细点的嘛

查看全部评分

回复

使用道具 举报

1

主题

83

帖子

1005

积分

金牌会员

Rank: 6Rank: 6

积分
1005
金钱
922
HASS币
0
发表于 2022-4-16 20:12:40 | 显示全部楼层
支持支持,终于有四川了
回复

使用道具 举报

1

主题

83

帖子

1005

积分

金牌会员

Rank: 6Rank: 6

积分
1005
金钱
922
HASS币
0
发表于 2022-4-16 20:19:20 | 显示全部楼层
server
ha-entity这两个节点有全称吗?
回复

使用道具 举报

3

主题

301

帖子

3251

积分

论坛元老

Rank: 8Rank: 8

积分
3251
金钱
2950
HASS币
0
发表于 2022-4-16 21:27:01 | 显示全部楼层
感谢分享,请教下
cookie_persist,my_asiayak_cookie_wx_openid,cons_no这3个具体怎么填或者格式?试了下抓包出来的填进去没用
回复

使用道具 举报

1

主题

83

帖子

1005

积分

金牌会员

Rank: 6Rank: 6

积分
1005
金钱
922
HASS币
0
发表于 2022-4-16 21:42:12 | 显示全部楼层
iamhyde 发表于 2022-4-16 21:27
感谢分享,请教下
cookie_persist,my_asiayak_cookie_wx_openid,cons_no这3个具体怎么填或者格式?试了下 ...

请问下server
ha-entity这两个节点有全称吗?
回复

使用道具 举报

1

主题

83

帖子

1005

积分

金牌会员

Rank: 6Rank: 6

积分
1005
金钱
922
HASS币
0
发表于 2022-4-16 21:47:25 | 显示全部楼层
iamhyde 发表于 2022-4-16 21:27
感谢分享,请教下
cookie_persist,my_asiayak_cookie_wx_openid,cons_no这3个具体怎么填或者格式?试了下 ...

不能看看你的流程截图?右侧配置流程的截图
回复

使用道具 举报

3

主题

301

帖子

3251

积分

论坛元老

Rank: 8Rank: 8

积分
3251
金钱
2950
HASS币
0
发表于 2022-4-17 10:35:50 | 显示全部楼层
loveyolanda 发表于 2022-4-16 21:47
不能看看你的流程截图?右侧配置流程的截图

ha-entity最后这个节点要在HA里装个Node插件,hacs里有
回复

使用道具 举报

16

主题

239

帖子

2941

积分

金牌会员

Rank: 6Rank: 6

积分
2941
金钱
2702
HASS币
0
发表于 2022-4-17 10:57:08 | 显示全部楼层
iamhyde 发表于 2022-4-17 10:35
ha-entity最后这个节点要在HA里装个Node插件,hacs里有

南方的大佬们,你们啥时候出南方电网的教程呀!
回复

使用道具 举报

1

主题

83

帖子

1005

积分

金牌会员

Rank: 6Rank: 6

积分
1005
金钱
922
HASS币
0
发表于 2022-4-17 11:38:07 | 显示全部楼层
iamhyde 发表于 2022-4-17 10:35
ha-entity最后这个节点要在HA里装个Node插件,hacs里有

谢谢,搞定了,好久没用nodered,不记得ha和nodered通信这一步了
回复

使用道具 举报

1

主题

83

帖子

1005

积分

金牌会员

Rank: 6Rank: 6

积分
1005
金钱
922
HASS币
0
发表于 2022-4-17 11:57:34 | 显示全部楼层
iamhyde 发表于 2022-4-16 21:27
感谢分享,请教下
cookie_persist,my_asiayak_cookie_wx_openid,cons_no这3个具体怎么填或者格式?试了下 ...

同意,我抓到的数据填进去没用
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-11-28 13:53 , Processed in 0.064028 second(s), 35 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表