DataPointManager#

class wattson.datapoints.manager.DataPointManager(host: str, points: Dict, provider_conf: dict | None = None, logger: Logger | None = None)#

Bases: object

Methods

__init__

add_on_change_callback

Adds a callback for data point changes.

block_reads

find_datapoint_by_cot

find_datapoint_by_provider

get_data_point

get_data_point_dict

get_data_points

get_provider

get_value

Gets the current value of a data point by combining all involved provider values.

provider_search

Search for provider-specific configurations

set_value

start

stop

unblock_reads

Attributes

next_callback_id

__init__(host: str, points: Dict, provider_conf: dict | None = None, logger: Logger | None = None)#
add_on_change_callback(callback: Callable[[str, str | int | float | bool | None, str | None], None], ids: Set[str] | None) int#

Adds a callback for data point changes. The callback is called for each change of a data point that it matches. The callback takes the data point identifier (str), the new value (DataPointValue), and the state ID.

Parameters:
  • callback (Callable[[str, DataPointValue, Optional[str]], None]) – The Callback Callable

  • ids (Optional[Set[str]]) – An optional set of data point IDs that the callback should be limited to.

Returns:

The ID of the callback. Can be used to remove the callback.

Return type:

int

get_value(identifier: str, disable_cache: bool = False, state_id: str | None = None) str | int | float | bool | None#

Gets the current value of a data point by combining all involved provider values.

Parameters:
  • identifier (str) – The data point identifier

  • disable_cache (bool, optional) – Whether to request cache prevention for all providers (Default value = False)

  • state_id (Optional[str], optional) – An optional state id (if supported by provider) to request a potentially older or pinned value. (Default value = None)

Search for provider-specific configurations

Parameters:
  • provider_type (Optional[str]) – The provider type to search for (or None to match any type)

  • provider_data (dict) – The (partial) configuration (provider_data) to filter

Returns:

A dict of providers matching the request, keys are data point identifiers

Return type:

Dict[str,Dict]