本帖最后由 dscao 于 2022-3-10 22:44 编辑
https://bbs.hassbian.com/thread-11320-1-1.html
我是用这个的,一样操作的。
mqtt的话,加一句:json_attributes_topic
https://www.home-assistant.io/integrations/sensor.mqtt/
我用的就这一段就有实体了:
sensor:
- platform: rest
name: short_part_of_poem
method: GET
resource: https://v2.jinrishici.com/sentence
headers:
Content-Type: application/json
X-User-Token: ************
value_template: '{{value_json["data"]["id"]}}'
json_attributes_path: $.data
json_attributes:
- id
- content
- origin
- warning
scan_interval: 3540
|