caspia.gateway_mock.services package

Submodules

caspia.gateway_mock.services.base module

class caspia.gateway_mock.services.base.MockService(config, storage)[source]

Bases: caspia.meadow.client.gateway.ServiceGatewayMixin

attach(connection)
property attached
characteristic_cached_read(characteristic)
characteristic_cached_write(characteristic, value_and_meta)
async characteristic_read(characteristic, **kwargs)
async characteristic_write(characteristic, value, **kwargs)
detach()
async notify(characteristic, value, if_changed=False, extra=None)
async published()
async simulate(**kwargs)[source]

caspia.gateway_mock.services.blinds module

class caspia.gateway_mock.services.blinds.Blinds(*args, **kwargs)[source]

Bases: caspia.gateway_mock.services.base.MockService, caspia.meadow.services.blinds.BlindsBase

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
blind
calibrate
characteristic_cached_read(characteristic)
characteristic_cached_write(characteristic, value_and_meta)
async characteristic_read(characteristic, **kwargs)[source]

Read value of 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).

Returns

Tuple (value, extra).

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>, 'blind': <Characteristic <class 'caspia.meadow.services.base.ServiceMeta'>:blind>, 'calibrate': <Characteristic <class 'caspia.meadow.services.base.ServiceMeta'>:calibrate>, 'move_down': <Characteristic <class 'caspia.meadow.services.base.ServiceMeta'>:move_down>, 'move_up': <Characteristic <class 'caspia.meadow.services.base.ServiceMeta'>:move_up>, 'movement': <Characteristic <class 'caspia.meadow.services.base.ServiceMeta'>:movement>, 'stop_movement': <Characteristic <class 'caspia.meadow.services.base.ServiceMeta'>:stop_movement>, 'target_blind': <Characteristic <class 'caspia.meadow.services.base.ServiceMeta'>:target_blind>, 'target_position': <Characteristic <class 'caspia.meadow.services.base.ServiceMeta'>:target_position>, 'target_tilt': <Characteristic <class 'caspia.meadow.services.base.ServiceMeta'>:target_tilt>, 'tilt': <Characteristic <class 'caspia.meadow.services.base.ServiceMeta'>:tilt>}
detach()
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
move_down
move_up
movement
async notify(characteristic, value, if_changed=False, extra=None)
on(name, *args, **kwargs)
optional = {}
async published()
serialize()

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

async simulate(**kwargs)
stop_movement
target_blind
target_position
target_tilt
tilt
type = 'blinds'

caspia.gateway_mock.services.button module

class caspia.gateway_mock.services.button.Button(*args, **kwargs)[source]

Bases: caspia.gateway_mock.services.base.MockService, caspia.meadow.services.button.ButtonBase

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>, 'do_event': <Characteristic <class 'caspia.meadow.services.base.ServiceMeta'>:do_event>, 'event': <Characteristic <class 'caspia.meadow.services.base.ServiceMeta'>:event>, 'is_pushed': <Characteristic <class 'caspia.meadow.services.base.ServiceMeta'>:is_pushed>, 'push': <Characteristic <class 'caspia.meadow.services.base.ServiceMeta'>:push>, 'release': <Characteristic <class 'caspia.meadow.services.base.ServiceMeta'>:release>}
detach()
do_event
event
static get_subclass(stype, mixin=None)
is_pushed
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()
push
release
serialize()

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

async simulate(**kwargs)
subscribe_events()
type = 'button'

caspia.gateway_mock.services.fan module

class caspia.gateway_mock.services.fan.Fan(*args, **kwargs)[source]

Bases: caspia.gateway_mock.services.base.MockService, caspia.meadow.services.fan.FanBase

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>, 'is_on': <Characteristic <class 'caspia.meadow.services.base.ServiceMeta'>:is_on>, 'speed': <Characteristic <class 'caspia.meadow.services.base.ServiceMeta'>:speed>, 'toggle': <Characteristic <class 'caspia.meadow.services.base.ServiceMeta'>:toggle>}
detach()
static get_subclass(stype, mixin=None)
is_on
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 = {'speed'}
async published()
serialize()

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

async simulate(**kwargs)
speed
toggle
type = 'fan'

caspia.gateway_mock.services.light module

class caspia.gateway_mock.services.light.Light(*args, **kwargs)[source]

Bases: caspia.gateway_mock.services.base.MockService, caspia.meadow.services.light.LightBase

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
brightness
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>, 'brightness': <Characteristic <class 'caspia.meadow.services.base.ServiceMeta'>:brightness>, 'hue': <Characteristic <class 'caspia.meadow.services.base.ServiceMeta'>:hue>, 'is_on': <Characteristic <class 'caspia.meadow.services.base.ServiceMeta'>:is_on>, 'saturation': <Characteristic <class 'caspia.meadow.services.base.ServiceMeta'>:saturation>, 'toggle': <Characteristic <class 'caspia.meadow.services.base.ServiceMeta'>:toggle>}
detach()
static get_subclass(stype, mixin=None)
hue
is_on
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 = {'brightness', 'hue', 'saturation'}
async published()
saturation
serialize()

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

async simulate(**kwargs)
toggle
type = 'light'

caspia.gateway_mock.services.lockmechanism module

class caspia.gateway_mock.services.lockmechanism.LockMechanism(*args, **kwargs)[source]

Bases: caspia.gateway_mock.services.base.MockService, caspia.meadow.services.lockmechanism.LockMechanismBase

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)[source]

Read value of 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).

Returns

Tuple (value, extra).

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>, 'state': <Characteristic <class 'caspia.meadow.services.base.ServiceMeta'>:state>, 'target_state': <Characteristic <class 'caspia.meadow.services.base.ServiceMeta'>:target_state>}
detach()
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()
serialize()

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

async simulate(**kwargs)
state
target_state
type = 'lock-mechanism'

caspia.gateway_mock.services.outlet module

class caspia.gateway_mock.services.outlet.Outlet(*args, **kwargs)[source]

Bases: caspia.gateway_mock.services.base.MockService, caspia.meadow.services.outlet.OutletBase

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>, 'is_on': <Characteristic <class 'caspia.meadow.services.base.ServiceMeta'>:is_on>, 'toggle': <Characteristic <class 'caspia.meadow.services.base.ServiceMeta'>:toggle>}
detach()
static get_subclass(stype, mixin=None)
is_on
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()
serialize()

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

async simulate(**kwargs)
toggle
type = 'outlet'

caspia.gateway_mock.services.temperature module

class caspia.gateway_mock.services.temperature.TemperatureSensor(*args, **kwargs)[source]

Bases: caspia.gateway_mock.services.base.MockService, caspia.meadow.services.sensors.temperature.TemperatureSensorBase

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)
characteristics = {'$metadata': <Characteristic <class 'caspia.meadow.services.base.ServiceMeta'>:$metadata>, 'temp': <Characteristic <class 'caspia.meadow.services.base.ServiceMeta'>:temp>}
detach()
static get_subclass(stype, mixin=None)
property interval
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()
serialize()

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

async simulate(**kwargs)
temp
type = 'temperature-sensor'

Module contents