找回密码
 立即注册

微信扫码登录

搜索
楼主: dhljj

[技术探讨] 海信电视接入HA后如何获取真实开关机状态?

[复制链接]

27

主题

431

回帖

3225

积分

论坛元老

积分
3225
金钱
2752
HASS币
120
发表于 2025-7-30 21:57:34 | 显示全部楼层
我现在正在研究海信爱家的node-red流,现在已经可以显示电视的开关机状态了,开机=电视有画面,关机=电视没有画面

1.jpg
回复

使用道具 举报

2

主题

102

回帖

669

积分

高级会员

积分
669
金钱
565
HASS币
0
发表于 2025-7-31 14:57:00 | 显示全部楼层
flashbj 发表于 2025-7-30 21:57
我现在正在研究海信爱家的node-red流,现在已经可以显示电视的开关机状态了,开机=电视有画面,关机=电视没 ...

你好 可以写一篇海信电视接入和显示电视状态的教程吗?
回复

使用道具 举报

27

主题

431

回帖

3225

积分

论坛元老

积分
3225
金钱
2752
HASS币
120
发表于 2025-7-31 20:12:25 | 显示全部楼层
Deardreams 发表于 2025-7-31 14:57
你好 可以写一篇海信电视接入和显示电视状态的教程吗?

这个流程我还没写完,等功能写完后,再写教程
回复

使用道具 举报

2

主题

102

回帖

669

积分

高级会员

积分
669
金钱
565
HASS币
0
发表于 2025-8-1 10:25:16 | 显示全部楼层
flashbj 发表于 2025-7-31 20:12
这个流程我还没写完,等功能写完后,再写教程

坐等大佬完成!
回复

使用道具 举报

3

主题

6

回帖

49

积分

新手上路

积分
49
金钱
40
HASS币
0
发表于 2025-10-6 14:20:29 | 显示全部楼层
flashbj 发表于 2025-7-31 20:12
这个流程我还没写完,等功能写完后,再写教程

大佬,你的海信电视功能做成功了吗
回复

使用道具 举报

0

主题

13

回帖

105

积分

注册会员

积分
105
金钱
92
HASS币
0
发表于 2025-10-7 07:43:48 | 显示全部楼层
我家的就是海信,通过米家集成过来的,现在的电视实体是路由器生成的,能看到状态
回复

使用道具 举报

27

主题

431

回帖

3225

积分

论坛元老

积分
3225
金钱
2752
HASS币
120
发表于 2025-10-8 01:23:41 | 显示全部楼层
229514031qqcom 发表于 2025-10-6 14:20
大佬,你的海信电视功能做成功了吗

目前还没有,海信爱家的签名还没搞定
回复

使用道具 举报

8

主题

59

回帖

366

积分

中级会员

积分
366
金钱
299
HASS币
0
 楼主| 发表于 2025-10-13 10:13:48 | 显示全部楼层
flashbj 发表于 2025-7-30 21:57
我现在正在研究海信爱家的node-red流,现在已经可以显示电视的开关机状态了,开机=电视有画面,关机=电视没 ...

大佬,你这个流程可以分享下吗
回复

使用道具 举报

27

主题

431

回帖

3225

积分

论坛元老

积分
3225
金钱
2752
HASS币
120
发表于 2025-10-13 10:54:10 | 显示全部楼层
dhljj 发表于 2025-10-13 10:13
大佬,你这个流程可以分享下吗


导入之后修改一下,username:改成你海信爱家的手机号,password改成你海信爱家的密码
11111.png
[{"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":""}]



回复

使用道具 举报

8

主题

59

回帖

366

积分

中级会员

积分
366
金钱
299
HASS币
0
 楼主| 发表于 2025-10-13 14:25:36 | 显示全部楼层
flashbj 发表于 2025-10-13 10:54
导入之后修改一下,username:改成你海信爱家的手机号,password改成你海信爱家的密码

牛逼呀,不过我今天用adb的形式也可以接入电视,同样可以拿到状态,不过你这个更好
回复

使用道具 举报

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

本版积分规则

Archiver|手机版|小黑屋|Hassbian ( 晋ICP备17001384号-1 )

GMT+8, 2025-12-1 02:48 , Processed in 0.057460 second(s), 13 queries , MemCached On.

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

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