Sources & Points
Sources
Returns all sources for the project. Optionally filter by ID or bound status.
sources({ source_ids, bound_only })Options
| Option | Default | Description |
|---|---|---|
source_ids |
— | Optional array of source IDs to filter |
bound_only |
false |
If true, return only bound sources |
Returns
SourceList with proj_id and a
sources array. Each Source has:
| Field | Type | Description |
|---|---|---|
id |
string |
Source ID |
name |
string |
Source name |
type |
string |
Protocol type (e.g. bacnet, modbus) |
addr |
string |
Source address |
device_id |
number |
Device ID if applicable |
vendor |
string |
Vendor name if reported |
model |
string |
Model name if reported |
version |
string |
Version if reported |
firmware |
string |
Firmware revision if reported |
desc |
string |
Description if reported |
enabled |
boolean |
Whether the source is enabled |
bound |
boolean |
Whether the source is bound to a source map |
source_map_id |
string |
Bound source map ID; omitted if unbound |
node_id |
string |
Edge node serial number; omitted if unbound |
parent_asset_id |
string |
Parent asset ID if applicable |
target_poll_freq |
number |
Target poll frequency in seconds |
trend_interval |
number |
Trend interval in seconds |
Example
// all sources
const { sources } = await client.sources();
for (const source of sources) {
console.log(source.id, source.name, source.type);
}
// bound sources only
const bound = await client.sources({ bound_only: true });
// lookup by ID
const source = sources.find((s) => s.id === "s.2");
console.log(source.vendor, source.model);Source Maps
Returns the source maps for the project. A source map is a template of points shared by every source bound to it. Optionally filter by a list of source map IDs.
sourceMaps({ source_map_ids })Options
| Option | Default | Description |
|---|---|---|
source_map_ids |
— | Optional array of source map IDs to filter |
Returns
SourceMapList with proj_id and a
source_maps array. Each SourceMap has:
| Field | Type | Description |
|---|---|---|
id |
string |
Source map ID |
name |
string |
Source map name |
type |
string |
Protocol type (e.g. bacnet) |
vendor |
string |
Vendor name if set |
model |
string |
Model name if set |
desc |
string |
Description if set |
num_bound |
number |
Number of sources bound to this map |
points |
SourceMapPoint[] |
Points defined by the map |
Within a map, each point’s id is a local integer: point
2 in a map is s.7.2 on bound source
s.7. Each SourceMapPoint otherwise has the
same fields as a Point, including
props.
Example
const { source_maps } = await client.sourceMaps();
for (const map of source_maps) {
console.log(map.id, map.name, map.num_bound, map.points.length);
}Points
Returns points for a source, asset, or space. One of
source_id, asset_id, or space_id
is required.
points({ source_id, asset_id, space_id, point_ids, point_types })Options
| Option | Default | Description |
|---|---|---|
source_id |
— | Parent source ID (one of source_id,
asset_id, or space_id required) |
asset_id |
— | Parent asset ID (one of source_id,
asset_id, or space_id required) |
space_id |
— | Parent space ID (one of source_id,
asset_id, or space_id required) |
point_ids |
— | Optional array of point IDs to filter |
point_types |
— | Optional array of point types to filter |
Returns
PointList with the following fields. Which fields are
present depends on the parent used in the request:
| Field | Type | Description |
|---|---|---|
proj_id |
number |
Project ID |
points |
Point[] |
Points in the response |
source_id |
string |
Set when scoped by source_id |
source_name |
string |
Set when scoped by source_id |
source_bound |
boolean |
Set when scoped by source_id |
source_enabled |
boolean |
Set when scoped by source_id |
asset_id |
string |
Set when scoped by asset_id |
asset_name |
string |
Set when scoped by asset_id |
space_id |
string |
Set when scoped by space_id |
space_name |
string |
Set when scoped by space_id |
source_ids |
string[] |
Set when scoped by asset_id or
space_id |
Each Point has:
| Field | Type | Description |
|---|---|---|
id |
string |
Point ID |
name |
string |
Point name |
type |
string |
Point type |
addr |
string |
Point address |
kind |
string |
Value kind: num, bool, or
enum |
writable |
boolean |
Whether the point supports writes |
unit |
string |
Engineering unit if applicable |
enum |
string |
Enum type name if applicable |
enum_states |
EnumState[] |
Enumeration states (val, name) if
applicable |
desc |
string |
Description if set |
ontology |
Ontology |
Optional ontology classification |
props |
PointProps |
Point props set on this point, keyed by prop ID |
props contains only the props set on the point, for
example { schedule: "occupied", mode: "cooling" }, and is
empty if none are set. The API returns point props as top-level keys;
the library moves them into props, so props added to Novant
later are available without a library update. Use typedefPoints() to list every
point prop and its allowed values.
Example
// points for a source
const { points } = await client.points({ source_id: "s.2" });
for (const point of points) {
console.log(point.id, point.name, point.kind);
}
// points for a space
const res = await client.points({ space_id: "sp.1" });
console.log(res.space_name, res.source_ids);
// filter by point type
await client.points({
space_id: "sp.1",
point_types: ["discharge_air_temp_sensor", "zone_air_temp_sensor"],
});
// lookup by ID
const point = points.find((p) => p.id === "s.2.4");
console.log(point.unit);
// point props
console.log(point.props.schedule); // "occupied"