Typedef
Typedef methods list the types and props Novant defines for zones,
spaces, assets, and points. These are the values used in the
type and props fields of project records and imports.
| Method | Description |
|---|---|
typedef_zones |
List zone types |
typedef_spaces |
List space types and props |
typedef_assets |
List asset types and props |
typedef_points |
List point types and props |
Types and props are the same for every project, so these methods take
no proj_id, work with any API key, and do not count toward
a project’s monthly data
usage. Types change rarely, so fetch them once and cache them rather
than on every request.
client.typedef_zones()
client.typedef_spaces()
client.typedef_assets()
client.typedef_points()Returns
Typedef with the following attributes:
| Attribute | Type | Description |
|---|---|---|
types |
list[TypedefType] |
Valid types |
props |
list[TypedefProp] |
Props; always empty for zones |
Iterating a Typedef yields its types, and
len() returns the number of types. It also provides these
lookup methods:
| Method | Returns | Description |
|---|---|---|
type(id) |
TypedefType |
Type by ID, or None if not found |
prop(id) |
TypedefProp |
Prop by ID, or None if not found |
props_for(type_id) |
list[TypedefProp] |
Props that apply to a type, in registry order |
Each TypedefType has the following attributes:
| Attribute | Type | Description |
|---|---|---|
id |
str |
Type ID, as used in the type field of records |
name |
str |
Display name |
desc |
str |
Description |
service |
str |
Building service the type belongs to; None if none |
ontology |
Ontology |
Mappings to other ontologies, such as Brick and Haystack |
Each TypedefProp has the following attributes:
| Attribute | Type | Description |
|---|---|---|
id |
str |
Prop ID |
name |
str |
Display name |
type |
str |
Value type |
values |
list[str] |
Allowed values, when the prop has a fixed set; None
otherwise |
on |
list[str] |
Types the prop applies to: exact IDs, * for all, or a
prefix ending in * |
desc |
str |
Description |
TypedefProp.fits(type_id) returns True if
the prop applies to the given type ID.
Only valid types are listed. Deprecated types are omitted, so a
record may have a type that is not in these lists. See Typedef for details.
Example
# display names for asset types
asset_types = client.typedef_assets()
for a in client.assets():
t = asset_types.type(a.type)
print(a.name, t.name if t else a.type)
# props that apply to a point type
typedef = client.typedef_points()
for p in typedef.props_for("elec_power_sensor"):
print(p.id, p.values)