Compare commits

...

14 Commits
test4 ... main

Author SHA1 Message Date
이수준 e9cc931753 ADD: Add error code test 2023-10-18 16:34:01 +09:00
이수준 50b007cb75 ADD: Add error code test 2023-10-18 16:33:15 +09:00
이수준 e0b44b8aff ADD: Add error code test 2023-10-18 16:10:38 +09:00
이수준 40365eb8e0 ADD: Add error code test 2023-10-18 16:10:00 +09:00
이수준 4cfb891eba ADD: Add error code test 2023-10-18 16:09:00 +09:00
이수준 ca8c28c252 FIX: fix test code 2023-10-17 17:42:09 +09:00
이수준 ed2394fde0 FIX: fix test code 2023-10-17 17:40:08 +09:00
이수준 5304b586aa FIX: fix test code 2023-10-16 15:50:26 +09:00
이수준 5c3c10356f FIX: fix test code 2023-10-16 15:41:52 +09:00
이수준 9ef21a24ce FIX: fix test code 2023-10-16 15:39:08 +09:00
이수준 af5d932441 FIX: fix test code 2023-10-12 09:59:45 +09:00
이수준 84f6d9341f FIX: fix test code 2023-10-12 09:53:29 +09:00
이수준 15c1d09923 FIX: fix test code 2023-10-12 09:44:38 +09:00
이수준 9936f02487 FIX: fix test code 2023-09-25 10:28:51 +09:00
6 changed files with 40 additions and 22 deletions

6
HWconfig.json Normal file
View File

@ -0,0 +1,6 @@
{
"hw": "intel",
"cpu": 12,
"memory": 32,
"gpu": "2080TI"
}

9
config.json Normal file
View File

@ -0,0 +1,9 @@
{
"topic": "performance",
"id": "sdt",
"password": "11223344",
"host": {
"address": "192.168.100.200",
"hostname": "sdt"
}
}

View File

@ -1 +0,0 @@
topic: perfermance

View File

@ -1,5 +1,7 @@
#!/bin/bash
set -e
sudo sed -i "s/appName/$1/g" /usr/local/sdt/app/$1/awx-perfermance.service
sudo cp /usr/local/sdt/app/$1/awx-perfermance.service /etc/systemd/system/$1.service
sudo systemctl start $1

43
main.py
View File

@ -10,30 +10,31 @@ parser = argparse.ArgumentParser()
parser.add_argument('-config',help='')
args = parser.parse_args()
with open(f'/usr/local/sdt/app/{args.config}/config.yaml', encoding='UTF-8') as f:
yamlData = yaml.load(f, Loader=yaml.FullLoader)
with open(f'/usr/local/sdt/app/{args.config}/config.json', encoding='UTF-8') as f:
# with open(f'./config.json', encoding='UTF-8') as f:
jsonData = json.load(f)
# mqttc = mqtt.Client() # puclisher 이름
# mqttc.username_pw_set("sdt", "251327")
# mqttc.connect("13.209.39.139", 32259)
mqttc = mqtt.Client() # puclisher 이름
mqttc.username_pw_set("sdt", "251327")
mqttc.connect("13.209.39.139", 32259)
# f = open(f'/usr/local/sdt/app/{args.config}/text.txt')
while True:
print(f"Config value: {yamlData['topic']}")
# dataList = []
# for n in range(10):
# data = {
# "timestamp": datetime.now().timestamp(),
# "data": [1 ,2 ,3 ,4 ,5 ,6 ,1, 1, 2, 3, 1 ,2 ,3 ,4 ,5 ,6 ,1, 1, 2, 3, 1 ,2 ,3 ,4 ,5 ,6 ,1, 1, 2, 3, 1 ,2 ,3 ,4 ,5 ,6 ,1, 1, 2, 3, 1 ,2 ,3 ,4 ,5 ,6 ,1, 1, 2, 3, 1 ,2 ,3 ,4 ,5 ,6 ,1, 1, 2, 3, 4, 5, 6, 1],
# }
# dataList.append(data)
# print(f"Config value: {yamlData['topic']}", flush=True)
dataList = []
for n in range(10):
data = {
"timestamp": datetime.now().timestamp(),
"data": [1 ,2 ,3 ,4 ,5 ,6 ,1, 1, 2, 3, 1 ,2 ,3 ,4 ,5 ,6 ,1, 1, 2, 3, 1 ,2 ,3 ,4 ,5 ,6 ,1, 1, 2, 3, 1 ,2 ,3 ,4 ,5 ,6 ,1, 1, 2, 3, 1 ,2 ,3 ,4 ,5 ,6 ,1, 1, 2, 3, 1 ,2 ,3 ,4 ,5 ,6 ,1, 1, 2, 3, 4, 5, 6, 1],
}
dataList.append(data)
datas = json.dumps({
"assetCode":"",
"timestamp":0,
"dataType":"",
"data": dataList
})
mqttc.publish(f"/sdt-cloud/{jsonData['topic']}", datas) # topic, message
time.sleep(2)
# datas = json.dumps({
# "assetCode":"",
# "timestamp":0,
# "dataType":"",
# "data": dataList
# })
# mqttc.publish(f"/device-test/{yamlData['topic']}", datas) # topic, message

1
text.txt Normal file
View File

@ -0,0 +1 @@
TEST!!!hi