Skip to content

Commit

Permalink
Tests pass with updated actor class, telemetry name and synth channel
Browse files Browse the repository at this point in the history
  • Loading branch information
jessicamillar committed Dec 5, 2024
1 parent 4fd1e9d commit f515305
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 16 deletions.
4 changes: 2 additions & 2 deletions src/gwproto/enums/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
from gwproto.enums.unit import Unit

__all__ = [
"ActorClass", # [sh.actor.class.003](https://gridworks-type-registry.readthedocs.io/en/latest/enums.html#shactorclass)
"ActorClass", # [sh.actor.class.004](https://gridworks-type-registry.readthedocs.io/en/latest/enums.html#shactorclass)
"AdminEvent", # [admin.event.000](https://gridworks-type-registry.readthedocs.io/en/latest/enums.html#adminevent)
"AdminState", # [admin.state.000](https://gridworks-type-registry.readthedocs.io/en/latest/enums.html#adminstate)
"AlertPriority", # [alert.priority.000](https://gridworks-type-registry.readthedocs.io/en/latest/enums.html#alertpriority)
Expand Down Expand Up @@ -102,7 +102,7 @@
"RelayWiringConfig", # [relay.wiring.config.000](https://gridworks-type-registry.readthedocs.io/en/latest/enums.html#relaywiringconfig)
"StoreFlowRelay", # [store.flow.relay.000](https://gridworks-type-registry.readthedocs.io/en/latest/enums.html#storeflowrelay)
"Strategy", # [spaceheat.strategy.000](https://gridworks-type-registry.readthedocs.io/en/latest/enums.html#spaceheatstrategy)
"TelemetryName", # [spaceheat.telemetry.name.002](https://gridworks-type-registry.readthedocs.io/en/latest/enums.html#spaceheattelemetryname)
"TelemetryName", # [spaceheat.telemetry.name.003](https://gridworks-type-registry.readthedocs.io/en/latest/enums.html#spaceheattelemetryname)
"TempCalcMethod", # [temp.calc.method.000](https://gridworks-type-registry.readthedocs.io/en/latest/enums.html#tempcalcmethod)
"ThermistorDataMethod", # [thermistor.data.method.000](https://gridworks-type-registry.readthedocs.io/en/latest/enums.html#thermistordatamethod)
"Unit", # [spaceheat.unit.001](https://gridworks-type-registry.readthedocs.io/en/latest/enums.html#spaceheatunit)
Expand Down
9 changes: 6 additions & 3 deletions src/gwproto/enums/actor_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ class ActorClass(GwStrEnum):
- PicoCycler
- I2cDfrMultiplexer
- ZeroTenOutputer
- AtomicAlly: Direct report of Atn when the Scada is in Atn mode.
- SynthGenerator
- FakeAtn
For more information:
- [ASLs](https://gridworks-type-registry.readthedocs.io/en/latest/)
Expand All @@ -90,7 +93,6 @@ class ActorClass(GwStrEnum):
HubitatTankModule = auto()
HubitatPoller = auto()
I2cRelayMultiplexer = auto()
FakeAtn = auto()
FlowTotalizer = auto()
Relay = auto()
Admin = auto()
Expand All @@ -103,8 +105,9 @@ class ActorClass(GwStrEnum):
PicoCycler = auto()
I2cDfrMultiplexer = auto()
ZeroTenOutputer = auto()
SynthGenerator = auto()
AtomicAlly = auto()
SynthGenerator = auto()
FakeAtn = auto()

@classmethod
def default(cls) -> "ActorClass":
Expand All @@ -120,4 +123,4 @@ def enum_name(cls) -> str:

@classmethod
def enum_version(cls) -> str:
return "003"
return "004"
3 changes: 2 additions & 1 deletion src/gwproto/enums/telemetry_name.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class TelemetryName(GwStrEnum):
heat
- MicroVolts: Microvolts RMS
- VoltsTimesTen
- WattHours
For more information:
- [ASLs](https://gridworks-type-registry.readthedocs.io/en/latest/)
Expand Down Expand Up @@ -71,4 +72,4 @@ def enum_name(cls) -> str:

@classmethod
def enum_version(cls) -> str:
return "002"
return "003"
10 changes: 9 additions & 1 deletion src/gwproto/named_types/synth_channel_gt.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
"""Type synth.channel.gt, version 000"""

from typing import Literal

from pydantic import BaseModel, PositiveInt

from gwproto.enums import TelemetryName, ActorClass
from gwproto.enums import TelemetryName
from gwproto.property_format import (
LeftRightDotStr,
SpaceheatName,
Expand All @@ -12,6 +13,13 @@


class SynthChannelGt(BaseModel):
"""
Synthesized Channel.
A descriptor for time-series data channel synthesized from multiple sources (instead of
the raw telemetry captured by data.channel.gt
"""

Id: UUID4Str
Name: SpaceheatName
CreatedByNodeName: SpaceheatName
Expand Down
1 change: 1 addition & 0 deletions tests/config/hardware-layout.json
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,7 @@
"TelemetryName": "WaterTempCTimes1000",
"TerminalAssetAlias": "d1.isone.ct.orange.ta",
"Strategy": "simple",
"SyncReportMinutes": 60,
"DisplayName": "Required Source Water Temp",
"TypeName": "synth.channel.gt",
"Version": "000"
Expand Down
7 changes: 5 additions & 2 deletions tests/enums/actor_class_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
Tests for enum sh.actor.class.003 from the GridWorks Type Registry.
Tests for enum sh.actor.class.004 from the GridWorks Type Registry.
"""

from gwproto.enums import ActorClass
Expand Down Expand Up @@ -32,8 +32,11 @@ def test_actor_class() -> None:
"PicoCycler",
"I2cDfrMultiplexer",
"ZeroTenOutputer",
"AtomicAlly",
"SynthGenerator",
"FakeAtn",
}

assert ActorClass.default() == ActorClass.NoActor
assert ActorClass.enum_name() == "sh.actor.class"
assert ActorClass.enum_version() == "003"
assert ActorClass.enum_version() == "004"
5 changes: 3 additions & 2 deletions tests/enums/telemetry_name_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
Tests for enum spaceheat.telemetry.name.002 from the GridWorks Type Registry.
Tests for enum spaceheat.telemetry.name.003 from the GridWorks Type Registry.
"""

from gwproto.enums import TelemetryName
Expand All @@ -23,8 +23,9 @@ def test_telemetry_name() -> None:
"ThermostatState",
"MicroVolts",
"VoltsTimesTen",
"WattHours",
}

assert TelemetryName.default() == TelemetryName.Unknown
assert TelemetryName.enum_name() == "spaceheat.telemetry.name"
assert TelemetryName.enum_version() == "002"
assert TelemetryName.enum_version() == "003"
1 change: 1 addition & 0 deletions tests/named_types/test_layout_lite.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ def test_layout_lite_generated() -> None:
"TelemetryName": "WaterTempCTimes1000",
"TerminalAssetAlias": "d1.isone.ct.orange.ta",
"Strategy": "simple",
"SyncReportMinutes": 60,
"DisplayName": "Required Source Water Temp",
"TypeName": "synth.channel.gt",
"Version": "000",
Expand Down
9 changes: 4 additions & 5 deletions tests/named_types/test_synth_channel_gt.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,19 @@ def test_synth_channel_gt_generated() -> None:
d = {
"Id": "99fb8f0e-3c7c-4b62-be5a-4f7a6376519f",
"Name": "required-swt",
"CreatedByNodeName": "homealone",
"TelemetryName": "WaterTempCTimes1000",
"CreatedByNodeName": "synth-generator",
"TelemetryName": "WaterTempFTimes1000",
"TerminalAssetAlias": "d1.isone.ct.orange.ta",
"Strategy": "simple",
"DisplayName": "Required Source Water Temp",
"SyncReportMinutes": 60,
"TypeName": "synth.channel.gt",
"Version": "000",
}

t = SynthChannelGt.model_validate(d).model_dump_json(exclude_none=True)
d2 = json.loads(t)
assert d2 == d

assert d2 == d
assert d == d2

######################################
# Enum related
Expand Down

0 comments on commit f515305

Please sign in to comment.