mc-Things
mc-Innovation Showcase => mc-Innovations => Topic started by: mcThings 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.
-- https://youtu.be/WfkQmg5P-3k (https://youtu.be/WfkQmg5P-3k) --
-
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
[attachment deleted by admin]
[attachment deleted by admin]
[attachment deleted by admin]