1
mc-Studio / Re: Where are the McStudio Logs
« on: December 01, 2017, 11:08:45 am »
Thanks, I'll try that the next time I have the problem. It is working for me right now.
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
// MQTT topic in MyDevices.com - v1/username/things/clientID/data/channel
Const mdTopic As String = "v1/" + mdUserId + "/things/" + mdClientId + "/data/" + mdChannel
//Const mdTopic As String = "kevin/MyDevicesCom/test"
Shared Event CheckTemp() RaiseEvent Every 3600 Seconds
Dim temp As Float = TempSensor.GetTemp() // Get Temp from sensor
Dim tempString As String = temp.ToString()
// Create temp JSON object - { "temperature" : "23.06" }
Dim tempJson As Json = New Json
//tempJson.Add("temperature", tempString)
tempJson.Add("temp,c=", "99")
// Create Wia preferred JSON object - { "data" : {"temperature" : "23.06"}}
Dim wiaPayload As Json = New Json
//wiaPayload.Add("data", tempJson)
wiaPayload.Add("temp,c=99")
Dim mdPayload As ListOfByte = New ListOfByte
Dim mdData As String = "temp,c=" + tempString
//mdData = "temp,c=99"
mdPayload.Add(mdData)
// Publish to wia MQTT
Lplan.Publish(mdTopic, mdPayload)
// MQTT topic in MyDevices.com - v1/username/things/clientID/data/channel
Const mdTopic As String = "v1/" + mdUserId + "/things/" + mdClientId + "/data/" + mdChannel
Shared Event CheckTemp() RaiseEvent Every 10 Seconds
Dim temp As Float = TempSensor.GetTemp() // Get Temp from sensor
Dim tempString As String = temp.ToString()
// Create temp JSON object - { "temperature" : "23.06" }
Dim tempJson As Json = New Json
//tempJson.Add("temperature", tempString)
tempJson.Add("temp,c=", "99")
// Create Wia preferred JSON object - { "data" : {"temperature" : "23.06"}}
Dim wiaPayload As Json = New Json
//wiaPayload.Add("data", tempJson)
wiaPayload.Add("temp,c=99")
Dim mdData As String = "temp,c=99"
// Publish to wia MQTT
Lplan.Publish(mdTopic, mdData.ToListOfByte)
Lplan.
// Blink Red LED after publish to MyDevices.com
LedRed = True
Thread.Sleep(100000)
LedRed = False
End Event