This is what I'm doing
//
// This example logs the mc Unique IDentifier (mcUID) and the Temperature
// to MQTT.
//
Class Temperature
Shared mcUIDString As String
Shared Event Boot()
mcUIDString = Device.mcUID().ToString()
End Event
Shared Event GetTemp() RaiseEvent Every 1 Minutes
LedGreen = True
Dim TempC As Float = TempSensor.GetTemp
Dim Temppayload As ListOfByte = New ListOfByte()
Temppayload.Add(TempC.ToString)
Lplan.Publish("MCThings/" + mcUIDString + "/Temperature", Temppayload)
LedGreen = False
End Event
Shared Event GetUptime() RaiseEvent Every 1 Minutes
//LedRed = True
Dim uptime As Integer = Device.Uptime()
//Dim uptimeString As String = uptime.ToString()
Dim Uptimepayload As ListOfByte = New ListOfByte()
Uptimepayload.Add(uptime.ToString)
Lplan.Publish("MCThings/" + mcUIDString + "/Uptime", Uptimepayload)
//LedRed = False
End Event
//Shared Event CheckVoltage() RaiseEvent Every 2 Days
Shared Event CheckVoltage() RaiseEvent Every 2 Minutes
Dim BattVolt As Short = Device.BatteryVoltage
Dim Battpayload As ListOfByte = New ListOfByte()
Battpayload.Add(BattVolt.ToString)
Lplan.Publish("MCThings/" + mcUIDString + "/BatteryVoltage", Battpayload)
//If BattVolt < 2200 Then
//Lplan.IFTTT("YOURIFTTTKETHERE", "ProductionRoomBattery/YOURTOPICHERE")
//Else
//End If
End Event
End Class
I think it's the Uptimepayload.Add(uptime.ToString)
that is the problem, as the one module I have that is working keeps resetting, but does publish from time to time. (that's why uptime is always 0).
I'm currently stuck in debug mode - so as soon as I get out of that I'll revert to the two step assignment and see if that fixes the reset.