1
mc-Module / Re: Reed Switch for Ifttt
« on: August 23, 2016, 07:50:58 pm »
I do thank you for your time in this matter but i did get it all sorted out using this code i got the reed switch, LEDS Voltage check working temperature and above 5 degrees notification working as well all through ifttt.
Shared Event CheckTemp() RaiseEvent Every 2 Minutes
Dim Temp As Float = TempSensor.GetTemp()
Dim tempstring As String = Temp.ToString()
Do
Lplan.IFTTT("dkOsWFyzdBCgGu-PUE50KR", "Coldrooms2Temperature", tempstring, "", "")
End Do
If Temp > 5 Then
Do
Lplan.IFTTT("dkOsWFyzdBCgGu-PUE50KR", "Coldrooms2Tempishigherthan5degrees", tempstring, "", "")
End Do
End If
End Event
Shared Event Boot()
Lplan.SetMidPowerMode(100)
End Event
Shared Event OnOff() RaiseEvent Every 180 Seconds
LedGreen = True
LedRed = True
Thread.Sleep(1000000) // sleep 1 second
LedGreen = False
LedRed = False
End Event
Shared Event checkvoltage() RaiseEvent Every 5 Minutes
Dim battvolt As Short = Device.BatteryVoltage()
If battvolt < 2200 Then
Lplan.IFTTT("dkOsWFyzdBCgGu-PUE50KR", "Coldroom2batteryvoltagegettinglow",)
Else
End If
End Event
Shared Event ReedSwitchChanged()
If ReedSwitch = True Then
Do
Lplan.IFTTT("dkOsWFyzdBCgGu-PUE50KR", "DoorOpenColdroom2", "", "")
End Do
End If
End Event
End Class
If you think there could be some fine tuning that could be done please feel free to let me know.
Shared Event CheckTemp() RaiseEvent Every 2 Minutes
Dim Temp As Float = TempSensor.GetTemp()
Dim tempstring As String = Temp.ToString()
Do
Lplan.IFTTT("dkOsWFyzdBCgGu-PUE50KR", "Coldrooms2Temperature", tempstring, "", "")
End Do
If Temp > 5 Then
Do
Lplan.IFTTT("dkOsWFyzdBCgGu-PUE50KR", "Coldrooms2Tempishigherthan5degrees", tempstring, "", "")
End Do
End If
End Event
Shared Event Boot()
Lplan.SetMidPowerMode(100)
End Event
Shared Event OnOff() RaiseEvent Every 180 Seconds
LedGreen = True
LedRed = True
Thread.Sleep(1000000) // sleep 1 second
LedGreen = False
LedRed = False
End Event
Shared Event checkvoltage() RaiseEvent Every 5 Minutes
Dim battvolt As Short = Device.BatteryVoltage()
If battvolt < 2200 Then
Lplan.IFTTT("dkOsWFyzdBCgGu-PUE50KR", "Coldroom2batteryvoltagegettinglow",)
Else
End If
End Event
Shared Event ReedSwitchChanged()
If ReedSwitch = True Then
Do
Lplan.IFTTT("dkOsWFyzdBCgGu-PUE50KR", "DoorOpenColdroom2", "", "")
End Do
End If
End Event
End Class
If you think there could be some fine tuning that could be done please feel free to let me know.