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

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

[教程系列] Node Red 系列教程之五 深入了解HomeAssistant REST API

  [复制链接]

1

主题

32

帖子

138

积分

注册会员

Rank: 2

积分
138
金钱
106
HASS币
0
发表于 2023-2-12 04:44:07 来自手机 | 显示全部楼层
向楼主学习
回复

使用道具 举报

3

主题

60

帖子

326

积分

中级会员

Rank: 3Rank: 3

积分
326
金钱
266
HASS币
0
发表于 2023-2-13 11:55:16 | 显示全部楼层
感谢分享,相当后续可以通过其他的插件开发信息推送
回复

使用道具 举报

0

主题

13

帖子

296

积分

中级会员

Rank: 3Rank: 3

积分
296
金钱
283
HASS币
0
发表于 2023-2-13 20:52:20 | 显示全部楼层

就喜欢楼主的node red系列教程
回复

使用道具 举报

0

主题

19

帖子

96

积分

注册会员

Rank: 2

积分
96
金钱
77
HASS币
0
发表于 2023-2-15 14:59:11 | 显示全部楼层
mark..................
回复

使用道具 举报

0

主题

19

帖子

96

积分

注册会员

Rank: 2

积分
96
金钱
77
HASS币
0
发表于 2023-2-15 15:41:23 | 显示全部楼层
HAAS的RestAPI认证方式发生了变化,需要更新下,发送http头的方式

https://developers.home-assistant.io/docs/api/rest?_highlight=api


All API calls have to be accompanied by the header Authorization: Bearer TOKEN, where TOKEN is replaced by your unique access token. You obtain a token ("Long-Lived Access Token") by logging into the frontend using a web browser, and going to your profile http://IP_ADDRESS:8123/profile. Be careful to copy the whole key.

There are multiple ways to consume the Home Assistant Rest API. One is with curl:

curl \
  -H "Authorization: Bearer TOKEN" \
  -H "Content-Type: application/json" \
  http://IP_ADDRESS:8123/ENDPOINT


[
    {
        "id": "f90588571bfc504c",
        "type": "tab",
        "label": "haas api",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "7f268d4.febee74",
        "type": "http request",
        "z": "f90588571bfc504c",
        "name": "",
        "method": "GET",
        "ret": "obj",
        "paytoqs": "ignore",
        "url": "http://192.168.31.240:8123/api/config",
        "tls": "",
        "persist": false,
        "proxy": "",
        "insecureHTTPParser": false,
        "authType": "",
        "senderr": false,
        "headers": [
            {
                "keyType": "other",
                "keyValue": "Authorization",
                "valueType": "other",
                "valueValue": "Bearer $Token"
            },
            {
                "keyType": "other",
                "keyValue": "Content-Type",
                "valueType": "other",
                "valueValue": "application/json"
            }
        ],
        "x": 660,
        "y": 480,
        "wires": [
            [
                "2fef896.6b40476"
            ]
        ]
    },
    {
        "id": "bb55b192.cd08b",
        "type": "inject",
        "z": "f90588571bfc504c",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 434,
        "y": 480,
        "wires": [
            [
                "7f268d4.febee74"
            ]
        ]
    },
    {
        "id": "2fef896.6b40476",
        "type": "debug",
        "z": "f90588571bfc504c",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 894,
        "y": 479,
        "wires": []
    }
]
回复

使用道具 举报

1

主题

48

帖子

574

积分

高级会员

Rank: 4

积分
574
金钱
526
HASS币
0
发表于 2023-2-17 16:01:18 | 显示全部楼层
学习学习学学习!
回复

使用道具 举报

1

主题

30

帖子

170

积分

注册会员

Rank: 2

积分
170
金钱
140
HASS币
0
发表于 2023-2-18 17:14:00 | 显示全部楼层
2333333333333333333333333333333333
回复

使用道具 举报

0

主题

1

帖子

24

积分

新手上路

Rank: 1

积分
24
金钱
23
HASS币
0
发表于 2023-2-19 22:59:06 | 显示全部楼层
....................
回复

使用道具 举报

1

主题

45

帖子

488

积分

中级会员

Rank: 3Rank: 3

积分
488
金钱
443
HASS币
0
发表于 2023-2-21 11:03:47 | 显示全部楼层

感谢分享
回复

使用道具 举报

0

主题

14

帖子

83

积分

注册会员

Rank: 2

积分
83
金钱
69
HASS币
0
发表于 2023-3-4 14:27:31 | 显示全部楼层
我在看天书
回复

使用道具 举报

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

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-5-3 14:32 , Processed in 0.102638 second(s), 30 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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