Skip to content

Latest commit

 

History

History
1220 lines (729 loc) · 38.4 KB

API.md

File metadata and controls

1220 lines (729 loc) · 38.4 KB

cdk-iot-wireless

This package contains AWS CDK L2 constructs for IoT Wireless.

Gateway

For a Gateway being able to work properly, you need a specific IAM role.

new GatewayCertManagerIamRole(this, "GatewayIamRole");

Create an IoT Wireless Gateway:

new Gateway(this, 'gw', {
  gatewayEui: 'a123123123123123'
  description: 'my gateway'
});

IoT Wireless Devices

Destinations

To allow IoT Destinations to publish to an IoT rule there is a IAM role required. This role allows all Destinations to publish to all Rules.

const destRole = new DestinationIamRole(this, "destRole");

Dragino LHT65 decoder

The Dragino sensor transmits an encoded payload. To decode it we use a IoT topic that decodes the payload with a Lambda function and republishes it to the provided topic by using the Republish rule action. You can use the returned ruleName as a destination for Iot Wireless Devices.

const rule = new LHT65PayloadDecoderRule(this, "decoder", {
  republishTopic: "republish/${topic()}",
});

new CfnOutput(this, "ruleName", {
  value: rule.ruleName,
});
  • republishTopic The message will be republished to the provided topic. For permission reasons, do not use Substitution Templates on the first level. Otherwise permissions will not be set correctly.

Dragino LHT65 Profiles

Creates a Device Profile and a Service Profile for Dragino LHT65 sensors. All properties have a default value that fits with the current generation of sensors, but can be set individually if needed.

const lht65profiles = new LHT65Profiles(this, "profiles", {
  rfRegion: "US915",
});

Dragino LHT65 Downlink Payload Lambda

Creates a Lambda function that lets you send a Downlink Payload to the sensors. Currently it's just possible to adjust the intervall of the trasmitted sensor data and it the Lambda function sets it on all available LoRaWAN devices.

new LHT65DownlinkPayloadLambda(this, "dlpl");

The Lambda can be invoked with a event containing a JSON like this:

{
  "FPort": 2,
  "IntervalInSeconds": "900",
  "TransmitMode": 1
}

Development

How to apply changes

  • Make sure you have the latest commits locally pulled (Github actions create new commits on the server).
  • make your changes
    • If there are only commits with fix: prefix, projen bumps only the PATCH version.
    • If there is at least one commit with feat: prefix, projen bumps the MINOR version
  • run the command yarn build locally
  • commit the latest changes
  • git push your changes

API Reference

Constructs

DestinationIamRole

Grants all Wireless Destinations to forward messages to IoT rules (aka MQTT topics).

Initializers

import { DestinationIamRole } from '@cloudxs/cdk-iot-wireless'

new DestinationIamRole(scope: Construct, id: string)
Name Type Description
scope constructs.Construct No description.
id string No description.

scopeRequired
  • Type: constructs.Construct

idRequired
  • Type: string

Methods

Name Description
toString Returns a string representation of this construct.

toString
public toString(): string

Returns a string representation of this construct.

Static Functions

Name Description
isConstruct Checks if x is a construct.

isConstruct
import { DestinationIamRole } from '@cloudxs/cdk-iot-wireless'

DestinationIamRole.isConstruct(x: any)

Checks if x is a construct.

xRequired
  • Type: any

Any object.


Properties

Name Type Description
node constructs.Node The tree node.
role aws-cdk-lib.aws_iam.Role IAM Role object.

nodeRequired
public readonly node: Node;
  • Type: constructs.Node

The tree node.


roleRequired
public readonly role: Role;
  • Type: aws-cdk-lib.aws_iam.Role

IAM Role object.


Gateway

Creates an IoT Wireless Gateway.

Initializers

import { Gateway } from '@cloudxs/cdk-iot-wireless'

new Gateway(scope: Construct, id: string, props: IGatewayProps)
Name Type Description
scope constructs.Construct No description.
id string No description.
props IGatewayProps No description.

scopeRequired
  • Type: constructs.Construct

idRequired
  • Type: string

propsRequired

Methods

Name Description
toString Returns a string representation of this construct.

toString
public toString(): string

Returns a string representation of this construct.

Static Functions

Name Description
isConstruct Checks if x is a construct.

isConstruct
import { Gateway } from '@cloudxs/cdk-iot-wireless'

Gateway.isConstruct(x: any)

Checks if x is a construct.

xRequired
  • Type: any

Any object.


Properties

Name Type Description
node constructs.Node The tree node.

nodeRequired
public readonly node: Node;
  • Type: constructs.Node

The tree node.


GatewayCertManagerIamRole

Creates a role called 'IoTWirelessGatewayCertManagerRole' that is needed by the IoT Wireless gateway.

https://docs.aws.amazon.com/iot/latest/developerguide/connect-iot-lorawan-rfregion-permissions.html#connect-iot-lorawan-onboard-permissions

Initializers

import { GatewayCertManagerIamRole } from '@cloudxs/cdk-iot-wireless'

new GatewayCertManagerIamRole(scope: Construct, id: string)
Name Type Description
scope constructs.Construct No description.
id string No description.

scopeRequired
  • Type: constructs.Construct

idRequired
  • Type: string

Methods

Name Description
toString Returns a string representation of this construct.

toString
public toString(): string

Returns a string representation of this construct.

Static Functions

Name Description
isConstruct Checks if x is a construct.

isConstruct
import { GatewayCertManagerIamRole } from '@cloudxs/cdk-iot-wireless'

GatewayCertManagerIamRole.isConstruct(x: any)

Checks if x is a construct.

xRequired
  • Type: any

Any object.


Properties

Name Type Description
node constructs.Node The tree node.

nodeRequired
public readonly node: Node;
  • Type: constructs.Node

The tree node.


LHT65DownlinkPayloadLambda

Creates a Lambda function that sends a payload to all available LoRaWAN devices.

Currently it allows only adjusting the interval of the devices.

Initializers

import { LHT65DownlinkPayloadLambda } from '@cloudxs/cdk-iot-wireless'

new LHT65DownlinkPayloadLambda(scope: Construct, id: string)
Name Type Description
scope constructs.Construct No description.
id string No description.

scopeRequired
  • Type: constructs.Construct

idRequired
  • Type: string

Methods

Name Description
toString Returns a string representation of this construct.

toString
public toString(): string

Returns a string representation of this construct.

Static Functions

Name Description
isConstruct Checks if x is a construct.

isConstruct
import { LHT65DownlinkPayloadLambda } from '@cloudxs/cdk-iot-wireless'

LHT65DownlinkPayloadLambda.isConstruct(x: any)

Checks if x is a construct.

xRequired
  • Type: any

Any object.


Properties

Name Type Description
node constructs.Node The tree node.

nodeRequired
public readonly node: Node;
  • Type: constructs.Node

The tree node.


LHT65PayloadDecoderRule

Creates an IoT Wireless Rule.

It decodes the encoded Payload from Dragino Sensors and republishes it to a topic.

Initializers

import { LHT65PayloadDecoderRule } from '@cloudxs/cdk-iot-wireless'

new LHT65PayloadDecoderRule(scope: Construct, id: string, props: ILHT65PayloadDecoderRuleProps)
Name Type Description
scope constructs.Construct No description.
id string No description.
props ILHT65PayloadDecoderRuleProps No description.

scopeRequired
  • Type: constructs.Construct

idRequired
  • Type: string

propsRequired

Methods

Name Description
toString Returns a string representation of this construct.

toString
public toString(): string

Returns a string representation of this construct.

Static Functions

Name Description
isConstruct Checks if x is a construct.

isConstruct
import { LHT65PayloadDecoderRule } from '@cloudxs/cdk-iot-wireless'

LHT65PayloadDecoderRule.isConstruct(x: any)

Checks if x is a construct.

xRequired
  • Type: any

Any object.


Properties

Name Type Description
node constructs.Node The tree node.
ruleName string returns the IoT rule name, which can be used as a topic to send encoded sensor data to.

nodeRequired
public readonly node: Node;
  • Type: constructs.Node

The tree node.


ruleNameRequired
public readonly ruleName: string;
  • Type: string

returns the IoT rule name, which can be used as a topic to send encoded sensor data to.


LHT65Profiles

Creates a device and a service profile for Dragino LHT65 Temperature Sensors.

Initializers

import { LHT65Profiles } from '@cloudxs/cdk-iot-wireless'

new LHT65Profiles(scope: Construct, id: string, props?: IAWSIotProfiles)
Name Type Description
scope constructs.Construct No description.
id string No description.
props IAWSIotProfiles No description.

scopeRequired
  • Type: constructs.Construct

idRequired
  • Type: string

propsOptional

Methods

Name Description
toString Returns a string representation of this construct.

toString
public toString(): string

Returns a string representation of this construct.

Static Functions

Name Description
isConstruct Checks if x is a construct.

isConstruct
import { LHT65Profiles } from '@cloudxs/cdk-iot-wireless'

LHT65Profiles.isConstruct(x: any)

Checks if x is a construct.

xRequired
  • Type: any

Any object.


Properties

Name Type Description
node constructs.Node The tree node.
deviceProfile string Device profile ID for LHT65 sensors.
serviceProfile string Service profile ID for LHT65 sensors.

nodeRequired
public readonly node: Node;
  • Type: constructs.Node

The tree node.


deviceProfileRequired
public readonly deviceProfile: string;
  • Type: string

Device profile ID for LHT65 sensors.


serviceProfileRequired
public readonly serviceProfile: string;
  • Type: string

Service profile ID for LHT65 sensors.


MiromicoInsightPayloadDecoderRule

Creates an IoT Wireless Rule.

It decodes the encoded Payload from Dragino Sensors and republishes it to a topic.

Initializers

import { MiromicoInsightPayloadDecoderRule } from '@cloudxs/cdk-iot-wireless'

new MiromicoInsightPayloadDecoderRule(scope: Construct, id: string, props: IMiromicoInsightPayloadDecoderRuleProps)
Name Type Description
scope constructs.Construct No description.
id string No description.
props IMiromicoInsightPayloadDecoderRuleProps No description.

scopeRequired
  • Type: constructs.Construct

idRequired
  • Type: string

propsRequired

Methods

Name Description
toString Returns a string representation of this construct.

toString
public toString(): string

Returns a string representation of this construct.

Static Functions

Name Description
isConstruct Checks if x is a construct.

isConstruct
import { MiromicoInsightPayloadDecoderRule } from '@cloudxs/cdk-iot-wireless'

MiromicoInsightPayloadDecoderRule.isConstruct(x: any)

Checks if x is a construct.

xRequired
  • Type: any

Any object.


Properties

Name Type Description
node constructs.Node The tree node.
ruleName string returns the IoT rule name, which can be used as a topic to send encoded sensor data to.

nodeRequired
public readonly node: Node;
  • Type: constructs.Node

The tree node.


ruleNameRequired
public readonly ruleName: string;
  • Type: string

returns the IoT rule name, which can be used as a topic to send encoded sensor data to.


MiromicoInsightProfiles

Creates a device and a service profile for Miromico Insight Sensors.

Initializers

import { MiromicoInsightProfiles } from '@cloudxs/cdk-iot-wireless'

new MiromicoInsightProfiles(scope: Construct, id: string, props?: IAWSIotProfiles)
Name Type Description
scope constructs.Construct No description.
id string No description.
props IAWSIotProfiles No description.

scopeRequired
  • Type: constructs.Construct

idRequired
  • Type: string

propsOptional

Methods

Name Description
toString Returns a string representation of this construct.

toString
public toString(): string

Returns a string representation of this construct.

Static Functions

Name Description
isConstruct Checks if x is a construct.

isConstruct
import { MiromicoInsightProfiles } from '@cloudxs/cdk-iot-wireless'

MiromicoInsightProfiles.isConstruct(x: any)

Checks if x is a construct.

xRequired
  • Type: any

Any object.


Properties

Name Type Description
node constructs.Node The tree node.
deviceProfile string Device profile ID for MiromicoInsight.
serviceProfile string Service profile ID for MiromicoInsight.

nodeRequired
public readonly node: Node;
  • Type: constructs.Node

The tree node.


deviceProfileRequired
public readonly deviceProfile: string;
  • Type: string

Device profile ID for MiromicoInsight.


serviceProfileRequired
public readonly serviceProfile: string;
  • Type: string

Service profile ID for MiromicoInsight.


Protocols

IAWSIotProfiles

Properties for AWS Iot Profiles.

Properties

Name Type Description
dpProfileName string The name of the device profile.
macVersion string MAC version.
maxEirp number MaxEIRP.
regParamsRevision string Regional parameters version.
rfRegion string The frequency band (RFRegion) value.
spAddGWMetaData boolean Service profile - Add additional gateway metadata (RSSI, SNR, GW geoloc., etc.) to the packets sent by devices.
spProfileName string Service profile name.
supportsJoin boolean Supports Join.

dpProfileNameOptional
public readonly dpProfileName: string;
  • Type: string

The name of the device profile.


macVersionOptional
public readonly macVersion: string;
  • Type: string
  • Default: '1.0.3'

MAC version.


maxEirpOptional
public readonly maxEirp: number;
  • Type: number
  • Default: 15

MaxEIRP.


regParamsRevisionOptional
public readonly regParamsRevision: string;
  • Type: string
  • Default: 'RP002-1.0.1'

Regional parameters version.


rfRegionOptional
public readonly rfRegion: string;
  • Type: string
  • Default: 'EU868'

The frequency band (RFRegion) value.


spAddGWMetaDataOptional
public readonly spAddGWMetaData: boolean;
  • Type: boolean
  • Default: true

Service profile - Add additional gateway metadata (RSSI, SNR, GW geoloc., etc.) to the packets sent by devices.


spProfileNameOptional
public readonly spProfileName: string;
  • Type: string
  • Default: none

Service profile name.


supportsJoinOptional
public readonly supportsJoin: boolean;
  • Type: boolean
  • Default: true

Supports Join.

Choose to enter the values for Join support (OTAA) or not (ABP).


IGatewayProps

Properties for a Gateway.

Properties

Name Type Description
gatewayEui string Gateway EUI.
description string Gateway description.
rfRegion string The frequency band (RFRegion) value.

gatewayEuiRequired
public readonly gatewayEui: string;
  • Type: string

Gateway EUI.


descriptionOptional
public readonly description: string;
  • Type: string

Gateway description.


rfRegionOptional
public readonly rfRegion: string;
  • Type: string
  • Default: 'EU868'

The frequency band (RFRegion) value.


ILHT65PayloadDecoderRuleProps

Properties for a PayloadDecoderTopic.

Properties

Name Type Description
republishTopic string Republish topic.

republishTopicOptional
public readonly republishTopic: string;
  • Type: string
  • Default: 'republish/${topic()}'

Republish topic.

The encoded message will be republished to this MQTT topic. For a correct permission granting, please make sure that the first level does not contain a Substitution Template.


IMiromicoInsightPayloadDecoderRuleProps

Properties for a PayloadDecoderTopic.

Properties

Name Type Description
republishTopic string Republish topic.

republishTopicOptional
public readonly republishTopic: string;
  • Type: string
  • Default: 'republish/${topic()}'

Republish topic.

The encoded message will be republished to this MQTT topic. For a correct permission granting, please make sure that the first level does not contain a Substitution Template.