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

 找回密码
 立即注册
楼主: lidicn

[流程系列] 播报温度变化【历史查询节点】

  [复制链接]

0

主题

67

帖子

466

积分

中级会员

Rank: 3Rank: 3

积分
466
金钱
399
HASS币
0
发表于 2023-4-29 22:05:24 | 显示全部楼层
谢谢!!!!!!!!!!!!!!!!1
回复

使用道具 举报

0

主题

4

帖子

19

积分

新手上路

Rank: 1

积分
19
金钱
15
HASS币
0
发表于 2023-5-3 15:02:14 | 显示全部楼层
学习,谢谢分享
回复

使用道具 举报

0

主题

152

帖子

1456

积分

金牌会员

Rank: 6Rank: 6

积分
1456
金钱
1304
HASS币
0
发表于 2023-5-12 15:05:50 | 显示全部楼层
大佬这个代码无法使用呢?能不能从新分享一下
回复

使用道具 举报

3

主题

38

帖子

230

积分

中级会员

Rank: 3Rank: 3

积分
230
金钱
192
HASS币
0
发表于 2023-5-18 09:38:20 | 显示全部楼层
学习了谢谢
回复

使用道具 举报

1

主题

47

帖子

234

积分

中级会员

Rank: 3Rank: 3

积分
234
金钱
187
HASS币
0
发表于 2023-5-22 17:33:03 | 显示全部楼层
感谢分享喔!!!!!
回复

使用道具 举报

1

主题

5

帖子

28

积分

新手上路

Rank: 1

积分
28
金钱
23
HASS币
0
发表于 2023-6-15 18:31:33 | 显示全部楼层
感谢分享
回复

使用道具 举报

0

主题

16

帖子

285

积分

中级会员

Rank: 3Rank: 3

积分
285
金钱
269
HASS币
0
发表于 2023-6-16 11:36:48 | 显示全部楼层
学习学习
回复

使用道具 举报

0

主题

3

帖子

22

积分

新手上路

Rank: 1

积分
22
金钱
19
HASS币
0
发表于 2023-6-19 08:39:29 | 显示全部楼层
学习,谢谢分享
回复

使用道具 举报

12

主题

85

帖子

746

积分

高级会员

Rank: 4

积分
746
金钱
661
HASS币
10
发表于 2023-8-25 09:03:30 | 显示全部楼层
导入有问题,试试这个,去了引号。
[
    {
        "id": "cff13234.5d9ce",
        "type": "api-get-history",
        "z": "d01ca094.762a5",
        "name": "",
        "server": "94f0c0a9.629b6",
        "startdate": "",
        "enddate": "",
        "entityid": "sensor.temperature_158d0000fd539c",
        "entityidtype": "includes",
        "useRelativeTime": true,
        "relativeTime": "1day",
        "output_type": "array",
        "output_location_type": "msg",
        "output_location": "payload",
        "x": 950,
        "y": 1740,
        "wires": [
            [
                "91cca1c6.ce01c"
            ]
        ]
    },
    {
        "id": "9e63c1e5.e81c5",
        "type": "api-current-state",
        "z": "d01ca094.762a5",
        "name": "客厅当前温度",
        "server": "94f0c0a9.629b6",
        "halt_if": "",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "override_topic": true,
        "override_payload": true,
        "override_data": true,
        "entity_id": "sensor.temperature_158d0000fd539c",
        "state_type": "num",
        "outputs": 1,
        "x": 540,
        "y": 1920,
        "wires": [
            [
                "132990cb.dd89af",
                "b658fd8d.d7d4b"
            ]
        ]
    },
    {
        "id": "132990cb.dd89af",
        "type": "debug",
        "z": "d01ca094.762a5",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "x": 750,
        "y": 1820,
        "wires": []
    },
    {
        "id": "91cca1c6.ce01c",
        "type": "change",
        "z": "d01ca094.762a5",
        "name": "转移变量",
        "rules": [
            {
                "t": "move",
                "p": "payload[0][0].state",
                "pt": "msg",
                "to": "temp_1day",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 320,
        "y": 1920,
        "wires": [
            [
                "9e63c1e5.e81c5"
            ]
        ]
    },
    {
        "id": "b658fd8d.d7d4b",
        "type": "function",
        "z": "d01ca094.762a5",
        "name": "判断当前与昨天的温差",
        "func": "let d_value = msg.temp_1day - msg.payload\nif(Math.abs(d_value) >=5){\n if(d_value<0){\n msg.d_result = `升温${Math.abs(d_value).toFixed(1)}摄氏度`;\n }\n else if(d_value>0){\n msg.d_result = `降温${Math.abs(d_value).toFixed(1)}摄氏度`;\n }\n else{\n msg.d_reslut = '';\n }\n}\nelse{\n msg.d_reslut = '';\n }\nmsg.temp_today = msg.payload;\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 780,
        "y": 1920,
        "wires": [
            [
                "31a0e811.b19798",
                "495e7ef8.e3817"
            ]
        ]
    },
    {
        "id": "31a0e811.b19798",
        "type": "debug",
        "z": "d01ca094.762a5",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "x": 1030,
        "y": 1820,
        "wires": []
    },
    {
        "id": "c06a8b2e.c70218",
        "type": "comment",
        "z": "d01ca094.762a5",
        "name": "开灯播报当前温度与昨天同时间的温差",
        "info": "",
        "x": 150,
        "y": 1620,
        "wires": []
    },
    {
        "id": "fb12f9e4.83e6f8",
        "type": "rbe",
        "z": "d01ca094.762a5",
        "name": "",
        "func": "rbe",
        "gap": "",
        "start": "",
        "inout": "out",
        "property": "payload",
        "x": 390,
        "y": 1700,
        "wires": [
            [
                "39680da4.735072"
            ]
        ]
    },
    {
        "id": "8c3d7d37.2486c",
        "type": "server-state-changed",
        "z": "d01ca094.762a5",
        "name": "监测客厅右键灯",
        "server": "94f0c0a9.629b6",
        "entityidfilter": "switch.wall_switch_right_158d00014cf47a",
        "entityidfiltertype": "exact",
        "outputinitially": false,
        "state_type": "str",
        "haltifstate": "",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "outputs": 1,
        "x": 80,
        "y": 1700,
        "wires": [
            [
                "a9c366c3.c8f4e8"
            ]
        ]
    },
    {
        "id": "766b6dc2.82cf54",
        "type": "switch",
        "z": "d01ca094.762a5",
        "name": "灯新状态为开启",
        "property": "data.new_state.state",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "on",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 760,
        "y": 1740,
        "wires": [
            [
                "cff13234.5d9ce"
            ]
        ]
    },
    {
        "id": "5898f714.7e07c8",
        "type": "switch",
        "z": "d01ca094.762a5",
        "name": "灯新状态为关闭",
        "property": "data.new_state.state",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "off",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 760,
        "y": 1680,
        "wires": [
            []
        ]
    },
    {
        "id": "39680da4.735072",
        "type": "switch",
        "z": "d01ca094.762a5",
        "name": "排除原状态为未知",
        "property": "data.old_state.state",
        "propertyType": "msg",
        "rules": [
            {
                "t": "neq",
                "v": "unavailable",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 550,
        "y": 1700,
        "wires": [
            [
                "766b6dc2.82cf54",
                "5898f714.7e07c8"
            ]
        ]
    },
    {
        "id": "d8740cde.c616",
        "type": "api-call-service",
        "z": "d01ca094.762a5",
        "name": "小爱TTS",
        "server": "94f0c0a9.629b6",
        "service_domain": "hello_miai",
        "service": "add2msgqueue",
        "data": "",
        "render_data": false,
        "mergecontext": "",
        "output_location": "payload",
        "output_location_type": "msg",
        "x": 1260,
        "y": 1920,
        "wires": [
            []
        ]
    },
    {
        "id": "f435e9b6.bffd18",
        "type": "function",
        "z": "d01ca094.762a5",
        "name": "推送内容",
        "func": "\nvar message = `现在室内温度是${msg.temp_today}摄氏度,${msg.d_result}`;\nmsg.payload = {};\nmsg.payload.data ={ message : message , miai_num : 0 };\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 1120,
        "y": 1920,
        "wires": [
            [
                "d8740cde.c616"
            ]
        ]
    },
    {
        "id": "495e7ef8.e3817",
        "type": "switch",
        "z": "d01ca094.762a5",
        "name": "",
        "property": "d_reslut",
        "propertyType": "msg",
        "rules": [
            {
                "t": "neq",
                "v": "",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 990,
        "y": 1920,
        "wires": [
            [
                "f435e9b6.bffd18"
            ]
        ]
    },
    {
        "id": "a9c366c3.c8f4e8",
        "type": "time-range-switch",
        "z": "d01ca094.762a5",
        "name": "",
        "lat": "",
        "lon": "",
        "startTime": "07:00",
        "endTime": "09:30",
        "startOffset": 0,
        "endOffset": 0,
        "x": 250,
        "y": 1700,
        "wires": [
            [
                "fb12f9e4.83e6f8"
            ],
            []
        ]
    },
    {
        "id": "94f0c0a9.629b6",
        "type": "server",
        "z": "",
        "name": "Home Assistant",
        "legacy": true,
        "hassio": true,
        "rejectUnauthorizedCerts": true,
        "ha_boolean": "y|yes|true|on|home|open"
    }
]
回复

使用道具 举报

0

主题

7

帖子

68

积分

注册会员

Rank: 2

积分
68
金钱
61
HASS币
0
发表于 2023-8-25 10:09:16 | 显示全部楼层
初上手,學習中
謝謝
回复

使用道具 举报

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

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-11-22 00:29 , Processed in 0.387351 second(s), 30 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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