Changes for page 2 Script
Last modified by Devin Chen on 2025/06/06 14:03
From version 17.1
edited by Jim(Forgotten)
on 2022/07/09 17:47
on 2022/07/09 17:47
Change comment:
There is no comment for this version
Summary
-
Page properties (2 modified, 0 added, 0 removed)
-
Attachments (0 modified, 0 added, 1 removed)
Details
- Page properties
-
- Author
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki. Jim1 +XWiki.admin - Content
-
... ... @@ -36,35 +36,34 @@ 36 36 37 37 Script is as below: 38 38 39 -(% class="box infomessage" %) 40 -((( 39 +{{code language="Lua"}} 41 41 function sms.main() 42 - ~-~-~-~-~-~-send condition~-~-~-~-~-~-41 +------send condition------ 43 43 local temp1 = addr_getword("@Temperature1") 44 44 local temp2 = addr_getword("@Temperature2") 45 45 local temp3 = addr_getword("@Temperature3") 46 46 local timer = addr_getword("@Timer") 47 47 local tag = addr_getbit("@Tag") 48 - ~-~-~-~-~-~-lasting time~-~-~-~-~-~-47 +------lasting time------ 49 49 if temp1 > 5 and temp2 > 10 and temp3 < 20 then 50 - 51 - 49 + timer = timer + 1 50 + addr_setword("@Timer",timer) 52 52 else 53 - 54 - 52 + timer = 0 53 + addr_setword("@Timer",timer) 55 55 end 56 - ~-~-~-~-~-~-send sms & output Y0~-~-~-~-~-~-55 +------send sms & output Y0------ 57 57 if timer > 5 then 58 - 59 - 60 - 61 - 57 + if tag == 0 then 58 + send_sms_ira("19859254700","alarm trigger") 59 + addr_setbit("@Tag",1) 60 + end 62 62 elseif tag == 1 then 63 63 send_sms_ira("19859254700","alarm release") 64 64 addr_setbit("@Tag",0) 65 65 end 66 66 end 67 - )))66 +{{/code}} 68 68 69 69 == **1.5 Telegram notification** == 70 70 ... ... @@ -160,141 +160,148 @@ 160 160 161 161 Demo1: 162 162 163 -(% class="box infomessage" %) 164 -((( 165 -~-~- Meta class 166 -~-~-main 162 +{{code language="Lua"}} 163 +-- Meta class 164 +--main 167 167 function mq.main() 168 - if not mq.m then 169 - local err = "" 170 -\\ mq.m, err = mqtt.create("tcp:~/~/grouprobotinfo.com:1883", "ClienID") ~-~- create connection 171 - if mq.m then 172 - mq.config = { 173 - username = "",~-~- ID 174 - password = "",~-~- password 175 - netway = 1, ~-~- Ethernet connection, WIFI=1 176 - ~-~- keepalive = 100, ~-~- Optional, set the connection heartbeat interval for 100 seconds. 177 - ~-~- cleansession = 0, ~-~- Optional, keep session 178 - } 179 - mq.m:on("message", function(topic, msg) ~-~- Register for receiving message callbacks 180 - local str = string.format("%s:%s", topic, msg) 181 - ~-~- print("mqtt msg:", str) ~-~- Print out the received topics and content 182 - end 183 - ) 184 - mq.m:on("offline", function (cause) ~-~- Register for lost connection callbacks 185 - ~-~- addr_setstring("@xxx", "cause"..(cause or " got nil")) 186 - end) 187 - mq.m:on("arrived", function() ~-~- Registration for sending messages to callbacks 188 - print("msg arrived") 189 - end) 190 - else 191 - print("mqtt create failed:", err) ~-~- Create object failed 192 - end 193 - else 194 - if mq.m:isconnected() then ~-~- If online, post a message 195 - local phaseStatus ="unknow" 196 - if addr_getbit("@Standby")== 1 then 197 - phaseStatus = "Standby" 198 - elseif addr_getbit("@Pre-Freeze")==1 then 199 - phaseStatus= "Pre-Freeze" 200 - elseif addr_getbit("@Prepare")==1 then 201 - phaseStatus ="Prepare" 202 - elseif addr_getbit("@Primary Dry")==1 then 203 - phaseStatus = "Primary dry" 204 - elseif addr_getbit("@Secondary Dry")==1 then 205 - phaseStatus = "Secondary Dry" 206 - end 207 -~-~- print(addr_getbit("@Primary Dry")) 208 -~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-- 209 - local activating ="unknow" 210 - if addr_getbit("@Compressor")==1 then 211 - activating = ",".."Compressor" 212 - end 213 - if addr_getbit("@Silicone Pump")==1 then 214 - activating = activating..",".."Silicone Pump" 215 - end 216 - if addr_getbit("@Vacuum Pump")==1 then 217 - activating = activating..",".."Vacuum Pump" 218 - end 219 - if addr_getbit("@Root Pump")==1 then 220 - activating = activating..",".."Root Pump" 221 - end 222 - if addr_getbit("@Heater")==1 then 223 - activating = activating..",".."Heater" 224 - end 225 - if addr_getbit("@Valve Silicone")==1 then 226 - activating = activating..",".."Valve Silicone" 227 - end 228 - if addr_getbit("@Valve Ice Condenser")==1 then 229 - activating = activating..",".."Valve Ice Condenser" 230 - end 231 - if addr_getbit("@Valve Vacuum Pump")==1 then 232 - activating = activating..",".."Valve Vacuum Pump" 233 - end 234 - local pr_activating =string.sub(activating,2) 235 - ~-~- print(pr_activating) 166 + if not mq.m then 167 + local err = "" 236 236 169 + mq.m, err = mqtt.create("tcp://grouprobotinfo.com:1883", "ClienID") -- create connection 170 + if mq.m then 171 + mq.config = { 172 + username = "",-- ID 173 + password = "",-- password 174 + netway = 1, -- Ethernet connection, WIFI=1 175 + -- keepalive = 100, -- Optional, set the connection heartbeat interval for 100 seconds. 176 + -- cleansession = 0, -- Optional, keep session 177 + } 178 + mq.m:on("message", function(topic, msg) -- Register for receiving message callbacks 179 + local str = string.format("%s:%s", topic, msg) 180 + -- print("mqtt msg:", str) -- Print out the received topics and content 181 + end 182 + ) 183 + mq.m:on("offline", function (cause) -- Register for lost connection callbacks 184 + -- addr_setstring("@xxx", "cause"..(cause or " got nil")) 185 + end) 186 + mq.m:on("arrived", function() -- Registration for sending messages to callbacks 187 + print("msg arrived") 188 + end) 189 + else 190 + print("mqtt create failed:", err) -- Create object failed 191 + end 192 + else 193 + if mq.m:isconnected() then -- If online, post a message 194 + local phaseStatus ="unknow" 195 + if addr_getbit("@Standby")== 1 then 196 + phaseStatus = "Standby" 197 + elseif addr_getbit("@Pre-Freeze")==1 then 198 + phaseStatus= "Pre-Freeze" 199 + elseif addr_getbit("@Prepare")==1 then 200 + phaseStatus ="Prepare" 201 + elseif addr_getbit("@Primary Dry")==1 then 202 + phaseStatus = "Primary dry" 203 + elseif addr_getbit("@Secondary Dry")==1 then 204 + phaseStatus = "Secondary Dry" 205 + end 206 +-- print(addr_getbit("@Primary Dry")) 207 +------------------------------------------------------------------------------------------------------------------------- 208 + local activating ="unknow" 209 + if addr_getbit("@Compressor")==1 then 210 + activating = ",".."Compressor" 211 + end 212 + if addr_getbit("@Silicone Pump")==1 then 213 + activating = activating..",".."Silicone Pump" 214 + end 215 + if addr_getbit("@Vacuum Pump")==1 then 216 + activating = activating..",".."Vacuum Pump" 217 + end 218 + if addr_getbit("@Root Pump")==1 then 219 + activating = activating..",".."Root Pump" 220 + end 221 + if addr_getbit("@Heater")==1 then 222 + activating = activating..",".."Heater" 223 + end 224 + if addr_getbit("@Valve Silicone")==1 then 225 + activating = activating..",".."Valve Silicone" 226 + end 227 + if addr_getbit("@Valve Ice Condenser")==1 then 228 + activating = activating..",".."Valve Ice Condenser" 229 + end 230 + if addr_getbit("@Valve Vacuum Pump")==1 then 231 + activating = activating..",".."Valve Vacuum Pump" 232 + end 233 + local pr_activating =string.sub(activating,2) 234 + -- print(pr_activating) 237 237 238 - local status_text ="unknow" 239 - if addr_getbit("@Status Run")==1 then 240 - status_text = "RUNNING" 241 - else 242 - status_text = "STOP" 243 - end 244 -~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-- 245 -\\ local js = {type="status", 246 - mc_name ="FD300", 247 - status=status_text, 248 - elapsed_time={ 249 - hour=addr_getword("@Elapsed Time (Hour)"), 250 - min=addr_getword("@Elapsed Time (Minute)"), 251 - sec=addr_getword("@Elapsed Time (Second)") 252 - }, 253 - phase = phaseStatus, 254 - step = addr_getword("@Step"), 255 - activating_output = pr_activating, 256 - sv=addr_getshort("@SV Silicone")/10, 257 - pv=addr_getshort("@PV Silicone")/10, 258 - product1=addr_getshort("@Product 1")/10, 259 -\\ product2=addr_getshort("@Product 2")/10, 260 - product3=addr_getshort("@Product 3")/10, 261 - product4=addr_getshort("@Product 4")/10, 262 - ice1=addr_getshort("@Ice condenser 1")/10, 263 - ice2=addr_getshort("@Ice condenser 2")/10, 264 - vacuum=addr_getfloat("@Vacuum") 265 -\\ } 266 - local jsAlarm = { HPC = addr_getbit("@B_25395#W0.00"), 267 - ODPC = addr_getbit("@B_25395#W0.01"), 268 - MTPC=addr_getbit("@B_25395#W0.02"), 269 - HTT = addr_getbit("@B_25395#W1.03"), 270 - CPC = addr_getbit("@B_25395#W0.08"), 271 - CPSP =addr_getbit("@B_25395#W1.00"), 272 - CPVP =addr_getbit("@B_25395#W0.10"), 273 - CPRP =addr_getbit("@B_25395#W0.11"), 274 - HP =addr_getbit("@B_25395#W1.01"), 275 - PP= addr_getbit("@B_25395#W1.02"), 276 - PO=addr_getbit("@B_25395#W0.07"), 277 - FSE=addr_getbit("@B_25395#W2.04"), 278 - AVVSVV=addr_getbit("@B_25395#W1.12"), 279 - ICHT=addr_getbit("@B_25395#W3.06") 280 -\\ } 281 -\\ ~-~- ("@B_25395#CIO1.02") 282 - mq.m:publish("mqtt-v-box-epsilon-fd300", json.encode(js) , 0, 0) 283 - mq.m:publish("mqtt-v-box-epsilon-alarm-fd300", json.encode(jsAlarm) , 0, 0) 284 - else 285 - local stat, err = mq.m:connect(mq.config) ~-~- connection 286 - if stat == nil then ~-~-Determine whether to connect 287 - print("mqtt connect failed:", err) 288 - return ~-~- Connection failed, return directly 289 - end 290 - mq.m:subscribe("mqtt-v-box-epsilon", 0)~-~- Subscribe to topics 291 -\\ end 292 - ~-~- mq.m:unsubscribe("stc/test") 293 - ~-~- mq.m:disconnect() ~-~- close matt 294 - ~-~- mq.m:close() ~-~- close clase 295 - end 236 + 237 + 238 + local status_text ="unknow" 239 + if addr_getbit("@Status Run")==1 then 240 + status_text = "RUNNING" 241 + else 242 + status_text = "STOP" 243 + end 244 +------------------------------------------------------------------------------------------------------------------------- 245 + 246 + local js = {type="status", 247 + mc_name ="FD300", 248 + status=status_text, 249 + elapsed_time={ 250 + hour=addr_getword("@Elapsed Time (Hour)"), 251 + min=addr_getword("@Elapsed Time (Minute)"), 252 + sec=addr_getword("@Elapsed Time (Second)") 253 + }, 254 + phase = phaseStatus, 255 + step = addr_getword("@Step"), 256 + activating_output = pr_activating, 257 + sv=addr_getshort("@SV Silicone")/10, 258 + pv=addr_getshort("@PV Silicone")/10, 259 + product1=addr_getshort("@Product 1")/10, 260 + 261 + product2=addr_getshort("@Product 2")/10, 262 + product3=addr_getshort("@Product 3")/10, 263 + product4=addr_getshort("@Product 4")/10, 264 + ice1=addr_getshort("@Ice condenser 1")/10, 265 + ice2=addr_getshort("@Ice condenser 2")/10, 266 + vacuum=addr_getfloat("@Vacuum") 267 + 268 + } 269 + local jsAlarm = { HPC = addr_getbit("@B_25395#W0.00"), 270 + ODPC = addr_getbit("@B_25395#W0.01"), 271 + MTPC=addr_getbit("@B_25395#W0.02"), 272 + HTT = addr_getbit("@B_25395#W1.03"), 273 + CPC = addr_getbit("@B_25395#W0.08"), 274 + CPSP =addr_getbit("@B_25395#W1.00"), 275 + CPVP =addr_getbit("@B_25395#W0.10"), 276 + CPRP =addr_getbit("@B_25395#W0.11"), 277 + HP =addr_getbit("@B_25395#W1.01"), 278 + PP= addr_getbit("@B_25395#W1.02"), 279 + PO=addr_getbit("@B_25395#W0.07"), 280 + FSE=addr_getbit("@B_25395#W2.04"), 281 + AVVSVV=addr_getbit("@B_25395#W1.12"), 282 + ICHT=addr_getbit("@B_25395#W3.06") 283 + 284 + } 285 + 286 + -- ("@B_25395#CIO1.02") 287 + mq.m:publish("mqtt-v-box-epsilon-fd300", json.encode(js) , 0, 0) 288 + mq.m:publish("mqtt-v-box-epsilon-alarm-fd300", json.encode(jsAlarm) , 0, 0) 289 + else 290 + local stat, err = mq.m:connect(mq.config) -- connection 291 + if stat == nil then --Determine whether to connect 292 + print("mqtt connect failed:", err) 293 + return -- Connection failed, return directly 294 + end 295 + mq.m:subscribe("mqtt-v-box-epsilon", 0)-- Subscribe to topics 296 + 297 + end 298 + -- mq.m:unsubscribe("stc/test") 299 + -- mq.m:disconnect() -- close matt 300 + -- mq.m:close() -- close clase 301 + end 296 296 end 297 - )))303 +{{/code}} 298 298 299 299 == **2.2 V-Box connect with Azure platform** == 300 300 ... ... @@ -306,125 +306,133 @@ 306 306 307 307 Script is as below 308 308 309 -(% class="box infomessage" %) 310 -((( 311 -~-~-https:~/~/support.huaweicloud.com/qs-IoT/iot_05_0005.html mqtt.fx monitor to connect azure iot 315 +{{code language="Lua"}} 316 +--https://support.huaweicloud.com/qs-IoT/iot_05_0005.html mqtt.fx monitor to connect azure iot 312 312 sprint = print 313 313 314 - ~-~-Get custom configuration parameters (vbox custom information)315 - ~-~-local CUSTOM = bns_get_config("bind")316 - ~-~-local DS_ID = CUSTOM.DSID or "60a71ccbbbe12002c08f3a1a_WECON"319 +--Get custom configuration parameters (vbox custom information) 320 +--local CUSTOM = bns_get_config("bind") 321 +--local DS_ID = CUSTOM.DSID or "60a71ccbbbe12002c08f3a1a_WECON" 317 317 318 318 319 -~-~-Cloud mode interface to obtain the MQTT information configured by the cloud platform: (5 returns, namely the server address, client ID, connection table, last word table, certificate table) 324 + 325 +--Cloud mode interface to obtain the MQTT information configured by the cloud platform: (5 returns, namely the server address, client ID, connection table, last word table, certificate table) 320 320 local MQTT_URL, MQTT_CLIENTID, MQTT_CFG, MQTT_LWT, MQTT_CART = mqtt.setup_cfg() 321 321 322 - ~-~-MQTT_CFG.username = '60a71ccbbbe12002c08f3a1a_WECON'323 - ~-~-MQTT_CFG.password='wecon123'324 - ~-~-MQTT_CLIENTID = '60a71ccbbbe12002c08f3a1a_WECON_0_0_2021052110usernxame:60a71ccbbbe12002c08f3a1a_WECONpassword:a0a951581855aa8e0262129da6cf1b43f2c0ecfac4fa56117fc5a20c90be169a'328 +--MQTT_CFG.username = '60a71ccbbbe12002c08f3a1a_WECON' 329 +--MQTT_CFG.password='wecon123' 330 +--MQTT_CLIENTID = '60a71ccbbbe12002c08f3a1a_WECON_0_0_2021052110usernxame:60a71ccbbbe12002c08f3a1a_WECONpassword:a0a951581855aa8e0262129da6cf1b43f2c0ecfac4fa56117fc5a20c90be169a' 325 325 326 - ~-~-publish to topics332 +--publish to topics 327 327 local pub_RE_TOPIC = string.format('devices/wecon_02/messages/events/') 328 - ~-~-Subscribe topics334 +--Subscribe topics 329 329 local Subscribe_RE_TOPIC1 = string.format('devices/wecon_02/messages/devicebound/#') 330 330 331 - ~-~-variable337 +--variable 332 332 local last_time = 0 333 333 334 334 335 -~-~-Timing main function 341 + 342 +--Timing main function 336 336 function Azure.main() 337 337 338 - 339 - 340 - 341 - 342 - 343 - 344 - 345 - 346 - 347 - 348 - 349 - 350 - 351 - 345 + sprint(os.date("%Y-%m-%d %H:%M %S", os.time()) .. " Azureiot.main start") 346 + if g_mq then 347 + if g_mq:isconnected() then 348 + send_Data() 349 + else 350 + if os.time() - last_time > 20 then 351 + last_time = os.time() 352 + mymqtt_connect() 353 + end 354 + end 355 + else 356 + mymqtt_init() 357 + end 358 + sprint(os.date("%Y-%m-%d %H:%M %S", os.time()) .. " Azureiot.main end") 352 352 end 353 353 354 - ~-~- Initialize MQTT361 +-- Initialize MQTT 355 355 function mymqtt_init() 356 - 357 - ~-~- Create the object and declare it as a global variable358 - 359 - ~-~- Register to receive message callbacks360 - 361 - 362 - 363 - 363 + sprint(string.format("mqtt init mqtt_url:%s mqtt_clientid:%s", MQTT_URL, MQTT_CLIENTID)) 364 + g_mq, err = mqtt.create(MQTT_URL, MQTT_CLIENTID) -- Create the object and declare it as a global variable 365 + if g_mq then 366 + g_mq:on("message", mymqtt_msg_callback) -- Register to receive message callbacks 367 + sprint("mqtt init success") 368 + else 369 + sprint("mqtt init failed:", err) 370 + end 364 364 end 365 365 366 - ~-~- Connect to MQTT server373 +-- Connect to MQTT server 367 367 function mymqtt_connect() 368 - 369 - 370 - 371 - 372 - 373 - 374 - 375 - 376 - 375 + sprint("mqtt connecting...") 376 + local stat, err = g_mq:connect(MQTT_CFG,MQTT_LWT, MQTT_CART) 377 + if stat == nil then 378 + sprint("mqtt connect failed:", err) 379 + return 380 + else 381 + sprint("mqtt connected") 382 + end 383 + g_mq:subscribe(Subscribe_RE_TOPIC1, 0) 377 377 end 378 378 379 - ~-~- Receive MQTT message callback function386 +-- Receive MQTT message callback function 380 380 function mymqtt_msg_callback(topic, msg) 381 - 382 - 383 - ~-~- local revData = json.decode(msg)384 - ~-~-~-~-Process topic information subscribed from the cloud385 - ~-~- if string.match(topic,Subscribe_RE_TOPIC1) then386 - ~-~-387 - 388 - ~-~- end388 + print("topic:",topic) 389 + print("revdata:",msg) 390 + -- local revData = json.decode(msg) 391 + -- if topic == Subscribe_RE_TOPIC1 then --Process topic information subscribed from the cloud 392 +-- if string.match(topic,Subscribe_RE_TOPIC1) then 393 + -- print("topi11:",topic) 394 + setValue(revData) 395 + -- end 389 389 end 390 390 391 - ~-~-Process the received data392 - ~-~-function setValue(revData)393 - ~-~- if revData ~~=nil then394 - ~-~-395 - ~-~-396 - ~-~-397 - ~-~- end398 - ~-~-end398 +--Process the received data 399 +--function setValue(revData) 400 + -- if revData ~=nil then 401 + -- for i,v in pairs(revData) do 402 + -- print("Data received:",i,v) 403 + -- end 404 + -- end 405 +--end 399 399 400 - ~-~-Get real-time data407 +--Get real-time data 401 401 function getData() 402 - 403 - 404 - 405 - 406 - 407 - 408 - 409 - 410 - 411 -end 409 + local jdata = {} 410 + local addr = bns_get_alldata() 411 + print(json.encode(addr)) 412 + for i,v in pairs(addr) do 413 + if v[2] == 1 then 414 + jdata[v[3]] = v[4] 415 + end 416 + end 417 + return jdata 418 +end 412 412 413 413 414 -~-~-send data 421 + 422 +--send data 415 415 function send_Data() 416 - local pub_data = {100 417 - ~-~- services=~{~{ 418 -\\ ~-~-serviceId ='Temperature', 419 - ~-~- properties={ 420 - ~-~- value = 55 421 - ~-~- }, 422 - ~-~- }} 424 + local pub_data = {100 425 + -- services={{ 426 + 427 + --serviceId ='Temperature', 428 + -- properties={ 429 + -- value = 55 430 + -- }, 431 + -- }} 423 423 } 424 424 sprint(json.encode(pub_data)) 425 425 print("..........",pub_RE_TOPIC) 426 - 435 + return g_mq:publish(pub_RE_TOPIC, json.encode(pub_data), 0, 0) 427 427 end 437 +{{/code}} 438 + 439 +(% class="box infomessage" %) 440 +((( 441 + 428 428 ))) 429 429 430 430 == **2.3 How to configure the Huawei platform?(✎Note: Huawei IOT DA function is only in China area.If you want this function,you need to use chinese mobile to register)** == ... ... @@ -754,67 +754,109 @@ 754 754 } 755 755 {{/code}} 756 756 757 - ===**Create things**===771 +1. **Create things** 758 758 759 759 Click “Manage”~-~-->“Things”~-~-->“Create things”~-~-->“Create single thing” 760 760 761 -[[image:image-20220709165402-6.png]] 762 762 763 -[[image:image-20220709165402-7.png]] 776 +| 777 +| |[[image:image-20220709165402-6.png]] 764 764 779 +| 780 +| |[[image:image-20220709165402-7.png]] 781 + 782 +| 783 +| |[[image:image-20220709165402-8.png]] 784 + 765 765 Name the thing~-~-->Click “Next” 766 766 767 -[[image:image-20220709165402-8.png]] 768 768 769 769 Select the way to create certificate 770 770 771 -[[image:image-20220709165402-9.png]] 772 772 791 +| 792 +| |[[image:image-20220709165402-9.png]] 793 + 773 773 Select policy 774 774 775 -[[image:image-20220709165402-10.png]] 776 776 777 -[[image:image-20220709165402-11.png]] 797 +| 798 +| |[[image:image-20220709165402-10.png]] 778 778 779 779 780 -=== **Test with MQTT.fx tool** === 781 781 802 + 803 + 804 + 805 + 806 + 807 +| 808 +| |[[image:image-20220709165402-11.png]] 809 + 810 + 811 + 812 + 813 + 814 +1. **Test with MQTT.fx tool** 815 + 782 782 Click “View Setting” to get the “Broker Adress” 783 783 784 -[[image:image-20220709165402-13.png]] 785 785 786 -[[image:image-20220709165402-12.png]] 819 +| 820 +| |[[image:image-20220709165402-12.png]] 787 787 788 -Create one connection in MQTT.fx tool, set broker port as 8883. 822 +| 823 +| |[[image:image-20220709165402-13.png]] 789 789 790 -[[image:image-20220709165402-14.png]] 791 791 826 + 827 + 828 + 829 + 830 + 831 +| 832 +| |[[image:image-20220709165402-14.png]] 833 + 834 +Create one connection in MQTT.fx tool, set broker port as 8883. 835 + 792 792 Upload the CA File, Client Certificate File, Client Key File 793 793 794 -[[image:image-20220709165402-15.png]] 795 795 839 +| 840 +| |[[image:image-20220709165402-15.png]] 841 + 796 796 Publish message to topic “TEST” 797 797 798 -[[image:image-20220709165402-17.png]] 799 799 800 -Click”Test”~-~-->”MQTT test client”~-~-->”Subscrible to a topic”, to get message publish from MQTT.fx tool. 845 +| 846 +| |[[image:image-20220709165402-16.png]] 801 801 802 -[[image:image-20220709173500-1.png]] 848 +| 849 +| |[[image:image-20220709165402-17.png]] 803 803 851 +Click”Test”~-~-->”MQTT test client”~-~-->”Subscrible to a topic”, to get message publish from MQTT.fx tool. 852 + 804 804 And we can also send message form AWS platform to MQTT.fx tool. 805 805 806 -[[image:image-20220709165402-18.png]] 807 807 808 -=== **Configurate in CloudTool** === 856 +| 857 +| |[[image:image-20220709165402-18.png]] 809 809 859 +1. **Configurate in CloudTool** 860 + 810 810 Copy the same setting in MQTT.fx to MQTT configuration 811 811 812 -[[image:image-20220709165402-19.png]] 813 813 864 +| 865 +| |[[image:image-20220709165402-19.png]] 866 + 814 814 Add a lua script and copy the lua demo into it. 815 815 816 -[[image:image-20220709165402-20.png]] 817 817 870 +| 871 +| |[[image:image-20220709165402-20.png]] 872 + 873 + 818 818 sprint = print 819 819 820 820 ~-~-Cloud mode interface to obtain the MQTT information configured by the cloud platform: (5 returns, namely the server address, client ID, connection table, last word table, certificate table) ... ... @@ -995,6 +995,10 @@ 995 995 996 996 end 997 997 1054 + 1055 + 998 998 Get message in AWS 999 999 1000 -[[image:image-20220709165402-21.png]] 1058 + 1059 +| 1060 +| |[[image:image-20220709165402-21.png]]
- image-20220709173500-1.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.Jim - Size
-
... ... @@ -1,1 +1,0 @@ 1 -1.5 MB - Content