Author Topic: How to route Lplan data to my own server  (Read 301 times)

ayush

  • Newbie
  • *
  • Posts: 19
    • View Profile
How to route Lplan data to my own server
« 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?
« Last Edit: October 21, 2016, 04:58:28 am by ayush »

Share on Facebook Share on Twitter


mc-John

  • Global Moderator
  • Full Member
  • *****
  • Posts: 212
    • View Profile
Re: How to route Lplan data to my own server
« Reply #1 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.

ayush

  • Newbie
  • *
  • Posts: 19
    • View Profile
Re: How to route Lplan data to my own server
« Reply #2 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

Nick_W

  • Full Member
  • ***
  • Posts: 215
    • View Profile
Re: How to route Lplan data to my own server
« Reply #3 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 ...

ayush

  • Newbie
  • *
  • Posts: 19
    • View Profile
Re: How to route Lplan data to my own server
« Reply #4 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...

mc-John

  • Global Moderator
  • Full Member
  • *****
  • Posts: 212
    • View Profile
Re: How to route Lplan data to my own server
« Reply #5 on: October 21, 2016, 02:50:29 pm »
try Debug.Write