TelemetryReportingConfig¶
Python pydantic class corresponding to json type telemetry.reporting.config, version 000.
- class gwproto.types.TelemetryReportingConfig(*, TelemetryName, AboutNodeName, ReportOnChange, SamplePeriodS, Exponent, Unit, AsyncReportThreshold=None, NameplateMaxValue=None, TypeName='telemetry.reporting.config', Version='000')¶
- Parameters:
TelemetryName (TelemetryName)
AboutNodeName (str)
ReportOnChange (bool)
SamplePeriodS (int)
Exponent (int)
Unit (Unit)
AsyncReportThreshold (float | None)
NameplateMaxValue (int | None)
TypeName (Literal['telemetry.reporting.config'])
Version (Literal['000'])
- as_dict()¶
Translate the object into a dictionary representation that can be serialized into a telemetry.reporting.config.000 object.
This method prepares the object for serialization by the as_type method, creating a dictionary with key-value pairs that follow the requirements for an instance of the telemetry.reporting.config.000 type. Unlike the standard python dict method, it makes the following substantive changes: - Enum Values: Translates between the values used locally by the actor to the symbol sent in messages. - Removes any key-value pairs where the value is None for a clearer message, especially in cases with many optional attributes.
It also applies these changes recursively to sub-types.
- Return type:
Dict[str, Any]
- as_type()¶
Serialize to the telemetry.reporting.config.000 representation.
Instances in the class are python-native representations of telemetry.reporting.config.000 objects, while the actual telemetry.reporting.config.000 object is the serialized UTF-8 byte string designed for sending in a message.
This method calls the as_dict() method, which differs from the native python dict() in the following key ways: - Enum Values: Translates between the values used locally by the actor to the symbol sent in messages. - - Removes any key-value pairs where the value is None for a clearer message, especially in cases with many optional attributes.
It also applies these changes recursively to sub-types.
Its near-inverse is TelemetryReportingConfig.type_to_tuple(). If the type (or any sub-types) includes an enum, then the type_to_tuple will map an unrecognized symbol to the default enum value. This is why these two methods are only ‘near’ inverses.
- Return type:
bytes
- classmethod check_axiom_1(v)¶
Axiom 1: Async reporting consistency. If AsyncReportThreshold exists, so does NameplateMaxValue
- Parameters:
v (dict)
- Return type:
dict
- TelemetryName:
Description:
- AboutNodeName:
Description: The name of the SpaceheatNode whose physical quantity is getting captured.
Format: LeftRightDot
- ReportOnChange:
Description:
- SamplePeriodS:
Description:
- Exponent:
Description: Exponent. Say the TelemetryName is WaterTempCTimes1000; this corresponds to units of Celsius. To match the implication in the name, the Exponent should be 3, and a Value of 65300 would indicate 65.3 deg C
- Unit:
Description:
- AsyncReportThreshold:
Description:
- NameplateMaxValue:
Description:
Format: PositiveInteger
- TypeName:
Description: All GridWorks Versioned Types have a fixed TypeName, which is a string of lowercase alphanumeric words separated by periods, most significant word (on the left) starting with an alphabet character, and final word NOT all Hindu-Arabic numerals.
- Version:
Description: All GridWorks Versioned Types have a fixed version, which is a string of three Hindu-Arabic numerals.
- class gwproto.types.telemetry_reporting_config.check_is_positive_integer(v)¶
Must be positive when interpreted as an integer. Interpretation as an integer follows the pydantic rules for this - which will round down rational numbers. So 1.7 will be interpreted as 1 and is also fine, while 0.5 is interpreted as 0 and will raise an exception.
- Parameters:
v (int) – the candidate
- Raises:
ValueError – if v < 1
- class gwproto.types.telemetry_reporting_config.check_is_left_right_dot(v)¶
Checks LeftRightDot Format
LeftRightDot format: Lowercase alphanumeric words separated by periods, with the most significant word (on the left) starting with an alphabet character.
- Parameters:
v (str) – the candidate
- Raises:
ValueError – if v is not LeftRightDot format
- class gwproto.types.TelemetryReportingConfig_Maker(telemetry_name, about_node_name, report_on_change, sample_period_s, exponent, unit, async_report_threshold, nameplate_max_value)¶
- Parameters:
telemetry_name (TelemetryName)
about_node_name (str)
report_on_change (bool)
sample_period_s (int)
exponent (int)
unit (Unit)
async_report_threshold (float | None)
nameplate_max_value (int | None)
- classmethod dict_to_tuple(d)¶
Deserialize a dictionary representation of a telemetry.reporting.config.000 message object into a TelemetryReportingConfig python object for internal use.
- This is the near-inverse of the TelemetryReportingConfig.as_dict() method:
Enums: translates between the symbols sent in messages between actors and
- the values used by the actors internally once they’ve deserialized the messages.
Types: recursively validates and deserializes sub-types.
Note that if a required attribute with a default value is missing in a dict, this method will raise a SchemaError. This differs from the pydantic BaseModel practice of auto-completing missing attributes with default values when they exist.
- Parameters:
d (dict) – the dictionary resulting from json.loads(t) for a serialized JSON type object t.
- Raises:
SchemaError – if the dict cannot be turned into a TelemetryReportingConfig object.
- Returns:
TelemetryReportingConfig
- Return type:
- classmethod tuple_to_type(tpl)¶
Given a Python class object, returns the serialized JSON type object.
- Parameters:
tpl (TelemetryReportingConfig)
- Return type:
bytes
- classmethod type_to_tuple(t)¶
Given a serialized JSON type object, returns the Python class object.
- Parameters:
t (bytes)
- Return type: