Skip to content

Commit

Permalink
Merge pull request #225 from thegridelectric/dev
Browse files Browse the repository at this point in the history
Fix 0.6.1 - PollPeriodS propagated to PipeFlowSensorComponent
  • Loading branch information
anschweitzer committed Nov 8, 2023
2 parents c30993b + a2200d1 commit f435694
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pyproject.toml
@@ -1,6 +1,6 @@
[tool.poetry]
name = "gridworks-protocol"
version = "0.6.1"
version = "0.6.2"
description = "Gridworks Protocol"
authors = ["Jessica Millar <jmillar@gridworks-consulting.com>"]
license = "MIT"
Expand Down
Expand Up @@ -16,6 +16,7 @@ def __init__(
component_attribute_class_id: str,
conversion_factor: float,
i2c_address: int,
poll_period_s: Optional[float],
display_name: Optional[str] = None,
hw_uid: Optional[str] = None,
):
Expand All @@ -27,6 +28,7 @@ def __init__(
)
self.i2c_address = i2c_address
self.conversion_factor = conversion_factor
self.poll_period_s = poll_period_s
PipeFlowSensorComponent.by_id[self.component_id] = self
Component.by_id[self.component_id] = self

Expand Down
5 changes: 5 additions & 0 deletions src/gwproto/types/pipe_flow_sensor_component_gt.py
Expand Up @@ -190,6 +190,10 @@ def dict_to_tuple(cls, d: dict[str, Any]) -> PipeFlowSensorComponentGt:
DisplayName=d2["DisplayName"],
HwUid=d2["HwUid"],
TypeName=d2["TypeName"],
PollPeriodS=d2.get(
"PollPeriodS",
PipeFlowSensorComponentGt.__fields__["PollPeriodS"].default,
),
Version="000",
)

Expand All @@ -203,6 +207,7 @@ def tuple_to_dc(cls, t: PipeFlowSensorComponentGt) -> PipeFlowSensorComponent:
component_attribute_class_id=t.ComponentAttributeClassId,
i2c_address=t.I2cAddress,
conversion_factor=t.ConversionFactor,
poll_period_s=t.PollPeriodS,
display_name=t.DisplayName,
hw_uid=t.HwUid,
)
Expand Down

0 comments on commit f435694

Please sign in to comment.