Camera metadata with basic data

This commit is contained in:
Joe Knapper 2025-10-20 17:07:10 +01:00 committed by Julian Stirling
parent 13b190a8ca
commit b1413ca66c
2 changed files with 12 additions and 1 deletions

View file

@ -7,7 +7,7 @@ See repository root for licensing information.
""" """
from __future__ import annotations from __future__ import annotations
from typing import Literal, Optional, Tuple, Any from typing import Literal, Optional, Tuple, Any, Mapping
from types import TracebackType from types import TracebackType
import json import json
import io import io
@ -650,6 +650,11 @@ class BaseCamera(lt.Thing):
# Manually save settings as the setter is not called. # Manually save settings as the setter is not called.
self.save_settings() self.save_settings()
@property
def thing_state(self) -> Mapping[str, Any]:
"""Summary metadata describing the current state of the Thing."""
return {"capture_time": time.time()}
CameraDependency = lt.deps.direct_thing_client_dependency(BaseCamera, "/camera/") CameraDependency = lt.deps.direct_thing_client_dependency(BaseCamera, "/camera/")
RawCameraDependency = lt.deps.raw_thing_dependency(BaseCamera) RawCameraDependency = lt.deps.raw_thing_dependency(BaseCamera)

View file

@ -1093,3 +1093,9 @@ class StreamingPiCamera2(BaseCamera):
to be static (except "reset") to be static (except "reset")
""" """
return tf_utils.lst_is_static(self.tuning) return tf_utils.lst_is_static(self.tuning)
def get_thing_state(self) -> Mapping[str, Any]:
"""Update generic camera metadata with Picamera-specific data."""
state = super().get_thing_state()
state["camera_board"] = self._camera_board
return state