mirror of
https://github.com/esphome/aioesphomeapi.git
synced 2024-12-22 16:48:04 +01:00
CameraImageRequest
This commit is contained in:
parent
97c0f496a8
commit
0d67c464d7
@ -368,3 +368,8 @@ message ExecuteServiceRequest {
|
||||
fixed32 key = 1;
|
||||
repeated ExecuteServiceArgument args = 2;
|
||||
}
|
||||
|
||||
message CameraImageRequest {
|
||||
bool single = 1;
|
||||
bool stream = 2;
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
@ -61,6 +61,7 @@ MESSAGE_TYPE_TO_PROTO = {
|
||||
42: pb.ExecuteServiceRequest,
|
||||
43: pb.ListEntitiesCameraResponse,
|
||||
44: pb.CameraImageResponse,
|
||||
45: pb.CameraImageRequest,
|
||||
}
|
||||
|
||||
|
||||
@ -785,7 +786,6 @@ class APIClient:
|
||||
data = image_stream.pop(msg.key, bytes()) + msg.data
|
||||
if msg.done:
|
||||
on_state(CameraState(key=msg.key, image=data))
|
||||
_LOGGER.warning("Got image len=%s", len(data))
|
||||
else:
|
||||
image_stream[msg.key] = data
|
||||
return
|
||||
@ -957,3 +957,15 @@ class APIClient:
|
||||
args.append(arg)
|
||||
req.args.extend(args)
|
||||
await self._connection.send_message(req)
|
||||
|
||||
async def _request_image(self, *, single=False, stream=False):
|
||||
req = pb.CameraImageRequest()
|
||||
req.single = single
|
||||
req.stream = stream
|
||||
await self._connection.send_message(req)
|
||||
|
||||
async def request_single_image(self):
|
||||
await self._request_image(single=True)
|
||||
|
||||
async def request_image_stream(self):
|
||||
await self._request_image(stream=True)
|
||||
|
Loading…
Reference in New Issue
Block a user