caspia.meadow.services package

Submodules

caspia.meadow.services.base module

class caspia.meadow.services.base.ServiceBase(name, include=())[source]

Bases: caspia.meadow.serialization.Serializable

Base class for Meadow services.

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
auto_discovery = True

True if this class should be discoverable using get_subclass

characteristic_cached_read(characteristic)[source]

This method implements return value of characteristic’s value property.

characteristic_cached_write(characteristic, value)[source]

This method implements writing to characteristic’s value property.

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

List of characteristics defined for the given class/service type.

Subclasses should not set this directly. This attribute is initialized automatically by ServiceMeta metaclass.

static get_subclass(stype, mixin=None)[source]
load_definition(spec)[source]

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
on(name, *args, **kwargs)[source]
optional = {}

Names of optional characteristic.

(subclasses might set this)

serialize()[source]

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

type = None

Type of the service

(subclasses should set this)

class caspia.meadow.services.base.ServiceMeta[source]

Bases: type

mro()

Return a type’s method resolution order.

caspia.meadow.services.blinds module

class caspia.meadow.services.blinds.BlindsBase(name, include=())[source]

Bases: caspia.meadow.services.base.ServiceBase

Represents a window blind.

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
auto_discovery = True
blind
calibrate
characteristic_cached_read(characteristic)

This method implements return value of characteristic’s value property.

characteristic_cached_write(characteristic, value)

This method implements writing to characteristic’s value property.

async characteristic_read(characteristic, **kwargs)

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)

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>}
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
on(name, *args, **kwargs)
optional = {}
serialize()

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

stop_movement
target_blind
target_position
target_tilt
tilt
type = 'blinds'
class caspia.meadow.services.blinds.BlindsMovement[source]

Bases: enum.Enum

Enumeration of possible blind’s movements.

DOWN = 'down'
STEADY = 'steady'
UP = 'up'

caspia.meadow.services.blindscontrol module

class caspia.meadow.services.blindscontrol.BlindsControlBase(name, include=())[source]

Bases: caspia.meadow.services.base.ServiceBase

Represents a blinds controller.

Initialize new service.

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

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

class Mode[source]

Bases: enum.Enum

An enumeration.

BLOCK_DIRECT_SUN_DOWN = 'block-direct-sun-or-down'
BLOCK_DIRECT_SUN_UP = 'block-direct-sun-or-up'
MANUAL = 'manual'
property all_observables
auto_discovery = True
characteristic_cached_read(characteristic)

This method implements return value of characteristic’s value property.

characteristic_cached_write(characteristic, value)

This method implements writing to characteristic’s value property.

async characteristic_read(characteristic, **kwargs)

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)

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>, 'mode': <Characteristic <class 'caspia.meadow.services.base.ServiceMeta'>:mode>}
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
mode
on(name, *args, **kwargs)
optional = {}
serialize()

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

type = 'blinds-control'

caspia.meadow.services.button module

class caspia.meadow.services.button.ButtonBase(*args, **kwargs)[source]

Bases: caspia.meadow.services.base.ServiceBase

Represents a button.

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
auto_discovery = True
characteristic_cached_read(characteristic)

This method implements return value of characteristic’s value property.

characteristic_cached_write(characteristic, value)

This method implements writing to characteristic’s value property.

async characteristic_read(characteristic, **kwargs)

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)

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>, '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>}
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
on(name, *args, **kwargs)[source]
optional = {}
push
release
serialize()

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

subscribe_events()[source]
type = 'button'
class caspia.meadow.services.button.ButtonClickEvent(button)[source]

Bases: caspia.meadow.services.button.ButtonEvent

classmethod deserialize(data, context)[source]
dispose_subscription(observer)

Remove subscription of given observer.

do(*args, **kwargs)
exception_handler(exception, stack, **kwargs)
async observe()

Return current value of the observable.

serialize()[source]

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

serialized_type = 'button-click-event'
subscribe(*args, **kwargs)

Create observer using given *args and **kwargs and subscribe to its changes.

Returns disposable representing the subscription => call .dispose() to unsubscribe.

async trigger(value: T, **kwargs)

Manually trigger value change.

class caspia.meadow.services.button.ButtonEvent(button)[source]

Bases: caspia.reactive.observable.Observable, caspia.meadow.serialization.Serializable, caspia.meadow.serialization.Deserializable

classmethod deserialize(data, context)
dispose_subscription(observer)

Remove subscription of given observer.

do(*args, **kwargs)[source]
exception_handler(exception, stack, **kwargs)
async observe()[source]

Return current value of the observable.

serialize()

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

serialized_type = None
subscribe(*args, **kwargs)

Create observer using given *args and **kwargs and subscribe to its changes.

Returns disposable representing the subscription => call .dispose() to unsubscribe.

async trigger(value: T, **kwargs)

Manually trigger value change.

class caspia.meadow.services.button.ButtonHoldEvent(button, interval, cancelling)[source]

Bases: caspia.meadow.services.button.ButtonEvent

classmethod deserialize(data, context)[source]
dispose_subscription(observer)

Remove subscription of given observer.

do(*args, **kwargs)
exception_handler(exception, stack, **kwargs)
async observe()

Return current value of the observable.

serialize()[source]

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

serialized_type = 'button-hold-event'
subscribe(*args, **kwargs)

Create observer using given *args and **kwargs and subscribe to its changes.

Returns disposable representing the subscription => call .dispose() to unsubscribe.

async trigger(value: T, **kwargs)

Manually trigger value change.

class caspia.meadow.services.button.ButtonTriggerEvent[source]

Bases: caspia.reactive.observers.Observer, caspia.meadow.serialization.Serializable, caspia.meadow.serialization.Deserializable

This class is to be used as “do” within an “on-do” rule.

For example let’s say, we want to have some Button trigger Button.event notification on ‘hold’ with interval 0.5. We must create “on-do” rule requesting this notification. Then the on-do rule will loke something like this:

OnDoRule(
    on=ButtonHoldEvent(my_button, 0.5, cancelling=True),
    do=ButtonTriggerEvent()
    )
If this OnDoRule gets optimized by some gateway, it means, that the button is going to

send Button.event notification on the specified event. In this example, the Button.event notification is going to have value ‘hold’ and metadata of the notification will contain the interval=0.5.

static create(*args, **kwargs)
creators = [<function CharacteristicObserver.creator>, <function FunctionObserver.creator>]
classmethod deserialize(data, context)[source]
disable()
enable()
property is_enabled
async on_error(error, **kwargs)[source]
async on_next(value, **kwargs)[source]
static register_creator(creator)
serialize()[source]

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

serialized_type = 'button-trigger-event'

caspia.meadow.services.characteristic module

class caspia.meadow.services.characteristic.Characteristic(value_type, permissions, name=None, service=None, accepts_null=False, validate=(), description=None)[source]

Bases: caspia.reactive.observable.Observable, caspia.meadow.serialization.Serializable, caspia.meadow.serialization.Deserializable

Initialize new characteristic.

Parameters
  • value_type – The value-type of the characteristic (string, e.g. ‘bool’)

  • permissions – String describing allowed operations with the characteristic value. For example ‘RW’ means “Readable and Notifiable”. Valid chars are “R” “W” and “N”.

  • name – The name of the characteristic. If None, must be provided later.

  • service – The parent service for this characteristic. If None, must be provided later.

  • accepts_null – Boolean indicating, whether None is valid value for the characteristic.

  • validate – Tuple of extra validators for the characteristic value. Validator is a callable(value) -> None, which raises ValueError for invalid value.

  • description – Optional description of the characteristic used for documentation.

accepts_null = None

True if value might be null

classmethod deserialize(data, context)[source]
deserialize_value(value)[source]
disable_notifications()[source]

Disable receiving notifications from meadow.

dispose_subscription(observer)

Remove subscription of given observer.

do(*args, **kwargs)
async enable_notifications()[source]

Enable receiving and processing notifications from meadow.

exception_handler(exception, stack, **kwargs)
extra_validators = None

Tuple of extra validators

name = None

Name of the Characteristic

property notifiable
async observe()[source]

Return current value of the observable.

async on_error_notification(error, **_)[source]

Shall be Called on a new incoming notification (containing error).

Parameters

error – the error

async on_value_notification(value, extra, **_)[source]

Shall be called on new incoming notification via meadow connection.

Parameters
  • value – is the raw - serialized value received

  • extra – dictionary of value’s metadata

permissions = None

Value permissions (Readable, Writable, Notifiable) as string. For example “RWN”.

async read(*, timeout=1.0, extra=False)[source]

Read value of the characteristic.

property readable
serialize()[source]

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

serialize_value(value)[source]
serialized_type = 'characteristic-notification'
service = None

Parent service

subscribe(*args, **kwargs)

Create observer using given *args and **kwargs and subscribe to its changes.

Returns disposable representing the subscription => call .dispose() to unsubscribe.

async trigger(value: T, **kwargs)

Manually trigger value change.

validate_value(value)[source]

Validate given value.

Raises

ValueError – if the value is not valid

property value
property value_and_extra
value_type = None

Value type of the characteristic

property writable
async write(value, *, extra=None, timeout=1.0)[source]

Write value to the characteristic.

caspia.meadow.services.display module

class caspia.meadow.services.display.DisplayBase(name, include=())[source]

Bases: caspia.meadow.services.base.ServiceBase

Represents fully controlable display.

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
auto_discovery = True
characteristic_cached_read(characteristic)

This method implements return value of characteristic’s value property.

characteristic_cached_write(characteristic, value)

This method implements writing to characteristic’s value property.

async characteristic_read(characteristic, **kwargs)

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)

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>, 'update': <Characteristic <class 'caspia.meadow.services.base.ServiceMeta'>:update>}
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
on(name, *args, **kwargs)
optional = {}
serialize()

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

type = 'display'
update

caspia.meadow.services.door module

class caspia.meadow.services.door.DoorBase(name, include=())[source]

Bases: caspia.meadow.services.base.ServiceBase

Represents a door.

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
auto_discovery = True
characteristic_cached_read(characteristic)

This method implements return value of characteristic’s value property.

characteristic_cached_write(characteristic, value)

This method implements writing to characteristic’s value property.

async characteristic_read(characteristic, **kwargs)

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)

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_handle_down': <Characteristic <class 'caspia.meadow.services.base.ServiceMeta'>:is_handle_down>, 'is_open': <Characteristic <class 'caspia.meadow.services.base.ServiceMeta'>:is_open>}
static get_subclass(stype, mixin=None)
is_handle_down
is_open
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
on(name, *args, **kwargs)
optional = {}
serialize()

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

type = 'door'

caspia.meadow.services.fan module

class caspia.meadow.services.fan.FanBase(name, include=())[source]

Bases: caspia.meadow.services.base.ServiceBase

Represents a fan.

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
auto_discovery = True
characteristic_cached_read(characteristic)

This method implements return value of characteristic’s value property.

characteristic_cached_write(characteristic, value)

This method implements writing to characteristic’s value property.

async characteristic_read(characteristic, **kwargs)

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)

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>}
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
on(name, *args, **kwargs)
optional = {'speed'}
serialize()

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

speed
toggle
type = 'fan'

caspia.meadow.services.irrigation module

class caspia.meadow.services.irrigation.IrrigationBase(name, include=())[source]

Bases: caspia.meadow.services.base.ServiceBase

Represents an irrigation.

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
auto_discovery = True
characteristic_cached_read(characteristic)

This method implements return value of characteristic’s value property.

characteristic_cached_write(characteristic, value)

This method implements writing to characteristic’s value property.

async characteristic_read(characteristic, **kwargs)

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)

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>}
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
on(name, *args, **kwargs)
optional = {}
serialize()

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

toggle
type = 'irrigation'

caspia.meadow.services.light module

class caspia.meadow.services.light.LightBase(name, include=())[source]

Bases: caspia.meadow.services.base.ServiceBase

Represents a light (of any type, lightbulb, LED etc).

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
auto_discovery = True
brightness
characteristic_cached_read(characteristic)

This method implements return value of characteristic’s value property.

characteristic_cached_write(characteristic, value)

This method implements writing to characteristic’s value property.

async characteristic_read(characteristic, **kwargs)

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)

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>}
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
on(name, *args, **kwargs)
optional = {'brightness', 'hue', 'saturation'}
saturation
serialize()

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

toggle
type = 'light'
class caspia.meadow.services.light.LightGroup(name)[source]

Bases: caspia.meadow.services.light.LightBase

Utility class for light grouping.

Initialize new service.

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

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

add(*lights)[source]
property all_observables
auto_discovery = True
brightness
characteristic_cached_read(characteristic)

This method implements return value of characteristic’s value property.

characteristic_cached_write(characteristic, value)

This method implements writing to characteristic’s value property.

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>, '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>}
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
on(name, *args, **kwargs)
optional = {'brightness', 'hue', 'saturation'}
saturation
serialize()

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

toggle
type = 'light'

caspia.meadow.services.lockmechanism module

class caspia.meadow.services.lockmechanism.LockMechanismBase(name, include=())[source]

Bases: caspia.meadow.services.base.ServiceBase

Represents a physical lock.

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
auto_discovery = True
characteristic_cached_read(characteristic)

This method implements return value of characteristic’s value property.

characteristic_cached_write(characteristic, value)

This method implements writing to characteristic’s value property.

async characteristic_read(characteristic, **kwargs)

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)

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>}
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
on(name, *args, **kwargs)
optional = {}
serialize()

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

state
target_state
type = 'lock-mechanism'
class caspia.meadow.services.lockmechanism.LockState[source]

Bases: enum.Enum

State of a lock.

SECURED = 'secured'
UNSECURED = 'unsecured'

caspia.meadow.services.metadataprovider module

class caspia.meadow.services.metadataprovider.MetadataProviderBase(name, include=())[source]

Bases: caspia.meadow.services.base.ServiceBase

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
auto_discovery = True
characteristic_cached_read(characteristic)

This method implements return value of characteristic’s value property.

characteristic_cached_write(characteristic, value)

This method implements writing to characteristic’s value property.

async characteristic_read(characteristic, **kwargs)

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)

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
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
on(name, *args, **kwargs)
optional = {}
remove
serialize()

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

type = 'metadata-provider'

caspia.meadow.services.outlet module

class caspia.meadow.services.outlet.OutletBase(name, include=())[source]

Bases: caspia.meadow.services.base.ServiceBase

Represents a power outlet.

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
auto_discovery = True
characteristic_cached_read(characteristic)

This method implements return value of characteristic’s value property.

characteristic_cached_write(characteristic, value)

This method implements writing to characteristic’s value property.

async characteristic_read(characteristic, **kwargs)

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)

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>}
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
on(name, *args, **kwargs)
optional = {}
serialize()

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

toggle
type = 'outlet'

caspia.meadow.services.presence module

class caspia.meadow.services.presence.PresenceBase(name, include=())[source]

Bases: caspia.meadow.services.base.ServiceBase

Provides information about user presence.

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
auto_discovery = True
characteristic_cached_read(characteristic)

This method implements return value of characteristic’s value property.

characteristic_cached_write(characteristic, value)

This method implements writing to characteristic’s value property.

async characteristic_read(characteristic, **kwargs)

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)

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>, 'update': <Characteristic <class 'caspia.meadow.services.base.ServiceMeta'>:update>}
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
on(name, *args, **kwargs)
optional = {}
serialize()

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

state
type = 'presence'
update
class caspia.meadow.services.presence.UserState[source]

Bases: enum.Enum

An enumeration.

AWAY = 'away'
PRESENT = 'present'
UNKNOWN = 'unknown'

caspia.meadow.services.pump module

class caspia.meadow.services.pump.PumpBase(name, include=())[source]

Bases: caspia.meadow.services.base.ServiceBase

Represents a pump (e.g. circulation pump).

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
auto_discovery = True
characteristic_cached_read(characteristic)

This method implements return value of characteristic’s value property.

characteristic_cached_write(characteristic, value)

This method implements writing to characteristic’s value property.

async characteristic_read(characteristic, **kwargs)

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)

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>}
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
on(name, *args, **kwargs)
optional = {}
serialize()

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

toggle
type = 'pump'

caspia.meadow.services.serial module

class caspia.meadow.services.serial.SerialBase(name, include=())[source]

Bases: caspia.meadow.services.base.ServiceBase

Represents a serial device.

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
auto_discovery = True
baudrate
characteristic_cached_read(characteristic)

This method implements return value of characteristic’s value property.

characteristic_cached_write(characteristic, value)

This method implements writing to characteristic’s value property.

async characteristic_read(characteristic, **kwargs)

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)

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>, 'baudrate': <Characteristic <class 'caspia.meadow.services.base.ServiceMeta'>:baudrate>, 'data_available': <Characteristic <class 'caspia.meadow.services.base.ServiceMeta'>:data_available>, 'receive': <Characteristic <class 'caspia.meadow.services.base.ServiceMeta'>:receive>, 'send': <Characteristic <class 'caspia.meadow.services.base.ServiceMeta'>:send>}
data_available
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
on(name, *args, **kwargs)
optional = {}
receive
send
serialize()

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

type = 'serial'

caspia.meadow.services.sun module

class caspia.meadow.services.sun.SunBase(name, include=())[source]

Bases: caspia.meadow.services.base.ServiceBase

Gives information about sun.

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
auto_discovery = True
azimuth
characteristic_cached_read(characteristic)

This method implements return value of characteristic’s value property.

characteristic_cached_write(characteristic, value)

This method implements writing to characteristic’s value property.

async characteristic_read(characteristic, **kwargs)

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)

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>, 'azimuth': <Characteristic <class 'caspia.meadow.services.base.ServiceMeta'>:azimuth>, 'elevation': <Characteristic <class 'caspia.meadow.services.base.ServiceMeta'>:elevation>, 'sunrise': <Characteristic <class 'caspia.meadow.services.base.ServiceMeta'>:sunrise>, 'sunset': <Characteristic <class 'caspia.meadow.services.base.ServiceMeta'>:sunset>}
elevation
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
on(name, *args, **kwargs)
optional = {}
serialize()

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

sunrise
sunset
type = 'sun'

caspia.meadow.services.switch module

class caspia.meadow.services.switch.SwitchBase(name, include=())[source]

Bases: caspia.meadow.services.base.ServiceBase

Represents a binary switch.

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
auto_discovery = True
characteristic_cached_read(characteristic)

This method implements return value of characteristic’s value property.

characteristic_cached_write(characteristic, value)

This method implements writing to characteristic’s value property.

async characteristic_read(characteristic, **kwargs)

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)

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>}
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
on(name, *args, **kwargs)
optional = {}
serialize()

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

type = 'switch'

caspia.meadow.services.thermostat module

class caspia.meadow.services.thermostat.ThermostatBase(name, include=())[source]

Bases: caspia.meadow.services.base.ServiceBase

Represents a thermsotat.

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
auto_discovery = True
characteristic_cached_read(characteristic)

This method implements return value of characteristic’s value property.

characteristic_cached_write(characteristic, value)

This method implements writing to characteristic’s value property.

async characteristic_read(characteristic, **kwargs)

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)

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>, 'current_state': <Characteristic <class 'caspia.meadow.services.base.ServiceMeta'>:current_state>, 'current_temp': <Characteristic <class 'caspia.meadow.services.base.ServiceMeta'>:current_temp>, 'target_state': <Characteristic <class 'caspia.meadow.services.base.ServiceMeta'>:target_state>, 'target_temp': <Characteristic <class 'caspia.meadow.services.base.ServiceMeta'>:target_temp>}
current_state
current_temp
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
on(name, *args, **kwargs)
optional = {}
serialize()

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

target_state
target_temp
type = 'thermostat'
class caspia.meadow.services.thermostat.ThermostatState[source]

Bases: enum.Enum

State of a thermostat.

COOLING = 'cooling'
HEATING = 'heating'
OFF = 'off'

caspia.meadow.services.weather module

class caspia.meadow.services.weather.DataPointSchema(key, description, **schema)[source]

Bases: object

class caspia.meadow.services.weather.WeatherBase(name, include=())[source]

Bases: caspia.meadow.services.base.ServiceBase

Provides information about current weather and its forecast. The characteristic’s values are dictionaries looking like:

{
    'temperature': 24.5,
    'precip_probability: 1,
    ...
}

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
auto_discovery = True
characteristic_cached_read(characteristic)

This method implements return value of characteristic’s value property.

characteristic_cached_write(characteristic, value)

This method implements writing to characteristic’s value property.

async characteristic_read(characteristic, **kwargs)

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)

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>, 'current': <Characteristic <class 'caspia.meadow.services.base.ServiceMeta'>:current>, 'today': <Characteristic <class 'caspia.meadow.services.base.ServiceMeta'>:today>, 'tomorrow': <Characteristic <class 'caspia.meadow.services.base.ServiceMeta'>:tomorrow>, 'upcoming': <Characteristic <class 'caspia.meadow.services.base.ServiceMeta'>:upcoming>, 'update': <Characteristic <class 'caspia.meadow.services.base.ServiceMeta'>:update>}
current
datapoint_schemas = {'cloud_cover': <caspia.meadow.services.weather.DataPointSchema object>, 'humidity': <caspia.meadow.services.weather.DataPointSchema object>, 'precip_accumulation': <caspia.meadow.services.weather.DataPointSchema object>, 'precip_intensity': <caspia.meadow.services.weather.DataPointSchema object>, 'precip_probability': <caspia.meadow.services.weather.DataPointSchema object>, 'precip_type': <caspia.meadow.services.weather.DataPointSchema object>, 'pressure': <caspia.meadow.services.weather.DataPointSchema object>, 'temperature': <caspia.meadow.services.weather.DataPointSchema object>, 'wind_bearing': <caspia.meadow.services.weather.DataPointSchema object>, 'wind_gust': <caspia.meadow.services.weather.DataPointSchema object>, 'wind_speed': <caspia.meadow.services.weather.DataPointSchema object>}
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
on(name, *args, **kwargs)
optional = {}
async post_report(report: caspia.meadow.services.weather.WeatherReport)[source]

Update the service with given WeatherReport. This just writes the report to the update characteristic.

serialize()

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

today
tomorrow
type = 'weather'
upcoming
update
class caspia.meadow.services.weather.WeatherReport(report_type: caspia.meadow.services.weather.WeatherReportType, time: float, data: dict, priority: int, source: str)[source]

Bases: object

class caspia.meadow.services.weather.WeatherReportType[source]

Bases: enum.Enum

An enumeration.

CURRENT = 'current'
TODAY = 'today'
TOMORROW = 'tomorrow'
UPCOMING = 'upcoming'

caspia.meadow.services.window module

class caspia.meadow.services.window.WindowBase(name, include=())[source]

Bases: caspia.meadow.services.base.ServiceBase

Represents a window.

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
auto_discovery = True
characteristic_cached_read(characteristic)

This method implements return value of characteristic’s value property.

characteristic_cached_write(characteristic, value)

This method implements writing to characteristic’s value property.

async characteristic_read(characteristic, **kwargs)

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)

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_open': <Characteristic <class 'caspia.meadow.services.base.ServiceMeta'>:is_open>}
static get_subclass(stype, mixin=None)
is_open
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
on(name, *args, **kwargs)
optional = {'is_open'}
serialize()

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

type = 'window'

Module contents

The caspia.meadow.services module contains definitions of all standard services support by Meadow. Those definitions are in a form of subclasses of base.ServiceBase.