Compare commits

...

5 Commits
v1.0.0 ... main

Author SHA1 Message Date
1708639776959.sdtroot 2091ae5894 Update requirements.txt 2024-05-22 04:08:01 +00:00
1708639776959.sdtroot 1104d4443e Update README.md 2024-05-21 06:25:16 +00:00
1708639776959.sdtroot 1e129bf0b9 Update main.py 2024-04-30 05:57:35 +00:00
1708639776959.sdtroot 7d0fb5272d Delete requirement.txt 2024-03-26 06:41:33 +00:00
sdt.root 699a6ac89c Commit message 2024-03-26 06:30:18 +00:00
4 changed files with 10 additions and 6 deletions

View File

@ -1,9 +1,9 @@
# 이 코드 템플릿은 SDT Cloud 환경에서 mqtt 메세지를 발행하는 코드입니다. # 이 코드 템플릿은 SDT Cloud 환경에서 mqtt 메세지를 발행하는 코드입니다.
# 패키지 설치 # 패키지 설치
- 코드는 sdtcloudpubsub 패키지를 사용합니다. 아래 명령어로 패키지를 다운로드 해야합니다. - 코드는 sdtcloudnodeqmqtt 패키지를 사용합니다. 아래 명령어로 패키지를 다운로드 해야합니다.
```bash ```bash
$ pip install sdtcloudpubsub $ pip install sdtcloudnodeqmqtt
``` ```
# 코드 작성 # 코드 작성

View File

@ -5,7 +5,7 @@ spec:
env: env:
bin: python3 # 앱을 실행할 바이너라 파일 종류입니다.(장비에 따라 다르므로 확인 후 정의해야 합니다.) bin: python3 # 앱을 실행할 바이너라 파일 종류입니다.(장비에 따라 다르므로 확인 후 정의해야 합니다.)
virtualEnv: base # 사용할 가상환경 이름입니다. virtualEnv: base # 사용할 가상환경 이름입니다.
package: requirement.txt # 설치할 Python 패키지 정보 파일입니다.(기본 값은 requirement.txt 입니다.) package: requirements.txt # 설치할 Python 패키지 정보 파일입니다.(기본 값은 requirement.txt 입니다.)
stackbase: stackbase:
tagName: v1.0.0 # Stackbase(gitea)에 릴리즈 태그명 입니다. tagName: v1.0.1 # Stackbase(gitea)에 릴리즈 태그명 입니다.
repoName: nodeq-mqtt-sdt-sdk-template # Stackbase(gitea)에 저장될 저장소 이릅니다. repoName: nodeq-mqtt-sdt-sdk-template # Stackbase(gitea)에 저장될 저장소 이릅니다.

View File

@ -4,7 +4,7 @@ import uuid
import random import random
sdtcloud = sdtcloudnodeqmqtt.sdtcloudnodeqmqtt() sdtcloud = sdtcloudnodeqmqtt.sdtcloudnodeqmqtt()
mqttClient = sdtcloud.setClient(f"device-app-{uuid.uuid1()}") # parameter is client ID(string) sdtcloud.setClient(f"device-app-{uuid.uuid1()}") # parameter is client ID(string)
def runAction(): def runAction():
while True: while True:
@ -13,7 +13,7 @@ def runAction():
"device_type": "gas", "device_type": "gas",
"pulse_count": random.randint(0, 1) "pulse_count": random.randint(0, 1)
}] }]
sdtcloud.pubMessage(mqttClient, msg) sdtcloud.pubMessage(msg)
time.sleep(10) time.sleep(10)
if __name__ == "__main__": if __name__ == "__main__":

View File

@ -1,4 +1,8 @@
# Write package's name that need your app. # Write package's name that need your app.
#awsiotsdk #awsiotsdk
pyyaml pyyaml
gpiod
pymodbus
pytz
AWSIoTPythonSDK
#sdtcloudpubsub #sdtcloudpubsub