Author Topic: New module firmware 7-368 problem  (Read 94 times)

Nick_W

  • Full Member
  • ***
  • Posts: 215
    • View Profile
Re: New module firmware 7-368 problem
« on: August 31, 2016, 10:42:56 am »
This is my test script

Code: [Select]
//
// This example publishes the Uptime, Battery Voltage and Temperature once per minute
// Data also is published in the beacon data fields. This can be read via MQTT.
// Must include TempSensor and MQTT Library
//

Enum dataType As Byte
    NONE = 0
    VERSION = 1 //default beacon data for MQTT
    UPTIME = 2
    BATTVOLTAGE = 3
    TEMPERATURE = 4
    TEMPERATURE2 = 5
    HUMIDITY = 6
    DEWPOINT = 7
    PRESSURE = 8
    ALTITUDE = 9
    MOTION = 10
    DOOR = 11
    KNOCK = 12
End Enum

Class MQTT
    Shared mcUIDString As String
   
    Shared Sub Publish(topic As String, value As String)
        If mcUIDString = Nothing Then
            mcUIDString = Device.mcUID().ToString("X8")
        End If
        Dim text_string As ListOfByte = New ListOfByte()
        text_string.Add(value)
        Lplan.Publish("MCThings/" + mcUIDString + "/" + topic, text_string)
    End Sub
   
    Shared Sub Publish(topic As String, value As Object)
        Dim text As String = value.ToString()
        If mcUIDString = Nothing Then
            mcUIDString = Device.mcUID().ToString("X8")
        End If
        Dim text_string As ListOfByte = New ListOfByte()
        text_string.Add(text)
        Lplan.Publish("MCThings/" + mcUIDString + "/" + topic, text_string)
    End Sub
   
    Shared Sub Publish_exact(topic As String, text As String)
        Dim text_String As ListOfByte = New ListOfByte()
        text_String.Add(text)
        Lplan.Publish(topic, text_String)
    End Sub
   
Class Main
   
    Shared data As dataType
   
    Shared Event Publish() RaiseEvent Every 1 Minutes
        LedGreen = True
       
        Select data
            Case dataType.UPTIME
                Dim Uptime As Integer = Device.Uptime()
                MQTT.Publish("Uptime", Uptime)
                MQTT.BeaconPublish(dataType.UPTIME, Uptime)
                data = dataType.BATTVOLTAGE
            Case dataType.BATTVOLTAGE
                Dim BattVolt As Integer = Device.BatteryVoltage()
                MQTT.Publish("BatteryVoltage", BattVolt)
                MQTT.BeaconPublish(dataType.BATTVOLTAGE, BattVolt)
                data = dataType.TEMPERATURE
            Case dataType.TEMPERATURE
                Dim TempC As Float = TempSensor.GetTemp
                MQTT.Publish("Temperature", TempC)
                MQTT.BeaconPublish(dataType.TEMPERATURE, TempC)
                data = dataType.UPTIME
            Case Else
                MQTT.Publish("Status", "OnLine")
                data = dataType.UPTIME
        End Select
        LedGreen = False
    End Event 
End Class

The enum and Class MQTT are in a separate file, just joined together for ease of posting here.

With the latest FW this publishes "Online" so it gets through the main event, publishes a few values, then hangs with the green LED On. Beacons continue to publish.

This is the output:

Code: [Select]
MCThings/000111BC/Status OnLine
MCThings/000111BC/Version 7.368
MCThings/000111BC/Rssi -45
MCThings/000111BC/Version 7.368
MCThings/000111BC/Rssi -45
MCThings/000111BC/Version 7.368
MCThings/000111BC/Rssi -45
MCThings/000111BC/Uptime 60
MCThings/000111BC/Uptime 60.0
MCThings/000111BC/Rssi -45
MCThings/000111BC/Uptime 60.0
MCThings/000111BC/Rssi -45
MCThings/000111BC/BatteryVoltage 2917
MCThings/000111BC/BatteryVoltage 2917.0
MCThings/000111BC/Rssi -44
MCThings/000111BC/BatteryVoltage 2917.0
MCThings/000111BC/Rssi -45
MCThings/000111BC/BatteryVoltage 2917.0
MCThings/000111BC/Rssi -45
MCThings/000111BC/BatteryVoltage 2917.0
MCThings/000111BC/Rssi -44
MCThings/000111BC/BatteryVoltage 2917.0
MCThings/000111BC/Rssi -44
MCThings/000111BC/BatteryVoltage 2917.0
MCThings/000111BC/Rssi -44

The only published output is:
Code: [Select]
MCThings/000111BC/Status OnLine
MCThings/000111BC/Uptime 60
MCThings/000111BC/BatteryVoltage 2917

The rest are decoded beacons (values Rssi, Version and ones with .0 at the end are all decoded beacons).

With 7-366 this works fine.

The same happens with every other program I have tried.