Node.js SDK는 Things Network의 Lorawan Network Server (LNS)와 완벽하게 통합하여 개발자가 IoT 장치를 쉽게 연결하고 관리 할 수 있도록합니다. 광범위한 API 지원을 통해이 패키지는 TTN의 Lorawan Ecosystem과의 애플리케이션 상호 작용을 단순화하여 장치 프로비저닝, 데이터 전송 및 장치 상태 모니터링을 가능하게합니다. 사용자 친화적 인 Node.js SDK를 활용하여 네트워크의 Lorawan 인프라 내에서 연결 및 데이터 관리를 향상시킵니다.
이 SDK는 또한 "The Things Industries"와 함께 작동하며 개인적으로 "The Things Stack 인스턴스"를 호스팅했습니다.
SDK 사용을 시작할 준비가 되셨습니까? 시작하자!
문서 : TTN---- 노드-SDK.fuota.io
Github : The-Things-network-nodejs-sdk
최종 부호 관련 방법 : endDevice
응용 프로그램 관련 방법 : 응용 프로그램
게이트웨이 관련 방법 : 게이트웨이
사용자 관련 방법 : 사용자
조직 관련 방법 : 조직
NPM에 로컬로 최신 버전을 설치하고 Package의 Package.json 파일에 저장하려면 :
NPM the-things-network-save 설치
특정 버전을 설치하려면 :
npm the-things-network@버전-save 설치
응용 프로그램을 만들고 싶다고 가정 해 봅시다. 사용자 와 조직 모두를 위해 만들 수 있습니다 ...
자세한 내용은 다음을 참조하십시오. 사용자 용 응용 프로그램 작성
import { User } from 'the-things-network';
//just an example of config
const config = {
IDENTITY_SERVER: 'eu1.cloud.thethings.network',
NETWORK_SERVER: 'nam1.cloud.thethings.network',
APPLICATION_SERVER: 'nam1.cloud.thethings.network',
JOIN_SERVER: 'nam1.cloud.thethings.network',
API_KEY: 'xxxxxapi_keyxxxxxx',
};
//just an example of payload
const payload = {
application_id: 'test',
name: 'demo',
description: 'for testing',
};
const user = User('userId', config);
const result = async () => {
try {
const resp = await user.createApplication(payload);
console.log(resp);
} catch (err) {
console.log(err);
}
}
result();
자세한 내용은 다음을 참조하십시오. 조직을위한 응용 프로그램 작성
import { Organization } from 'the-things-network';
//just an example of config
const config = {
IDENTITY_SERVER: 'eu1.cloud.thethings.network',
NETWORK_SERVER: 'nam1.cloud.thethings.network',
APPLICATION_SERVER: 'nam1.cloud.thethings.network',
JOIN_SERVER: 'nam1.cloud.thethings.network',
API_KEY: 'xxxxxapi_keyxxxxxx',
};
//just an example of payload
const payload = {
application_id: 'test',
name: 'demo',
description: 'for testing',
};
const org = new Organization('organizationId', config);
const result = async () => {
try {
const resp = await org.createApplication(payload);
console.log(resp);
} catch (err) {
console.log(err);
}
}
result();
import { Application } from 'the-things-network';
//just an example of config
const config = {
IDENTITY_SERVER: 'eu1.cloud.thethings.network',
NETWORK_SERVER: 'nam1.cloud.thethings.network',
APPLICATION_SERVER: 'nam1.cloud.thethings.network',
JOIN_SERVER: 'nam1.cloud.thethings.network',
API_KEY: 'xxxxxapi_keyxxxxxx',
};
const app = new Application('', config);
const result = async () => {
try {
const resp = await app.getApplicationList();
console.log(resp);
} catch (err) {
console.log(err);
}
}
result();
import { EndDevice } from 'the-things-network';
//just an example of config
const config = {
IDENTITY_SERVER: 'eu1.cloud.thethings.network',
NETWORK_SERVER: 'nam1.cloud.thethings.network',
APPLICATION_SERVER: 'nam1.cloud.thethings.network',
JOIN_SERVER: 'nam1.cloud.thethings.network',
API_KEY: 'xxxxxapi_keyxxxxxx',
};
//just an example of payload
const payload = {
end_device: {
ids: {
join_eui: 'DDFFDDFDFFDFDFDF',
dev_eui: '70B3D57ED005B59E',
device_id: 'eui-70b3d57ed005b59e',
application_ids: {
application_id: 'appId',
},
},
version_ids: {
brand_id: 'moko',
model_id: 'lw003',
hardware_version: '2.1',
firmware_version: '2.0',
band_id: 'AS_923',
},
network_server_address: 'nam1.cloud.thethings.network',
application_server_address: 'nam1.cloud.thethings.network',
join_server_address: 'nam1.cloud.thethings.network',
},
};
const device = new EndDevice('appId', config);
const result = async () => {
try {
const resp = await device.createEndDeviceIS(payload);
console.log(resp);
} catch (err) {
console.log(err);
}
}
result();
import { User } from 'the-things-network';
//just an example of config
const config = {
IDENTITY_SERVER: 'eu1.cloud.thethings.network',
NETWORK_SERVER: 'nam1.cloud.thethings.network',
APPLICATION_SERVER: 'nam1.cloud.thethings.network',
JOIN_SERVER: 'nam1.cloud.thethings.network',
API_KEY: 'xxxxxapi_keyxxxxxx',
};
//just an example of payload
const payload = {
gateway: {
ids: { gateway_id: 'eui-ee34634e6ada3425', eui: 'EE34634E6ADA3425' },
name: 'gateway',
description: 'testing',
gateway_server_address: 'nam1.cloud.thethings.network',
frequency_plan_id: 'US_902_928_FSB_3',
status_public: true,
location_public: true,
enforce_duty_cycle: true,
schedule_anytime_delay: '0.530s',
require_authenticated_connection: true,
},
};
const gateway = new User('userId', config);
const result = async () => {
try {
const resp = await gateway.createGateway(payload);
console.log(resp);
} catch (err) {
console.log(err);
}
}
result();
import { EndDevice } from 'the-things-network';
//just an example of config
const config = {
IDENTITY_SERVER: 'eu1.cloud.thethings.network',
NETWORK_SERVER: 'nam1.cloud.thethings.network',
APPLICATION_SERVER: 'nam1.cloud.thethings.network',
JOIN_SERVER: 'nam1.cloud.thethings.network',
API_KEY: 'xxxxxapi_keyxxxxxx',
TENANT_ID: 'xxxxxxxxxx',
};
//just an example of payload
const payload = {
device_id: 'deviceId',
down_type: '#',
host: 'nam1.cloud.thethings.industries',
port: 1883,
username: 'user@tenant',
callback_uplink_event: (data) => {
console.log('upEvent', data.toString('utf8'));
},
callback_subscribe_error: (data) => {
console.log('upEvent', data.toString('utf8'));
},
callback_subscribe_disconnect: (data) => {
console.log('upEvent', data.toString('utf8'));
}
};
const device = new EndDevice('appId', config);
const result = async () => {
try {
const resp = await device.subscribeUpLinkEvent(payload);
console.log(resp);
} catch (err) {
console.log(err);
}
}
result();
import { EndDevice } from 'the-things-network';
//just an example of config
const config = {
IDENTITY_SERVER: 'eu1.cloud.thethings.network',
NETWORK_SERVER: 'nam1.cloud.thethings.network',
APPLICATION_SERVER: 'nam1.cloud.thethings.network',
JOIN_SERVER: 'nam1.cloud.thethings.network',
API_KEY: 'xxxxxapi_keyxxxxxx',
TENANT_ID: 'xxxxxxxxxx',
};
//just an example of payload
const payload = {
device_id: 'deviceId',
down_type: '#',
host: 'nam1.cloud.thethings.industries',
port: 1883,
username: 'user@example',
callback_uplink_event: (data) => {
console.log('upEvent', data.toString('utf8'));
},
callback_subscribe_error: (data) => {
console.log('upEvent', data.toString('utf8'));
},
callback_subscribe_disconnect: (data) => {
console.log('upEvent', data.toString('utf8'));
}
};
const device = new EndDevice('appId', config);
const result = async () => {
try {
const upevent = await device.subscribeUpLinkEvent(payload);
console.log(upevent);
const resp = await device.unsubscribeEvent(upevent.client, upevent.topic);
console.log(resp);
} catch (err) {
console.log(err);
}
}
result();
특정 클래스의 인스턴스를 작성하고 필요한 매개 변수를 설정하면 해당 클래스에 속한 모든 메소드를 탐색 할 수 있습니다.
import { Application } from 'the-things-network';
//just an example of config
const config = {
IDENTITY_SERVER: 'eu1.cloud.thethings.network',
NETWORK_SERVER: 'nam1.cloud.thethings.network',
APPLICATION_SERVER: 'nam1.cloud.thethings.network',
JOIN_SERVER: 'nam1.cloud.thethings.network',
API_KEY: 'xxxxxapi_keyxxxxxx',
};
//just an example of payload
const payload = {
name: 'test',
description: 'For testing',
attributes: { 'key1': 'value1', 'key2': 'value2' },
};
const app = new Application('appId', config);
const result = async () => {
try {
const resp1 = await app.getApplicationList();
console.log(resp1);
const resp2 = await app.updateApplication(payload);
console.log(resp2);
const resp3 = await app.deleteApplication();
console.log(resp3);
const resp4 = await app.restoreApplication();
console.log(resp4);
} catch (err) {
console.log(err);
}
}
result();
우리는 The-Things-network 에 대한 기여를 환영합니다! 이 패키지에 기여하는 데 관심이 있으시면 The-Things-Network에 포함시키는 방법에는 여러 가지가 있습니다.
보고서 문제 : 버그, 오류 또는 개선 사항을 찾으면 GitHub에서 문제를 자유롭게 열어주십시오.
풀 요청 제출 : 문제를 직접 해결할 수 있거나 새 기능을 추가하려면 풀 요청을 검토하게되어 기쁩니다.
문서 개선 : 오타를 찾았 든, 명확한 문서화 또는 문서 개선에 대한 아이디어가 있든, 우리는 귀하의 의견을 듣고 싶습니다!
공유 피드백 : 패키지 경험에 대한 피드백은 대단히 감사하겠습니다. 귀하의 의견은 모든 사람을 위해이 패키지를 개선하는 데 도움이됩니다.
이 프로젝트는 기고자 행동 강령으로 공개됩니다. 이 프로젝트에 참여함으로써 귀하는 그 용어를 준수하는 데 동의합니다.
우리는 당신과 협력하기를 고대합니다!
fuota.io
이 SDK는 Team @fuota.io 에 의해 유지되고 있습니다
Fuota.io는 Things Network 및 기타 많은 인기있는 Lorawan Network Server를 사용하여 Lorawan 장치를위한 손쉬운 펌웨어 업데이트 및 포괄적 인 장치 관리를위한 올인원 플랫폼입니다.
빠르게 진화하는 연결된 장치의 환경에서 최신 펌웨어로 장치를 최신 상태로 유지하는 것은 최적의 성능, 향상된 보안 및 기능이 풍부한 기능을위한 중요한 요소입니다. 따라서 펌웨어 업데이트 배포 솔루션을위한 준비된 솔루션을 찾고 있다면 Fuota.io에서 우리와 함께 연결되어 연결된 Lorawan 장치의 잠재력을 최대한 활용하여 업데이트, 안전하며 원활하게 통합하십시오.
우리를 방문하십시오 : fuota.io
MIT