Skip to content

Commit

Permalink
Merge pull request #202 from thegridelectric/jm/tank-module-enums
Browse files Browse the repository at this point in the history
Jm/tank module enums
  • Loading branch information
anschweitzer authored Sep 22, 2023
2 parents a3cebe0 + 87bba16 commit 619e793
Show file tree
Hide file tree
Showing 10 changed files with 7,145 additions and 4,772 deletions.
2 changes: 1 addition & 1 deletion CodeGenerationTools/GridworksCore/Enum/DeriveEnums.xslt
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class </xsl:text><xsl:value-of select="$local-class-name"/>
"""
</xsl:text>

<xsl:for-each select="$airtable//EnumSymbols/EnumSymbol[(Enum = $enum-id)]">
<xsl:for-each select="$airtable//EnumSymbols/EnumSymbol[(Enum = $enum-id) and (Version &lt;= $current-version)]">
<xsl:sort select="Idx" data-type="number"/>
<xsl:if test="$enum-name-style = 'Upper'">
<xsl:value-of select="translate(translate(LocalValue,'-',''),$lcletters, $ucletters)"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
<xsl:with-param name="mp-schema-text" select="LocalName" />
</xsl:call-template>
</xsl:variable>
<xsl:variable name="current-version" select="Version" />
<FileSetFile>
<xsl:element name="RelativePath"><xsl:text>../../../../tests/enums/</xsl:text>
<xsl:value-of select="translate(LocalName,'.','_')"/><xsl:text>_test.py</xsl:text></xsl:element>
Expand All @@ -51,8 +52,8 @@ def test_</xsl:text> <xsl:value-of select="translate(LocalName,'.','_')"/>

assert set(</xsl:text><xsl:value-of select="$local-class-name"/><xsl:text>.values()) == {
</xsl:text>
<xsl:for-each select="$airtable//EnumSymbols/EnumSymbol[(Enum = $enum-id)]">
<xsl:sort select="Idx"/>
<xsl:for-each select="$airtable//EnumSymbols/EnumSymbol[(Enum = $enum-id) and (Version &lt;= $current-version)]">
<xsl:sort select="Idx" data-type="number"/>
<xsl:text>"</xsl:text>
<xsl:if test="$enum-name-style = 'Upper'">
<xsl:value-of select="translate(translate(LocalValue,'-',''),$lcletters, $ucletters)"/>
Expand Down
22 changes: 15 additions & 7 deletions CodeGenerationTools/GridworksCore/ODXML/DataSchema.odxml

Large diffs are not rendered by default.

11,802 changes: 7,069 additions & 4,733 deletions CodeGenerationTools/GridworksCore/SSoT/Airtable.xml

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions CodeGenerationTools/GridworksCore/SSoT/Entities.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@
"recsCmQ5g1sy3MKx6",
"recuhuEDQn3NKBJJf",
"rec2djRgncV4Fpy3U",
"recnMa5xJD7jb3ier"
"recnMa5xJD7jb3ier",
"recNZ1bh0Ysk48HHN"
],
"TableGroup": "General",
"ToName": "SchemaRoot"
Expand Down Expand Up @@ -275,7 +276,9 @@
"rec4UQz0uQGTOXP7v",
"recjBcWHaD0txkThT",
"recPChJ4Z0yYiZUOA",
"recCc4GQB5icU2hYH"
"recCc4GQB5icU2hYH",
"recnHjL5hWmhS57nY",
"recHpojco9I09N58x"
],
"TableGroup": "General",
"ToName": "Schema"
Expand Down
11 changes: 0 additions & 11 deletions CodeGenerationTools/GridworksCore/aicapture.json
Original file line number Diff line number Diff line change
Expand Up @@ -144,17 +144,6 @@
"RelativePath": "/Types/Docs/ApiDocs/Toc",
"CommandLine": "codee42/xml-xslt-transform -i ../../../../SSoT/Airtable.xml -i DeriveToc.xslt -i ../../../../GnfCommon.xslt -i ../../../../ODXML/DataSchema.odxml -w 120000"
},
{
"MatchedTranspiler": {
"TranspilerId": "4b713f03-1d9f-42f2-b02f-e3cdbd237bb3",
"Name": "XmlXsltTransform",
"Description": "Given an Xml and Xslt file, will process and \"split\" a resulting fileset."
},
"ProjectTranspilerId": "a2b6bc61-44d1-4bcd-b35c-fef614baf114",
"Name": "XmlXsltTransform",
"RelativePath": "/Types/ApiUtil",
"CommandLine": "codee42/xml-xslt-transform -i ../../SSoT/Airtable.xml -i DeriveApiUtil.xslt -i ../../GnfCommon.xslt -i ../../ODXML/DataSchema.odxml -w 120000"
},
{
"MatchedTranspiler": {
"TranspilerId": "4b713f03-1d9f-42f2-b02f-e3cdbd237bb3",
Expand Down
4 changes: 2 additions & 2 deletions src/gwproto/enums/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@


__all__ = [
"LocalCommInterface",
"ActorClass",
"Role",
"LocalCommInterface",
"MakeModel",
"Role",
"TelemetryName",
"Unit",
]
Expand Down
50 changes: 42 additions & 8 deletions src/gwproto/enums/make_model.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" Enum with TypeName spaceheat.make.model, Version 000, Status Active"""
""" Enum with TypeName spaceheat.make.model, Version 001, Status Pending"""
from enum import auto
from typing import List

Expand All @@ -13,17 +13,49 @@ class MakeModel(StrEnum):
Name (EnumSymbol, Version): description
* UNKNOWNMAKE__UNKNOWNMODEL (00000000, 000):
* EGAUGE__4030 (beb6d3fb, 000): A power meter in Egauge's 403x line. [More Info](https://store.egauge.net/meters).
* NCD__PR814SPST (fabfa505, 000): NCD's 4-channel high-power relay controller + 4 GPIO with I2C interface. [More Info](https://store.ncd.io/product/4-channel-high-power-relay-controller-4-gpio-with-i2c-interface/?attribute_pa_choose-a-relay=20-amp-spdt).
* ADAFRUIT__642 (acd93fb3, 000): Adafruit's high-temp, water-proof 1-wire temp sensor. [More Info](https://www.adafruit.com/product/642).
* EGAUGE__4030 (beb6d3fb, 000): A power meter in Egauge's 403x line.
[More Info](https://store.egauge.net/meters).
* NCD__PR814SPST (fabfa505, 000): NCD's 4-channel high-power relay controller + 4 GPIO
with I2C interface.
[More Info](https://store.ncd.io/product/4-channel-high-power-relay-controller-4-gpio-with-i2c-interface/?attribute_pa_choose-a-relay=20-amp-spdt).
* ADAFRUIT__642 (acd93fb3, 000): Adafruit's high-temp, water-proof 1-wire temp sensor.
[More Info](https://www.adafruit.com/product/642).
* GRIDWORKS__TSNAP1 (d0178dc3, 000): Actual GridWorks TSnap 1.0 SCADA Box
* GRIDWORKS__WATERTEMPHIGHPRECISION (f8b497e8, 000): Simulated temp sensor
* GRIDWORKS__SIMPM1 (076da322, 000): Simulated power meter
* SCHNEIDERELECTRIC__IEM3455 (d300635e, 000): Schneider Electric IEM 344 utility meter
* GRIDWORKS__SIMBOOL30AMPRELAY (e81d74a8, 000): Simulated relay
* OPENENERGY__EMONPI (c75d269f, 000): Open Energy's open source multipurpose sensing device (including internal power meter). [More Info](https://docs.openenergymonitor.org/emonpi/technical.html).
* OPENENERGY__EMONPI (c75d269f, 000): Open Energy's open source multipurpose sensing device
(including internal power meter).
[More Info](https://docs.openenergymonitor.org/emonpi/technical.html).
* GRIDWORKS__SIMTSNAP1 (3042c432, 000): Simulated SCADA Box
* ATLAS__EZFLO (d0b0e375, 000): Atlas Scientific EZO Embedded Flow Meter Totalizer, pulse to I2C. [More Info](https://drive.google.com/drive/u/0/folders/142bBV1pQIbMpyIR_0iRUr5gnzWgknOJp).
* ATLAS__EZFLO (d0b0e375, 000): Atlas Scientific EZO Embedded Flow Meter Totalizer, pulse to I2C.
[More Info](https://drive.google.com/drive/u/0/folders/142bBV1pQIbMpyIR_0iRUr5gnzWgknOJp).
* HUBITAT__C7__LAN1 (4d649420, 001): This refers to a Hubitat C7 that has been configured
in a specific way with respect to the APIs it presents on the Local Area Network. The
Hubitat C7 is a home automation hub that supports building ZigBee and ZWave meshes,
plugs into Ethernet, has a reasonable user interface and has an active community of
open-source developers who create drivers and package managers for devices, and supports
the creation of various types of APIs on the Local Area Network.
[More Info](https://drive.google.com/drive/folders/1AqAU_lC2phzuI9XRYvogiIYA7GXNtlr6).
* GRIDWORKS__TANK_MODULE_1 (bd759051, 001): This refers to a small module designed and
assembled by GridWorks that is meant to be mounted to the side of a hot water tank. It
requires 24V DC and has 4 temperature sensors coming out of it labeled 1, 2, 3 and 4.
It is meant to provide temperature readings (taken within a half a second of each other)
of all 4 of its sensors once a minute.
[More Info](https://drive.google.com/drive/folders/1GSxDd8Naf1GKK_fSOgQU933M1UcJ4r8q).
* FIBARO__ANALOG_TEMP_SENSOR (1f19839d, 001): This enum refers to a Fibaro home automation
device that has been configured in a specific way. This includes (1) being attached to two
10K NTC thermistors and a specific voltage divider circuit that specifies its temperature
as a function of voltage and (2) one of its potential free outputs being in-line with
the power of a partner Fibaro, so that it can power cycle its partner (because there are
reports of Fibaros no longer reporting temp change after weeks or months until power cylced).
The Fibaro itself is a tiny (29 X 18 X 13 mm) Z-Wave device powered on 9-30V DC that can read
up to 6 1-wire DS18B20 temp sensors, 2 0-10V analog inputs and also has 2 potential free outputs.
[More Info](https://drive.google.com/drive/u/0/folders/1Muhsvw00goppHIfGSEmreX4hM6V78b-m).
* AMPHENOL__NTC_10K_THERMISTOR_MA100GG103BN (46f21cd5, 001): A small gauge, low-cost, rapid response
NTC 10K Thermistor designed for medical applications.
[More Info](https://drive.google.com/drive/u/0/folders/11HW4ov66UvxKAwqApW6IrtoXatZBLQkd).
"""
UNKNOWNMAKE__UNKNOWNMODEL = auto()
EGAUGE__4030 = auto()
Expand All @@ -37,8 +69,10 @@ class MakeModel(StrEnum):
OPENENERGY__EMONPI = auto()
GRIDWORKS__SIMTSNAP1 = auto()
ATLAS__EZFLO = auto()
MAGNELAB__SCT0300050 = auto()
YHDC__SCT013100 = auto()
HUBITAT__C7__LAN1 = auto()
GRIDWORKS__TANK_MODULE_1 = auto()
FIBARO__ANALOG_TEMP_SENSOR = auto()
AMPHENOL__NTC_10K_THERMISTOR_MA100GG103BN = auto()

@classmethod
def default(cls) -> "MakeModel":
Expand Down
2 changes: 1 addition & 1 deletion tests/enums/actor_class_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Tests for schema enum sh.actor.class.001"""
"""Tests for schema enum sh.actor.class.000"""
from gwproto.enums import ActorClass


Expand Down
12 changes: 7 additions & 5 deletions tests/enums/make_model_test.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
"""Tests for schema enum spaceheat.make.model.000"""
"""Tests for schema enum spaceheat.make.model.001"""
from gwproto.enums import MakeModel


def test_make_model() -> None:
assert set(MakeModel.values()) == {
"UNKNOWNMAKE__UNKNOWNMODEL",
"EGAUGE__4030",
"GRIDWORKS__SIMTSNAP1",
"ATLAS__EZFLO",
"MAGNELAB__SCT0300050",
"YHDC__SCT013100",
"NCD__PR814SPST",
"ADAFRUIT__642",
"GRIDWORKS__TSNAP1",
Expand All @@ -18,6 +14,12 @@ def test_make_model() -> None:
"SCHNEIDERELECTRIC__IEM3455",
"GRIDWORKS__SIMBOOL30AMPRELAY",
"OPENENERGY__EMONPI",
"GRIDWORKS__SIMTSNAP1",
"ATLAS__EZFLO",
"HUBITAT__C7__LAN1",
"GRIDWORKS__TANK_MODULE_1",
"FIBARO__ANALOG_TEMP_SENSOR",
"AMPHENOL__NTC_10K_THERMISTOR_MA100GG103BN",
}

assert MakeModel.default() == MakeModel.UNKNOWNMAKE__UNKNOWNMODEL

0 comments on commit 619e793

Please sign in to comment.