Hi,
I am planning to send my data to IBM using MQTT.
It works well but after eWON Reboot or drop connection, the data cannot be send to IBM again automatically.
The code is as below:
Init Section:
Mqtt “Open”,"d:::*",".messaging.internetofthings.ibmcloud.com"**
Mqtt “SetParam”,“Port”,"1883"
Mqtt “SetParam”,“Username”,"use-token-auth"
Mqtt “SetParam”,“Password”,"-----------"
Mqtt "Connect"
Tset 1,5
Ontimer 1,"goto MqttPublishValue"
End
Public Section:
Function GetTime$()
** $a$ = time$**
** $GetTime$ = $a$(7 To 10) + “-” + $a$(4 To 5) + “-” + $a$(1 To 2) + " " + $a$(12 To 13)+":"+$a$(15 To 16)+":"+$a$(18 To 19)**
EndFn
MqttPublishValue:
json$ = '{'
json$ = json$ + '“d”: {'
json$ = json$ + ‘“Temperature”:"’ + STR$ Temperature@ + '",'
json$ = json$ + ‘“time”: "’+@GetTime$()+’"'
json$ = json$ + '}'
json$ = json$ + '}'
status% = Mqtt "status"
** If status% = 5 Then**
** Mqtt “Publish”,“iot-2/evt/ewondata/fmt/json”,json$,0,0**
** Print “Value published”**
** Else**
** Print “Not Connected”**
** Endif**
End
How can i make it run automatically after reboot?