I'm having a problem with a Sketch dealing with MQTT.
I'm using GnatMQ as my MQTT Broker.
I have 3 .NET Client apps connected to the broker.
They are set to Publish and Subscribe. I can click on the Publish button all day long and the messages show up in the other windows immediately.
After a lot of troubleshooting different events and such, I came to the conclusion that the Gateway does not check and or rebroadcast a Subscribed event as fast as it should.
I'm not sure if this is the exact issue or not, but With a Sketch programmed to a Module and Turning on the gateway the first time, the Subscribe events happen as fast as I could press the Publish button.
I was very happy about this. Then I opened up mc-studio, connected gateways and such, I noticed my publish events are not happening.
After a lot of playing, I noticed it was taking like 45 seconds or more before my RED led turned on.
I thought it might have something to do with it sleeping, so I made the green LED turn on/off every 3 seconds.
It still took 45+ seconds for my red LED to turn on/off.
My MQTT Clients responds to all events immediately, as well as a test android app. So I know the Broker is doings it job.
What would make the gateway stop responding to events in a timely manner?
Oddly enough, when I was publishing an event, it happened every 60 seconds like you'd expect, commented out below as in reality these modules will just only subscribing.
My versions:
mc-Module.
BIN File Download: V0.7-357
mc-Gateway.
Application Processor BIN File Download: BIN FILE V0.6-357
Host Processor BIN File Download: BIN FILE V0.7-404
mc-Studio.
Application Download: mc-Studio Application V0.7-893
Sketch:
//
// This example logs the mc Unique IDentifier (mcUID) and the Temperature
// to IFTTT.
//
Class Temperature
Shared Event Boot()
Lplan.Subscribe("peckham/LIGHT")
End Event
// Shared Event GetTemp() RaiseEvent Every 1 Minutes
// Dim TempC As Float = TempSensor.GetTemp
// Dim TempF As Float = TempSensor.ToFarenheit(TempC)
//
// If TempF > 80.0 Then
// LedRed = True
// Else
// LedRed = False
// End If
//
// Dim payload As ListOfByte = New ListOfByte()
// payload.Add(TempF.ToString)
// Lplan.Publish("peckham/ART", payload)
// End Event
Shared Event SubscriptionDelivery()
Dim msg As Message = Lplan.GetDelivery()
If msg.Topic= "peckham/LIGHT" Then
Dim payload As ListOfByte = msg.PayLoad
If payload(0) = 49 Then
LedRed = Not LedRed
End If
If payload(0) = 50 Then
LedGreen = Not LedGreen
End If
End If
End Event
Shared Event BlinkGreen() RaiseEvent Every 3000 milliSeconds
LedGreen = Not LedGreen
End Event
End Class
Thank you,
Trey