Author Topic: MQTT Implementation - Reed Switch Example  (Read 488 times)


  • We Connect Things To The Internet... That Can't Be Plugged In.
  • Administrator
  • Jr. Member
  • *****
  • Posts: 68
    • View Profile
MQTT Implementation - Reed Switch Example
« on: June 10, 2016, 05:36:13 pm »
In this video Tom Edworthy goes over the set up and implementation of MQTT in a Reed Switch example, with a door opening and closing.

-- --

Share on Facebook Share on Twitter

Like Like x 2 Informative Informative x 1 View List


  • Administrator
  • Sr. Member
  • *****
  • Posts: 252
  • mc-Things! The opportunities are endless!
  • Location: Canada
    • View Profile
Re: MQTT Implementation - Reed Switch Example
« Reply #1 on: June 12, 2016, 02:39:09 pm »
MQTT Reed Switch Details:

CloudMQTT Broker:

mc-Studio Code used in the video:

    Shared Event ReedSwitchChanged()
        Dim payload As ListOfByte = New ListOfByte
        Dim payString As String = ""
        If ReedSwitch = True Then
            LedRed = True
            payString = "Open"
            LedRed = False
            payString = "Closed"
        End If
        Lplan.Publish("mcThings/ProductionRoomDoor/YOURTOPICNAMEHERE", payload)
        Dim uptime As Integer = Device.Uptime()
    End Event
    Shared Event CheckVoltage() RaiseEvent Every 2 Days
        Dim BattVolt As Short = Device.BatteryVoltage
        If BattVolt < 2200 Then
            Lplan.IFTTT("YOURIFTTTKETHERE", "ProductionRoomBattery/YOURTOPICHERE")
        End If
    End Event

MQTT Dashboard Android App:

The app is quite easy to setup! When you have signed up a for a broker, you only need to input your details into the app to have the information relayed from the modules to your phone! See attached pictures

[ Guests cannot view attachments ]

[ Guests cannot view attachments ]

[ Guests cannot view attachments ]
Need more mc-Modules, mc-Gateways or other mc-Things? Check out our product page: mc-Development kits are available too!
Check out a live Dashboard using mcThings and Losant! Click here:
Like Like x 1 View List