Class ClientObservableProperty

class sila2.client.ClientObservableProperty(parent_feature: ClientFeature, wrapped_property: ObservableProperty)

Wraps an observable property

subscribe(*, metadata: typing.Iterable[ClientMetadataInstance] | None = None, callbacks: typing.Iterable[typing.Callable[[ItemType], typing.Any]] = ()) Subscription[ItemType]

Subscribe to value updates

Parameters:

metadata – SiLA Client Metadata to send along with the subscription request

Returns:

subscription – Property value subscription

get(*, metadata: typing.Iterable[ClientMetadataInstance] | None = None) ItemType

Get the current value

Parameters:

metadata – SiLA Client Metadata to send along with the subscription request

Returns:

value – Current property value

Notes

This is equivalent to subscribing to the property and cancelling the subscription after receiving the first item