Services¶
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.
-
class
caspia.meadow.services.BlindsBase(name, include=())[source]¶ 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.
-
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).
-
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).
-
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.
-
serialize()¶ Return serialized version (most likely dict) if possible or None.
-
class
caspia.meadow.services.BlindsControlBase(name, include=())[source]¶ 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.
-
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).
-
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).
-
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.
-
serialize()¶ Return serialized version (most likely dict) if possible or None.
-
class
caspia.meadow.services.ButtonBase(*args, **kwargs)[source]¶ 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.
-
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).
-
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).
-
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.
-
serialize()¶ Return serialized version (most likely dict) if possible or None.
-
class
caspia.meadow.services.ButtonClickEvent(button)[source]¶ -
dispose_subscription(observer)¶ Remove subscription of given observer.
-
async
observe()¶ Return current value of the observable.
-
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.ButtonHoldEvent(button, interval, cancelling)[source]¶ -
dispose_subscription(observer)¶ Remove subscription of given observer.
-
async
observe()¶ Return current value of the observable.
-
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.ButtonTriggerEvent[source]¶ 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.
-
class
caspia.meadow.services.CarbonDioxideSensorBase(name, include=())[source]¶ Represents a Carbon Dioxide (CO2) sensor.
Initialize new service.
- Parameters
name – Name of the service (or just its path)
include – What optional characteristics to include. Tuple of their names.
-
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).
-
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).
-
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.
-
serialize()¶ Return serialized version (most likely dict) if possible or None.
-
class
caspia.meadow.services.DisplayBase(name, include=())[source]¶ 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.
-
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).
-
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).
-
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.
-
serialize()¶ Return serialized version (most likely dict) if possible or None.
-
class
caspia.meadow.services.DoorBase(name, include=())[source]¶ 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.
-
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).
-
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).
-
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.
-
serialize()¶ Return serialized version (most likely dict) if possible or None.
-
class
caspia.meadow.services.ElectricityMeterBase(name, include=())[source]¶ Represents an electricity meter.
Initialize new service.
- Parameters
name – Name of the service (or just its path)
include – What optional characteristics to include. Tuple of their names.
-
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).
-
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).
-
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.
-
serialize()¶ Return serialized version (most likely dict) if possible or None.
-
class
caspia.meadow.services.FanBase(name, include=())[source]¶ 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.
-
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).
-
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).
-
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.
-
serialize()¶ Return serialized version (most likely dict) if possible or None.
-
class
caspia.meadow.services.HumiditySensorBase(name, include=())[source]¶ Represents a relative humidity sensor.
Initialize new service.
- Parameters
name – Name of the service (or just its path)
include – What optional characteristics to include. Tuple of their names.
-
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).
-
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).
-
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.
-
serialize()¶ Return serialized version (most likely dict) if possible or None.
-
class
caspia.meadow.services.IrrigationBase(name, include=())[source]¶ 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.
-
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).
-
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).
-
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.
-
serialize()¶ Return serialized version (most likely dict) if possible or None.
-
class
caspia.meadow.services.LightBase(name, include=())[source]¶ 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.
-
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).
-
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).
-
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.
-
serialize()¶ Return serialized version (most likely dict) if possible or None.
-
class
caspia.meadow.services.LightSensorBase(name, include=())[source]¶ Represents a light sensor.
Initialize new service.
- Parameters
name – Name of the service (or just its path)
include – What optional characteristics to include. Tuple of their names.
-
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).
-
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).
-
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.
-
serialize()¶ Return serialized version (most likely dict) if possible or None.
-
class
caspia.meadow.services.LockMechanismBase(name, include=())[source]¶ 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.
-
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).
-
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).
-
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.
-
serialize()¶ Return serialized version (most likely dict) if possible or None.
-
class
caspia.meadow.services.MetadataProviderBase(name, include=())[source]¶ Initialize new service.
- Parameters
name – Name of the service (or just its path)
include – What optional characteristics to include. Tuple of their names.
-
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).
-
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).
-
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.
-
serialize()¶ Return serialized version (most likely dict) if possible or None.
-
class
caspia.meadow.services.MotionSensorBase(name, include=())[source]¶ Represents a motion sensor.
Initialize new service.
- Parameters
name – Name of the service (or just its path)
include – What optional characteristics to include. Tuple of their names.
-
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).
-
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).
-
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.
-
serialize()¶ Return serialized version (most likely dict) if possible or None.
-
class
caspia.meadow.services.NoiseSensorBase(name, include=())[source]¶ Represents a noise sensor.
Initialize new service.
- Parameters
name – Name of the service (or just its path)
include – What optional characteristics to include. Tuple of their names.
-
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).
-
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).
-
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.
-
serialize()¶ Return serialized version (most likely dict) if possible or None.
-
class
caspia.meadow.services.OutletBase(name, include=())[source]¶ 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.
-
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).
-
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).
-
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.
-
serialize()¶ Return serialized version (most likely dict) if possible or None.
-
class
caspia.meadow.services.PresenceBase(name, include=())[source]¶ 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.
-
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).
-
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).
-
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.
-
serialize()¶ Return serialized version (most likely dict) if possible or None.
-
class
caspia.meadow.services.PumpBase(name, include=())[source]¶ 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.
-
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).
-
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).
-
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.
-
serialize()¶ Return serialized version (most likely dict) if possible or None.
-
class
caspia.meadow.services.SerialBase(name, include=())[source]¶ 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.
-
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).
-
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).
-
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.
-
serialize()¶ Return serialized version (most likely dict) if possible or None.
-
class
caspia.meadow.services.ServiceBase(name, include=())[source]¶ 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.
-
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).
-
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.
-
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.
-
optional= {}¶ Names of optional characteristic.
(subclasses might set this)
-
type= None¶ Type of the service
(subclasses should set this)
-
class
caspia.meadow.services.SunBase(name, include=())[source]¶ 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.
-
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).
-
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).
-
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.
-
serialize()¶ Return serialized version (most likely dict) if possible or None.
-
class
caspia.meadow.services.SwitchBase(name, include=())[source]¶ 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.
-
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).
-
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).
-
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.
-
serialize()¶ Return serialized version (most likely dict) if possible or None.
-
class
caspia.meadow.services.TemperatureSensorBase(name, include=())[source]¶ Represents a temperature sensor.
Initialize new service.
- Parameters
name – Name of the service (or just its path)
include – What optional characteristics to include. Tuple of their names.
-
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).
-
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).
-
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.
-
serialize()¶ Return serialized version (most likely dict) if possible or None.
-
class
caspia.meadow.services.ThermostatBase(name, include=())[source]¶ 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.
-
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).
-
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).
-
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.
-
serialize()¶ Return serialized version (most likely dict) if possible or None.
-
class
caspia.meadow.services.WeatherBase(name, include=())[source]¶ 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.
-
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).
-
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).
-
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.
-
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.
-
class
caspia.meadow.services.WindowBase(name, include=())[source]¶ 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.
-
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).
-
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).
-
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.
-
serialize()¶ Return serialized version (most likely dict) if possible or None.