caspia.meadow.metadata package

Submodules

caspia.meadow.metadata.provider module

class caspia.meadow.metadata.provider.MetadataProvider(broker_url, store, gateway_conn=None)[source]

Bases: object

handle_metadata_read(service, characteristic, **kwargs)[source]
handle_metadata_write(value, extra, service, characteristic, **kwargs)[source]
handle_store_event(name, old_value, new_value)[source]
metadata_only_services = ['group', 'room']
notify(service)[source]
class caspia.meadow.metadata.provider.MetadataProviderService(provider: caspia.meadow.metadata.provider.MetadataProvider)[source]

Bases: caspia.meadow.client.gateway.ServiceGatewayMixin, caspia.meadow.services.metadataprovider.MetadataProviderBase

Initialize new service.

Parameters
  • name – Name of the service (or just its path)

  • include – What optional characteristics to include. Tuple of their names.

property all_observables
attach(connection)
property attached
auto_discovery = True
characteristic_cached_read(characteristic)
characteristic_cached_write(characteristic, value_and_meta)
async characteristic_read(characteristic, **kwargs)
characteristic_subscribe(characteristic, on_value, on_error=None)
async characteristic_write(characteristic, value, **kwargs)[source]

Write a value to the characteristic.

Parameters
  • characteristic – The characteristic to which the value should be written.

  • value – The value to be written.

  • kwargs – Dictionary with extra key (dictionary with metadata) and optionally a timeout (float specifing explicit timeout for the operation).

characteristics = {'$metadata': <Characteristic <class 'caspia.meadow.services.base.ServiceMeta'>:$metadata>, 'create': <Characteristic <class 'caspia.meadow.services.base.ServiceMeta'>:create>, 'entries': <Characteristic <class 'caspia.meadow.services.base.ServiceMeta'>:entries>, 'remove': <Characteristic <class 'caspia.meadow.services.base.ServiceMeta'>:remove>}
create
detach()
entries
static get_subclass(stype, mixin=None)
load_definition(spec)

Update characteristics of this instance based on serialized specs.

Parameters

spec – Dict most likely going to be coming from meadow - from some gateway informing us about its services and their characteristics.

metadata
async notify(characteristic, value, if_changed=False, extra=None)
on(name, *args, **kwargs)
optional = {}
async published()
remove
serialize()

Return serialized version (most likely dict) if possible or None.

type = 'metadata-provider'

caspia.meadow.metadata.store module

class caspia.meadow.metadata.store.MetadataStore(directory)[source]

Bases: object

get_path(name)[source]
names()[source]
subscribe_events(fn)[source]

Subscribe to changes in the store.

Parameters

fn – Callable with signature fn(name, old_value, new_value, **kwargs).

class caspia.meadow.metadata.store.ServiceEntry(path, on_change)[source]

Bases: object

keys()[source]
read()[source]

Module contents