caspia.meadow.services.meters package¶
Submodules¶
caspia.meadow.services.meters.electricity module¶
-
class
caspia.meadow.services.meters.electricity.ElectricityMeterBase(name, include=())[source]¶ Bases:
caspia.meadow.services.base.ServiceBaseRepresents 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.
-
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_consumption': <Characteristic <class 'caspia.meadow.services.base.ServiceMeta'>:current_consumption>, 'total_consumption': <Characteristic <class 'caspia.meadow.services.base.ServiceMeta'>:total_consumption>}¶
-
current_consumption¶
-
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.
-
total_consumption¶
-
type= 'electricity-meter'¶