caspia.pan.services package¶
Submodules¶
caspia.pan.services.base module¶
-
class
caspia.pan.services.base.PANService(*args, **kwargs)[source]¶ Bases:
caspia.meadow.client.gateway.ServiceGatewayMixin-
attach(connection)¶
-
property
attached¶
-
characteristic_cached_read(characteristic)¶
-
characteristic_cached_write(characteristic, value_and_meta)¶
-
async
characteristic_read(characteristic, **kwargs)¶
-
async
characteristic_write(characteristic, value, **kwargs)¶
-
property
consumer_conn¶
-
detach()¶
-
async
notify(characteristic, value, if_changed=False, extra=None)¶
-
async
published()¶
-
caspia.pan.services.lightgroup module¶
-
class
caspia.pan.services.lightgroup.LightGroup(name)[source]¶ Bases:
caspia.pan.services.base.PANService,caspia.meadow.services.light.LightBaseInitialize new service.
- Parameters
name – Name of the service (or just its path)
include – What optional characteristics to include. Tuple of their names.
-
property
all_observables¶
-
attach(connection)¶
-
property
attached¶
-
auto_discovery= True¶
-
brightness¶
-
characteristic_cached_read(characteristic)¶
-
characteristic_cached_write(characteristic, value_and_meta)¶
-
async
characteristic_read(characteristic, **kwargs)[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>}¶
-
property
consumer_conn¶
-
detach()¶
-
static
get_subclass(stype, mixin=None)¶
-
hue¶
-
is_on¶
-
property
lights¶
-
load_definition(spec)¶ Update characteristics of this instance based on serialized specs.
- Parameters
spec – Dict most likely going to be coming from meadow - from some gateway informing us about its services and their characteristics.
-
metadata¶
-
async
notify(characteristic, value, if_changed=False, extra=None)¶
-
on(name, *args, **kwargs)¶
-
optional= {'brightness', 'hue', 'saturation'}¶
-
async
published()¶
-
saturation¶
-
serialize()¶ Return serialized version (most likely dict) if possible or None.
-
toggle¶
-
type= 'light'¶
caspia.pan.services.switch module¶
-
class
caspia.pan.services.switch.Switch(name, *, loop, storage)[source]¶ Bases:
caspia.pan.services.base.PANService,caspia.meadow.services.switch.SwitchBaseInitialize new service.
- Parameters
name – Name of the service (or just its path)
include – What optional characteristics to include. Tuple of their names.
-
property
all_observables¶
-
attach(connection)¶
-
attach_consumer(connection)¶
-
property
attached¶
-
auto_discovery= True¶
-
characteristic_cached_read(characteristic)¶
-
characteristic_cached_write(characteristic, value_and_meta)¶
-
async
characteristic_read(characteristic, **kwargs)[source]¶ Read value of the characteristic.
- Parameters
characteristic – The characteristic to which the value should be written.
value – The value to be written.
kwargs – Dictionary with extra key (dictionary with metadata) and optionally a timeout (float specifing explicit timeout for the operation).
- Returns
Tuple (value, extra).
-
characteristic_subscribe(characteristic, on_value, on_error=None)¶
-
async
characteristic_write(characteristic, value, **kwargs)[source]¶ Write a value to the characteristic.
- Parameters
characteristic – The characteristic to which the value should be written.
value – The value to be written.
kwargs – Dictionary with extra key (dictionary with metadata) and optionally a timeout (float specifing explicit timeout for the operation).
-
characteristics= {'$metadata': <Characteristic <class 'caspia.meadow.services.base.ServiceMeta'>:$metadata>, 'is_on': <Characteristic <class 'caspia.meadow.services.base.ServiceMeta'>:is_on>}¶
-
property
consumer_conn¶
-
detach()¶
-
static
get_subclass(stype, mixin=None)¶
-
is_on¶
-
load_definition(spec)¶ Update characteristics of this instance based on serialized specs.
- Parameters
spec – Dict most likely going to be coming from meadow - from some gateway informing us about its services and their characteristics.
-
metadata¶
-
async
notify(characteristic, value, if_changed=False, extra=None)¶
-
on(name, *args, **kwargs)¶
-
optional= {}¶
-
async
published()¶
-
serialize()¶ Return serialized version (most likely dict) if possible or None.
-
type= 'switch'¶
-
class
caspia.pan.services.switch.TaskSwitch(name, *, loop, storage)[source]¶ Bases:
caspia.pan.services.switch.SwitchInitialize new service.
- Parameters
name – Name of the service (or just its path)
include – What optional characteristics to include. Tuple of their names.
-
property
all_observables¶
-
attach(connection)¶
-
attach_consumer(connection)¶
-
property
attached¶
-
auto_discovery= True¶
-
characteristic_cached_read(characteristic)¶
-
characteristic_cached_write(characteristic, value_and_meta)¶
-
async
characteristic_read(characteristic, **kwargs)[source]¶ Read value of the characteristic.
- Parameters
characteristic – The characteristic to which the value should be written.
value – The value to be written.
kwargs – Dictionary with extra key (dictionary with metadata) and optionally a timeout (float specifing explicit timeout for the operation).
- Returns
Tuple (value, extra).
-
characteristic_subscribe(characteristic, on_value, on_error=None)¶
-
async
characteristic_write(characteristic, value, **kwargs)[source]¶ Write a value to the characteristic.
- Parameters
characteristic – The characteristic to which the value should be written.
value – The value to be written.
kwargs – Dictionary with extra key (dictionary with metadata) and optionally a timeout (float specifing explicit timeout for the operation).
-
characteristics= {'$metadata': <Characteristic <class 'caspia.meadow.services.base.ServiceMeta'>:$metadata>, 'is_on': <Characteristic <class 'caspia.meadow.services.base.ServiceMeta'>:is_on>}¶
-
property
consumer_conn¶
-
detach()¶
-
static
get_subclass(stype, mixin=None)¶
-
is_on¶
-
load_definition(spec)¶ Update characteristics of this instance based on serialized specs.
- Parameters
spec – Dict most likely going to be coming from meadow - from some gateway informing us about its services and their characteristics.
-
metadata¶
-
async
notify(characteristic, value, if_changed=False, extra=None)¶
-
on(name, *args, **kwargs)¶
-
optional= {}¶
-
async
published()¶
-
serialize()¶ Return serialized version (most likely dict) if possible or None.
-
type= 'switch'¶