Image
The Image integration集成将 Home Assistant 与您的设备、服务等连接和集成。 [Learn more] allows other integrations to display a static image.
构建模块集成
这个 image 是一个构建模块集成,无法直接添加到你的 Home Assistant 中,但可以被其他集成使用和提供。
构建模块集成不同于典型的与设备或服务连接的集成。相反,其他将设备或服务集成到 Home Assistant 中的集成使用这个 image 构建模块来提供实体、服务和其他你可以在自动化或仪表板中使用的功能。
如果你的某个集成具有这个构建模块,这个页面记录了 image 构建模块所提供的功能。
The state of an image entity
The state of an image entity is a timestamp, showing the date and time when the image was last changed.
In addition, the entity can have the following states:
- Unavailable: The entity is currently unavailable.
- Unknown: The state is not yet known.
Actions
Once loaded, the image
platform will expose services that can be called to perform various actions.
Available services: snapshot
.
Action snapshot
Take a snapshot from an image.
Data attribute | Optional | Description |
---|---|---|
entity_id |
no | Name(s) of entities to create a snapshot from, e.g., image.my_image . |
filename |
no | Snapshot file name |
The path part of filename
must be an entry in the allowlist_external_dirs
in your homeassistant:
section of your configuration.yaml
file.
For example, the following action in an automation would take a snapshot from “yourimage” and save it to /tmp with a timestamped filename.
actions:
- variables:
entity_id: image.yourimage # Store the camera entity_id in a variable for reuse
- action: image.snapshot
target:
entity_id: '{{ entity_id }}'
data:
filename: '/tmp/{{ entity_id }}_{{ now().strftime("%Y%m%d-%H%M%S") }}.jpg'