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

 找回密码
 立即注册
查看: 2200|回复: 1

[教程系列] 小米米家加湿器接入hass,睡前关闭避免噪音睡着后自动开启

[复制链接]

21

主题

162

帖子

2113

积分

论坛DIY达人

积分
2113
金钱
1946
HASS币
30
发表于 2021-10-2 19:01:29 | 显示全部楼层 |阅读模式
[size=15.008px]避免睡前加湿器的风扇噪音,睡前联动灯关闭,在设定的时间后自动开启加湿器保持湿度,使用nodered实现。
[size=15.008px]视频教程
https://www.bilibili.com/video/BV1m3411y7rL/

[
    {
        "id": "3687aa50d23e61de",
        "type": "api-call-service",
        "z": "e2a8ceb6.b2cd",
        "name": "关闭加湿器",
        "server": "18668ea5.b519c1",
        "version": 3,
        "debugenabled": false,
        "service_domain": "humidifier",
        "service": "turn_off",
        "entityId": "humidifier.mi_smart_evaporative_humidifer_humidifier",
        "data": "",
        "dataType": "jsonata",
        "mergecontext": "",
        "mustacheAltTags": false,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "1",
                "valueType": "str"
            }
        ],
        "queue": "none",
        "x": 290,
        "y": 2740,
        "wires": [
            [
                "1aa2f15519bdad9f"
            ]
        ]
    },
    {
        "id": "3e2f27a83778ebc1",
        "type": "api-call-service",
        "z": "e2a8ceb6.b2cd",
        "name": "打开加湿器",
        "server": "18668ea5.b519c1",
        "version": 3,
        "debugenabled": false,
        "service_domain": "humidifier",
        "service": "turn_on",
        "entityId": "humidifier.mi_smart_evaporative_humidifer_humidifier",
        "data": "",
        "dataType": "jsonata",
        "mergecontext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 690,
        "y": 2800,
        "wires": [
            [
                "6a26691763dac8ce"
            ]
        ]
    },
    {
        "id": "6a26691763dac8ce",
        "type": "api-call-service",
        "z": "e2a8ceb6.b2cd",
        "name": "加湿器-恒湿模式",
        "server": "18668ea5.b519c1",
        "version": 3,
        "debugenabled": false,
        "service_domain": "humidifier",
        "service": "set_mode",
        "entityId": "humidifier.mi_smart_evaporative_humidifer_humidifier",
        "data": "{\t   \"entity_id\": \"humidifier.mi_smart_evaporative_humidifer_humidifier\",\t   \"mode\": \"Humidity\"\t}",
        "dataType": "jsonata",
        "mergecontext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 900,
        "y": 2780,
        "wires": [
            []
        ]
    },
    {
        "id": "1aa2f15519bdad9f",
        "type": "trigger",
        "z": "e2a8ceb6.b2cd",
        "name": "",
        "op1": "",
        "op2": "0",
        "op1type": "nul",
        "op2type": "str",
        "duration": "50",
        "extend": true,
        "overrideDelay": false,
        "units": "min",
        "reset": "",
        "bytopic": "all",
        "topic": "topic",
        "outputs": 2,
        "x": 670,
        "y": 2700,
        "wires": [
            [],
            [
                "8ec8b5c461ac508a"
            ]
        ]
    },
    {
        "id": "a7b580218ae95a7e",
        "type": "server-state-changed",
        "z": "e2a8ceb6.b2cd",
        "name": "卧室射灯",
        "server": "18668ea5.b519c1",
        "version": 3,
        "exposeToHomeAssistant": false,
        "haConfig": [
            {
                "property": "name",
                "value": ""
            },
            {
                "property": "icon",
                "value": ""
            }
        ],
        "entityidfilter": "switch.wo_shi_she_deng",
        "entityidfiltertype": "exact",
        "outputinitially": false,
        "state_type": "str",
        "haltifstate": "on",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "outputs": 2,
        "output_only_on_state_change": true,
        "for": 0,
        "forType": "num",
        "forUnits": "minutes",
        "ignorePrevStateNull": false,
        "ignorePrevStateUnknown": false,
        "ignorePrevStateUnavailable": false,
        "ignoreCurrentStateUnknown": false,
        "ignoreCurrentStateUnavailable": false,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "entityState"
            },
            {
                "property": "data",
                "propertyType": "msg",
                "value": "",
                "valueType": "eventData"
            },
            {
                "property": "topic",
                "propertyType": "msg",
                "value": "",
                "valueType": "triggerId"
            }
        ],
        "x": 260,
        "y": 2560,
        "wires": [
            [
                "7abb1909dddccdc1"
            ],
            []
        ]
    },
    {
        "id": "eed993f87c7878c8",
        "type": "server-state-changed",
        "z": "e2a8ceb6.b2cd",
        "name": "卧室灯",
        "server": "18668ea5.b519c1",
        "version": 3,
        "exposeToHomeAssistant": false,
        "haConfig": [
            {
                "property": "name",
                "value": ""
            },
            {
                "property": "icon",
                "value": ""
            }
        ],
        "entityidfilter": "switch.wo_shi_deng",
        "entityidfiltertype": "exact",
        "outputinitially": false,
        "state_type": "str",
        "haltifstate": "on",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "outputs": 2,
        "output_only_on_state_change": true,
        "for": 0,
        "forType": "num",
        "forUnits": "minutes",
        "ignorePrevStateNull": false,
        "ignorePrevStateUnknown": false,
        "ignorePrevStateUnavailable": false,
        "ignoreCurrentStateUnknown": false,
        "ignoreCurrentStateUnavailable": false,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "entityState"
            },
            {
                "property": "data",
                "propertyType": "msg",
                "value": "",
                "valueType": "eventData"
            },
            {
                "property": "topic",
                "propertyType": "msg",
                "value": "",
                "valueType": "triggerId"
            }
        ],
        "x": 270,
        "y": 2620,
        "wires": [
            [
                "7abb1909dddccdc1"
            ],
            []
        ]
    },
    {
        "id": "7abb1909dddccdc1",
        "type": "change",
        "z": "e2a8ceb6.b2cd",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "reset",
                "pt": "msg",
                "to": "1",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 460,
        "y": 2600,
        "wires": [
            [
                "1aa2f15519bdad9f"
            ]
        ]
    },
    {
        "id": "c67306b21020df3c",
        "type": "link in",
        "z": "e2a8ceb6.b2cd",
        "name": "加湿器-睡眠模式",
        "links": [
            "6a5b1640c31a6834",
            "7a14d5e1bbee7b17"
        ],
        "x": 175,
        "y": 2740,
        "wires": [
            [
                "3687aa50d23e61de"
            ]
        ]
    },
    {
        "id": "8ec8b5c461ac508a",
        "type": "api-current-state",
        "z": "e2a8ceb6.b2cd",
        "name": "加湿器状态",
        "server": "18668ea5.b519c1",
        "version": 2,
        "outputs": 1,
        "halt_if": "",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "entity_id": "humidifier.mi_smart_evaporative_humidifer_humidifier",
        "state_type": "str",
        "blockInputOverrides": false,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "entityState"
            },
            {
                "property": "data",
                "propertyType": "msg",
                "value": "",
                "valueType": "entity"
            }
        ],
        "override_topic": false,
        "state_location": "payload",
        "override_payload": "msg",
        "entity_location": "data",
        "override_data": "msg",
        "x": 870,
        "y": 2700,
        "wires": [
            [
                "67527da5fc0863b6"
            ]
        ]
    },
    {
        "id": "67527da5fc0863b6",
        "type": "switch",
        "z": "e2a8ceb6.b2cd",
        "name": "",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "off",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 1030,
        "y": 2700,
        "wires": [
            [
                "3e2f27a83778ebc1"
            ]
        ]
    },
    {
        "id": "8a8c108073121184",
        "type": "comment",
        "z": "e2a8ceb6.b2cd",
        "name": "开灯,重置倒计时",
        "info": "",
        "x": 510,
        "y": 2540,
        "wires": []
    },
    {
        "id": "18668ea5.b519c1",
        "type": "server",
        "name": ".7.7-Home Assistant",
        "version": 1,
        "legacy": false,
        "addon": false,
        "rejectUnauthorizedCerts": true,
        "ha_boolean": "y|yes|true|on|home|open",
        "connectionDelay": true,
        "cacheJson": true
    }
]

回复

使用道具 举报

32

主题

1983

帖子

5035

积分

论坛元老

Rank: 8Rank: 8

积分
5035
金钱
3052
HASS币
50
QQ
发表于 2021-10-8 12:12:11 | 显示全部楼层
谢谢分享。
我不生产技术,我只是技术的搬运工。
回复

使用道具 举报

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

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-4-20 23:11 , Processed in 0.085204 second(s), 24 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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