SHDR Connector Schemas#

SHDR Connector Schemas

This module provides Pydantic models to define and validate configuration schemas for SHDR devices within OpenFactory.

Key Models:#

  • SHDRDataPointSchema:

    Configuration for a single SHDR data point. Contains a tag used by OpenFactory to label incoming SHDR data and a type defining the type of the data point (Samples or Events).

  • SHDRConnectorSchema:

    Wrapper schema that encapsulates the SHDR server configuration along with all configured SHDR data points.

Validation Features:#

  • Validates port range (1-65535).

  • Restricts SHDR data point type to Samples or Events.

  • Forbids unknown fields to ensure strict schema conformance.

  • Supports immutable validated configuration models.

YAML Example:#

type: shdr

host: 192.168.1.10
port: 7878

data:
    temp:
        tag: Temperature
        type: Samples

    humi:
        tag: Humidity
        type: Events

See also

The runtime class of the SHDRConnectorSchema schema is openfactory.connectors.shdr.shdr_connector.SHDRConnector.

class openfactory.schemas.connectors.shdr.SHDRConnectorSchema(**data)[source]#

Bases: BaseModel

SHDR Connector schema wrapping the server configuration.

The type field is a discriminator for Pydantic to select this schema.

data: Dict[str, SHDRDataPointSchema]#
host: str#
model_config = {'extra': 'forbid', 'frozen': True}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

port: int#
type: Literal['shdr']#
class openfactory.schemas.connectors.shdr.SHDRDataPointSchema(**data)[source]#

Bases: BaseModel

Configuration for a single SHDR data point.

model_config = {'extra': 'forbid', 'frozen': True}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

tag: str#
type: Literal['Samples', 'Events']#