GtShMultipurposeTelemetryStatus

Python pydantic class corresponding to json type gt.sh.multipurpose.telemetry.status, version 100.

class gwproto.types.GtShMultipurposeTelemetryStatus(*, AboutNodeAlias, SensorNodeAlias, TelemetryName, ValueList, ReadTimeUnixMsList, TypeName='gt.sh.multipurpose.telemetry.status', Version='100')

Data read from a MultipurposeSensor run by a Spaceheat SCADA.

A list of readings about a specific SpaceheatNode made by a MultipurposeSensor node, for a Spaceheat SCADA. Designed as part of a status message sent from the SCADA to its AtomicTNode typically once every 5 minutes. The nth element of each of its two lists refer to the same reading (i.e. what the value is, when it was read).

[More info](https://gridworks-protocol.readthedocs.io/en/latest/multipurpose-sensor.html)

Parameters:
  • AboutNodeAlias (str)

  • SensorNodeAlias (str)

  • TelemetryName (TelemetryName)

  • ValueList (List[int])

  • ReadTimeUnixMsList (List[int])

  • TypeName (Literal['gt.sh.multipurpose.telemetry.status'])

  • Version (Literal['100'])

as_dict()

Translate the object into a dictionary representation that can be serialized into a gt.sh.multipurpose.telemetry.status.100 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 gt.sh.multipurpose.telemetry.status.100 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 gt.sh.multipurpose.telemetry.status.100 representation.

Instances in the class are python-native representations of gt.sh.multipurpose.telemetry.status.100 objects, while the actual gt.sh.multipurpose.telemetry.status.100 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 GtShMultipurposeTelemetryStatus.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: ListLengthConsistency. ValueList and ReadTimeUnixMsList must have the same length.

Parameters:

v (dict)

Return type:

dict

AboutNodeAlias:
  • Description: AboutNodeAlias. The SpaceheatNode representing the physical object that the sensor reading is collecting data about. For example, a multipurpose temp sensor that reads 12 temperatures would have data for 12 different AboutNodeAliases, including say a.tank1.temp1 for a temp sensor at the top of a water tank.

  • Format: LeftRightDot

SensorNodeAlias:
  • Description: SensorNodeAlias. The alias of the SpaceheatNode representing the telemetry device

TelemetryName:
  • Description: TelemetryName. The TelemetryName of the readings. This is used to interpet the meaning of the reading values. For example, WaterTempCTimes1000 means the reading is measuring the a reading of 37 deg C.

ValueList:
  • Description: List of Values. The values of the readings.

ReadTimeUnixMsList:
  • Description: List of Read Times. The times that the MultipurposeSensor took the readings, in unix milliseconds

  • Format: ReasonableUnixTimeMs

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.gt_sh_multipurpose_telemetry_status.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.gt_sh_multipurpose_telemetry_status.check_is_reasonable_unix_time_ms(v)

Checks ReasonableUnixTimeMs format

ReasonableUnixTimeMs format: unix milliseconds between Jan 1 2000 and Jan 1 3000

Parameters:

v (int) – the candidate

Raises:

ValueError – if v is not ReasonableUnixTimeMs format

class gwproto.types.GtShMultipurposeTelemetryStatus_Maker(about_node_alias, sensor_node_alias, telemetry_name, value_list, read_time_unix_ms_list)
Parameters:
  • about_node_alias (str)

  • sensor_node_alias (str)

  • telemetry_name (TelemetryName)

  • value_list (List[int])

  • read_time_unix_ms_list (List[int])

classmethod dict_to_tuple(d)

Deserialize a dictionary representation of a gt.sh.multipurpose.telemetry.status.100 message object into a GtShMultipurposeTelemetryStatus python object for internal use.

This is the near-inverse of the GtShMultipurposeTelemetryStatus.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 GtShMultipurposeTelemetryStatus object.

Returns:

GtShMultipurposeTelemetryStatus

Return type:

GtShMultipurposeTelemetryStatus

classmethod tuple_to_type(tpl)

Given a Python class object, returns the serialized JSON type object.

Parameters:

tpl (GtShMultipurposeTelemetryStatus)

Return type:

bytes

classmethod type_to_tuple(t)

Given a serialized JSON type object, returns the Python class object.

Parameters:

t (bytes)

Return type:

GtShMultipurposeTelemetryStatus