mc-Things

General Category => mc-Things General Discussion => Topic started by: ayush on October 21, 2016, 03:53:49 am

Title: How to route Lplan data to my own server
Post by: ayush on October 21, 2016, 03:53:49 am
I Have a dummy script

Quote
Class SubscriptionDemo
    Shared Event Boot()
        Lplan.Subscribe("TemperatureAbove90")
        Lplan.Subscribe("TemperatureBelow90")
    End Event
    Shared Event SubscriptionDelivery()
        LedRed = Not LedRed       
    End Event
End Class


Class Temperature
    Shared Event GetTemp() RaiseEvent Every 2 Seconds
        LedGreen = True       
        Dim TempC As Float = TempSensor.GetTemp
        Dim TempF As Float = TempSensor.ToFarenheit(TempC)
        Dim TempList As ListOfByte = New ListOfByte()
        TempList.AddFloat(TempF)
        If (TempF > 90.0) Then
            Lplan.Publish("TemperatureAbove90", TempList)
        Else
            Lplan.Publish("TemperatureBelow90", TempList)
        End If
    End Event
End Class
 

I want to route the Data published on the channels to my own server, including both Topic and Payload, how can I do it?

On the same note, how can I fetch data from my server?

Aned lastly, how can I log the data on a channel in the mc-Studio so I can review it?
Title: Re: How to route Lplan data to my own server
Post by: mc-John on October 21, 2016, 09:29:10 am
The best way to route data to your server is use MQTT. Read about MQTT if you don't know how it works. MQTT is the preferred way to communicate.
I don't know what you mean with logging. The best way to store data is to use a ListOfByte and store data there. Next major release of our software will provide logging in flash.
Title: Re: How to route Lplan data to my own server
Post by: ayush on October 21, 2016, 11:12:05 am
By logging I mean, say I have this variable..  In the debug mode I want to see what value the variable has, is there any way to real that value..  Will be a very useful feature for debugging
Title: Re: How to route Lplan data to my own server
Post by: Nick_W on October 21, 2016, 11:16:02 am
You have to set a breakpoint, when the program hits the breakpoint, all the variable values are displayed. Then you hit continue ...
Title: Re: How to route Lplan data to my own server
Post by: ayush on October 21, 2016, 11:33:25 am
There is that, yes, but say there is a variable and you need to see its values 4 times in the code at different places to see how it is being manipulated, you will have to set 4 breakpoints...  Being able to display it on the mc-studio will be easier I think...
Title: Re: How to route Lplan data to my own server
Post by: mc-John on October 21, 2016, 02:50:29 pm
try Debug.Write