RESTful
RESTful 集成用于消费某个给定端点,该端点由设备、应用程序或 Web 服务通过 RESTful API 暴露。该传感器支持 GET 和 POST 请求。
如果每个端点只有一个传感器,也可以将 RESTful Sensor 和 RESTful Binary Sensor 作为平台进行设置。
:::important
请使用 resource 或 resource_template 其中之一。
:::
Using templates
For incoming data, a value template translates incoming JSON or raw data into a valid payload.
Incoming payloads are rendered with possible JSON values, so when rendering, the value_json variable can be used to access attributes in a JSON-based payload. Otherwise, the value variable can be used for non-JSON payloads.
The this variable can also be used in the template. The this attribute refers to the current entity state of the entity.
Further information about the this variable can be found in the template documentation.
Example value template with JSON:
With the following payload:
Template {{ value_json.temperature | round(1) }} renders to 21.9.

