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

mcThings

  • We Connect Things To The Internet... That Can't Be Plugged In.
  • Administrator
  • Jr. Member
  • *****
  • Posts: 68
    • View Profile
    • www.mcthings.com
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

mc-T2

  • 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: www.cloudmqtt.com

mc-Studio Code used in the video:

Class ProductionRoom/YOURPROJECTNAMEHERE
    Shared Event ReedSwitchChanged()
       
        Dim payload As ListOfByte = New ListOfByte
        Dim payString As String = ""
       
        If ReedSwitch = True Then
            LedRed = True
            payString = "Open"
        Else
            LedRed = False
            payString = "Closed"
        End If
        payload.Add(payString)
        Lplan.Publish("mcThings/ProductionRoomDoor/YOURTOPICNAMEHERE", payload)
        Thread.Sleep(10000)
        Thread.ClearHardwareEvent()
        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")
        Else
           
        End If
       
    End Event


MQTT Dashboard Android App: https://play.google.com/store/apps/details?id=com.thn.iotmqttdashboard&hl=en

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: www.mcthings.com/products. mc-Development kits are available too!
Check out a live Dashboard using mcThings and Losant! Click here: https://goo.gl/ST43hB
Like Like x 1 View List