SpaceheatNodeGt¶
Python pydantic class corresponding to json type spaceheat.node.gt, version 100.
- class gwproto.types.SpaceheatNodeGt(*, ShNodeId, Alias, ActorClass, Role, DisplayName=None, ComponentId=None, ReportingSamplePeriodS=None, RatedVoltageV=None, TypicalVoltageV=None, InPowerMetering=None, TypeName='spaceheat.node.gt', Version='100')¶
Spaceheat Node.
A SpaceheatNode, or ShNode, is an organizing principal for the SCADA software. ShNodes can represent both underlying physical objects (water tank), measurements of these objects (temperature sensing at the top of a water tank), and actors within the code (an actor measuring multiple temperatures, or an actor responsible for filtering/smoothing temperature data for the purposes of thermostatic control).
[More info](https://gridworks-protocol.readthedocs.io/en/latest/spaceheat-node.html)
- Parameters:
ShNodeId (str)
Alias (str)
ActorClass (ActorClass)
Role (Role)
DisplayName (str | None)
ComponentId (str | None)
ReportingSamplePeriodS (int | None)
RatedVoltageV (int | None)
TypicalVoltageV (int | None)
InPowerMetering (bool | None)
TypeName (Literal['spaceheat.node.gt'])
Version (Literal['100'])
- as_dict()¶
Translate the object into a dictionary representation that can be serialized into a spaceheat.node.gt.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 spaceheat.node.gt.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 spaceheat.node.gt.100 representation.
Instances in the class are python-native representations of spaceheat.node.gt.100 objects, while the actual spaceheat.node.gt.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 SpaceheatNodeGt.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
- ShNodeId:
Description:
Format: UuidCanonicalTextual
- Alias:
Description:
Format: LeftRightDot
- ActorClass:
Description:
- Role:
Description:
- DisplayName:
Description:
- ComponentId:
Description: Unique identifier for Spaceheat Node’s Component. Used if a Spaceheat Node is associated with a physical device.
Format: UuidCanonicalTextual
- ReportingSamplePeriodS:
Description:
- RatedVoltageV:
Description:
Format: PositiveInteger
- TypicalVoltageV:
Description:
Format: PositiveInteger
- InPowerMetering:
Description:
- 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.spaceheat_node_gt.check_is_uuid_canonical_textual(v)¶
Checks UuidCanonicalTextual format
UuidCanonicalTextual format: A string of hex words separated by hyphens of length 8-4-4-4-12.
- Parameters:
v (str) – the candidate
- Raises:
ValueError – if v is not UuidCanonicalTextual format
- class gwproto.types.spaceheat_node_gt.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.spaceheat_node_gt.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.SpaceheatNodeGt_Maker(sh_node_id, alias, actor_class, role, display_name, component_id, reporting_sample_period_s, rated_voltage_v, typical_voltage_v, in_power_metering)¶
- Parameters:
sh_node_id (str)
alias (str)
actor_class (ActorClass)
role (Role)
display_name (str | None)
component_id (str | None)
reporting_sample_period_s (int | None)
rated_voltage_v (int | None)
typical_voltage_v (int | None)
in_power_metering (bool | None)
- classmethod dict_to_tuple(d)¶
Deserialize a dictionary representation of a spaceheat.node.gt.100 message object into a SpaceheatNodeGt python object for internal use.
- This is the near-inverse of the SpaceheatNodeGt.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 SpaceheatNodeGt object.
- Returns:
SpaceheatNodeGt
- Return type:
- classmethod tuple_to_type(tpl)¶
Given a Python class object, returns the serialized JSON type object.
- Parameters:
tpl (SpaceheatNodeGt)
- Return type:
bytes
- classmethod type_to_tuple(t)¶
Given a serialized JSON type object, returns the Python class object.
- Parameters:
t (bytes)
- Return type: