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

 找回密码
 立即注册
查看: 6555|回复: 6

[进阶教程] 雷士,至拓,东联,WiFi灯接入ha

[复制链接]

8

主题

270

帖子

1337

积分

金牌会员

Rank: 6Rank: 6

积分
1337
金钱
1067
HASS币
0
发表于 2019-4-11 17:27:02 | 显示全部楼层 |阅读模式
如何判断是否支持使用我这种方式接入,就下载一个(雷士智能照明)app添加即可测试。
或者使用本代码进行监听
在同一网域下电脑使用NETCAT (ANDROID手机用BUSYBOX可能也行) nc -lkup 9999 可看到上面的资讯
然后就用nodered进行接入。代码如下
雷士云的mqtt
账号:DL_APP
密码:dl_123456
[
    {
        "id": "f0ac0509.873a58",
        "type": "tab",
        "label": "Flow 2",
        "disabled": false,
        "info": ""
    },
    {
        "id": "9baec7d0.2429d8",
        "type": "mqtt-broker",
        "z": "",
        "name": "雷士云",
        "broker": "www.xlinyun.com",
        "port": "1883",
        "clientid": "",
        "usetls": false,
        "compatmode": true,
        "keepalive": "60",
        "cleansession": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthRetain": "false",
        "birthPayload": "",
        "closeTopic": "",
        "closeQos": "0",
        "closePayload": "",
        "willTopic": "",
        "willQos": "0",
        "willRetain": "false",
        "willPayload": ""
    },
    {
        "id": "926435db.04fad8",
        "type": "mqtt-broker",
        "z": "",
        "name": "homeassistant",
        "broker": "127.0.0.1",
        "port": "1883",
        "clientid": "",
        "usetls": false,
        "compatmode": true,
        "keepalive": "60",
        "cleansession": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthPayload": "",
        "closeTopic": "",
        "closeQos": "0",
        "closePayload": "",
        "willTopic": "",
        "willQos": "0",
        "willPayload": ""
    },
    {
        "id": "726fbace.67be94",
        "type": "mqtt in",
        "z": "f0ac0509.873a58",
        "name": "监听雷士云信息输入",
        "topic": "uuid/out",####这里填写你的uuid
        "qos": "0",
        "datatype": "auto",
        "broker": "9baec7d0.2429d8",
        "x": 130,
        "y": 120,
        "wires": [
            [
                "522d9d1b.98cbd4",
                "4c5a013a.d2416"
            ]
        ]
    },
    {
        "id": "522d9d1b.98cbd4",
        "type": "debug",
        "z": "f0ac0509.873a58",
        "name": "云端监听信息",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "x": 460,
        "y": 80,
        "wires": []
    },
    {
        "id": "ec2249c7.c6f008",
        "type": "mqtt in",
        "z": "f0ac0509.873a58",
        "name": "ha输入",
        "topic": "uuid/userin",####填写自己的uuid
        "qos": "0",
        "datatype": "utf8",
        "broker": "926435db.04fad8",
        "x": 130,
        "y": 400,
        "wires": [
            [
                "b1b2ebd2.d95478",
                "5a8a426f.567e1c"
            ]
        ]
    },
    {
        "id": "b1b2ebd2.d95478",
        "type": "debug",
        "z": "f0ac0509.873a58",
        "name": "ha发送信息",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "x": 450,
        "y": 320,
        "wires": []
    },
    {
        "id": "4c5a013a.d2416",
        "type": "change",
        "z": "f0ac0509.873a58",
        "name": "",
        "rules": [
            {
                "t": "change",
                "p": "payload",
                "pt": "msg",
                "from": ""cwhite": 2216,"wwhite": 5171",
                "fromt": "re",
                "to": "春季",
                "tot": "str"
            },
            {
                "t": "change",
                "p": "payload",
                "pt": "msg",
                "from": ""cwhite": 7387,"wwhite": 0",
                "fromt": "str",
                "to": "夏季",
                "tot": "str"
            },
            {
                "t": "change",
                "p": "payload",
                "pt": "msg",
                "from": ""cwhite": 5171,"wwhite": 2216",
                "fromt": "str",
                "to": "秋季",
                "tot": "str"
            },
            {
                "t": "change",
                "p": "payload",
                "pt": "msg",
                "from": ""cwhite": 820,"wwhite": 7371",
                "fromt": "str",
                "to": "冬季",
                "tot": "str"
            },
            {
                "t": "change",
                "p": "payload",
                "pt": "msg",
                "from": ""cwhite": 8191,"wwhite": 0",
                "fromt": "str",
                "to": "明亮",
                "tot": "str"
            },
            {
                "t": "change",
                "p": "payload",
                "pt": "msg",
                "from": ""cwhite": 2859,"wwhite": 2858",
                "fromt": "str",
                "to": "温馨",
                "tot": "str"
            },
            {
                "t": "change",
                "p": "payload",
                "pt": "msg",
                "from": ""cwhite": 60,"wwhite": 60",
                "fromt": "str",
                "to": "辅光",
                "tot": "str"
            },
            {
                "t": "change",
                "p": "payload",
                "pt": "msg",
                "from": ""cwhite": 4096,"wwhite": 4095",
                "fromt": "str",
                "to": "on",
                "tot": "str"
            },
            {
                "t": "change",
                "p": "payload",
                "pt": "msg",
                "from": ""cwhite": 0,"wwhite": 0",
                "fromt": "str",
                "to": "off",
                "tot": "str"
            },
            {
                "t": "change",
                "p": "payload",
                "pt": "msg",
                "from": ""uuid": "6601-04164371-2c3ae83f8b13-8",",
                "fromt": "re",
                "to": "",
                "tot": "str"
            },
            {
                "t": "change",
                "p": "payload",
                "pt": "msg",
                "from": "fw|[0-9]",
                "fromt": "re",
                "to": "",
                "tot": "str"
            },
            {
                "t": "change",
                "p": "payload",
                "pt": "msg",
                "from": "mode|[0-9]",
                "fromt": "re",
                "to": "",
                "tot": "str"
            },
            {
                "t": "change",
                "p": "payload",
                "pt": "msg",
                "from": "{|}",
                "fromt": "re",
                "to": "",
                "tot": "str"
            },
            {
                "t": "change",
                "p": "payload",
                "pt": "msg",
                "from": "rgb|red|green|blue|“|"|-|,|:",
                "fromt": "re",
                "to": "",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 460,
        "y": 220,
        "wires": [
            [
                "4ede1b66.135874",
                "81977f7d.d00b4"
            ]
        ]
    },
    {
        "id": "5a8a426f.567e1c",
        "type": "change",
        "z": "f0ac0509.873a58",
        "name": "",
        "rules": [
            {
                "t": "change",
                "p": "payload",
                "pt": "msg",
                "from": "春季",
                "fromt": "str",
                "to": " {"cwhite": 2216,"wwhite": 5171}",
                "tot": "str"
            },
            {
                "t": "change",
                "p": "payload",
                "pt": "msg",
                "from": "夏季",
                "fromt": "str",
                "to": "{"cwhite": 7387,"wwhite": 0}",
                "tot": "str"
            },
            {
                "t": "change",
                "p": "payload",
                "pt": "msg",
                "from": "秋季",
                "fromt": "str",
                "to": "{"cwhite": 5171,"wwhite": 2216}",
                "tot": "str"
            },
            {
                "t": "change",
                "p": "payload",
                "pt": "msg",
                "from": "冬季",
                "fromt": "str",
                "to": "{"cwhite": 820,"wwhite": 7371}",
                "tot": "str"
            },
            {
                "t": "change",
                "p": "payload",
                "pt": "msg",
                "from": "明亮",
                "fromt": "str",
                "to": "{"cwhite": 8191,"wwhite": 0}",
                "tot": "str"
            },
            {
                "t": "change",
                "p": "payload",
                "pt": "msg",
                "from": "温馨",
                "fromt": "str",
                "to": "{"cwhite": 2859,"wwhite": 2858}",
                "tot": "str"
            },
            {
                "t": "change",
                "p": "payload",
                "pt": "msg",
                "from": "辅光",
                "fromt": "str",
                "to": "{"cwhite": 60,"wwhite": 60}",
                "tot": "str"
            },
            {
                "t": "change",
                "p": "payload",
                "pt": "msg",
                "from": "off",
                "fromt": "str",
                "to": "{"cwhite": 0,"wwhite": 0}",
                "tot": "str"
            },
            {
                "t": "change",
                "p": "payload",
                "pt": "msg",
                "from": "on",
                "fromt": "str",
                "to": "{"cwhite": 4096,"wwhite": 4095}",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 460,
        "y": 500,
        "wires": [
            [
                "b8903514.c0db48",
                "51ab6c60.d92664"
            ]
        ]
    },
    {
        "id": "b8903514.c0db48",
        "type": "mqtt out",
        "z": "f0ac0509.873a58",
        "name": "转发雷士云",
        "topic": "uuid/userin",####替换uuid
        "qos": "0",
        "retain": "false",
        "broker": "9baec7d0.2429d8",
        "x": 710,
        "y": 420,
        "wires": []
    },
    {
        "id": "4ede1b66.135874",
        "type": "mqtt out",
        "z": "f0ac0509.873a58",
        "name": "homeassistant监听",
        "topic": "####替换uuid/out",
        "qos": "0",
        "retain": "false",
        "broker": "926435db.04fad8",
        "x": 910,
        "y": 120,
        "wires": []
    },
    {
        "id": "81977f7d.d00b4",
        "type": "debug",
        "z": "f0ac0509.873a58",
        "name": "云端修改规则监听",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "x": 910,
        "y": 240,
        "wires": []
    },
    {
        "id": "51ab6c60.d92664",
        "type": "debug",
        "z": "f0ac0509.873a58",
        "name": "ha修改规则监听",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "x": 700,
        "y": 580,
        "wires": []
    }
]

这里添加完毕部署后,你控制灯就可以看到反馈信息了,然后ha我才用的input+自动化方式接入。其他方式没有研究明白。有大神能折腾请告诉我。
ha代码如下
input_select:
  thermostat_mode:
    name: Thermostat Mode
    options:
      - "春季"
      - "夏季"
      - "秋季"
      - "冬季"
      - "明亮"
      - "温馨"
      - "辅光"
      - "off"
      - "on"
automation:
- alias: Set Thermostat Mode Selector
  trigger:
    platform: mqtt
    topic: "uuid/out"###替换为你的uuid
   # entity_id: input_select.thermostat_mode
  action:
     service: input_select.select_option
     data_template:
      entity_id: input_select.thermostat_mode
      option: "{{ trigger.payload }}"

 # This automation script runs when the thermostat mode selector is changed.
 # It publishes its value to the same MQTT topic it is also subscribed to.
- alias: Set Thermostat Mode
  trigger:
    platform: state
    entity_id: input_select.thermostat_mode
  action:
    service: mqtt.publish
    data_template:
      topic: "uuid/userin"#####替换为你的uuid
      retain: true
      payload: "{{ states('input_select.thermostat_mode') }}"

至此接入完毕,如何搞到Siri自己折腾把,
回复

使用道具 举报

27

主题

2143

帖子

8930

积分

论坛元老

Rank: 8Rank: 8

积分
8930
金钱
6782
HASS币
30

论坛元老

发表于 2019-4-11 17:52:32 | 显示全部楼层
沙发........
回复

使用道具 举报

8

主题

870

帖子

5218

积分

论坛元老

Rank: 8Rank: 8

积分
5218
金钱
4348
HASS币
0
发表于 2019-4-11 19:33:18 | 显示全部楼层
学习学习
回复

使用道具 举报

1

主题

44

帖子

285

积分

中级会员

Rank: 3Rank: 3

积分
285
金钱
241
HASS币
0
发表于 2019-4-11 23:01:50 | 显示全部楼层
地板……
回复

使用道具 举报

2

主题

150

帖子

571

积分

高级会员

Rank: 4

积分
571
金钱
421
HASS币
0
发表于 2019-5-29 23:39:14 | 显示全部楼层
感谢分享·············
回复

使用道具 举报

20

主题

216

帖子

1458

积分

论坛DIY达人

积分
1458
金钱
1217
HASS币
100
发表于 2019-6-14 23:41:49 | 显示全部楼层
不错,顶起
回复

使用道具 举报

12

主题

259

帖子

1014

积分

金牌会员

Rank: 6Rank: 6

积分
1014
金钱
754
HASS币
0
发表于 2019-11-6 16:00:57 | 显示全部楼层
请问你下载的是哪个app啊?我下载的一直在转圈圈进不去
回复

使用道具 举报

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

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-11-25 12:50 , Processed in 0.238328 second(s), 30 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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