Sub CheckTempSub
Dim CheckTemp As HttpJob
CheckTemp.Initialize("CheckTemp", Me)
CheckTemp.Download("https://thingspeak.com/channels/144263/feed/last.json")
CheckTemp.Release
End Sub
Sub JobDone (Job As HttpJob)
Log("JobName = " & Job.JobName & ", Success = " & Job.Success)
If Job.Success = True Then
Select Job.JobName
Case "Job"
'print the result to the logs
Log("OpenBot" & Job.GetString)
Case "CheckTemp"
Log("CheckTemp" & Job.GetString)
Dim parser As JSONParser
parser.Initialize(Job.GetString)
Dim root As Map = parser.NextObject
Dim field1 As String = root.Get("field1")
Dim created_at As String = root.Get("created_at")
Dim field3 As String = root.Get("field3")
Dim entry_id As Int = root.Get("entry_id")
Dim field2 As String = root.Get("field2")
Dim field4 As String = root.Get("field4")
Log(field1)
End Select
Else
Log("Error: " & Job.ErrorMessage)
ToastMessageShow("Error: " & Job.ErrorMessage, True)
End If
Job.Release
End Sub