caspia.toolbox.services.weather package

Submodules

caspia.toolbox.services.weather.service module

class caspia.toolbox.services.weather.service.Weather(name, loop=None)[source]

Bases: caspia.meadow.client.gateway.ServiceGatewayMixin, caspia.meadow.services.weather.WeatherBase

Implements the Weather service.

Initialize new service.

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

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

REPORT_VALIDITY = {<WeatherReportType.CURRENT: 'current'>: 1800, <WeatherReportType.UPCOMING: 'upcoming'>: 3600, <WeatherReportType.TODAY: 'today'>: 86400, <WeatherReportType.TOMORROW: 'tomorrow'>: 86400}
property all_observables
attach(connection)
property attached
auto_discovery = True
characteristic_cached_read(characteristic)
characteristic_cached_write(characteristic, value_and_meta)
characteristic_for_report_type(report_type)[source]
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>, '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>}
detach()
static get_subclass(stype, mixin=None)
load_definition(spec)

Update characteristics of this instance based on serialized specs.

Parameters

spec – Dict most likely going to be coming from meadow - from some gateway informing us about its services and their characteristics.

metadata
async notify(characteristic, value, if_changed=False, extra=None)
on(name, *args, **kwargs)
optional = {}
async post_report(report: caspia.meadow.services.weather.WeatherReport)

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

async published()
serialize()

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

today
tomorrow
type = 'weather'
upcoming
update

Module contents