mc-Things
mc-Platform => IFTTT => Topic started by: flookdigital on June 09, 2016, 10:54:28 pm
-
We have followed the example script and the video example but we are still not able to get a connection between the module and writing into the Google Drive spreadsheet. Please give clear instructions and script examples so we can at least get this example running.
We have updated to the latest firmware on the Gateway and modules.
Thank you for your help.
-
Hello.
Where does it stop? do you get any error message?
I just tested this myself and it works without any issues, the only thing that i changed from the video is that the temperatur code should now be
TempSensor.GetTemp()
instead of
Temperatur.GetTemp()
But that will raise an error message in mcStudio.
So please provide some more information and i will try my best to help you.
-
Hello Kristofferis - Thank you for taking the time to have a look.
Here is my code, I'm not getting any errors but I can't get it to post to the Google Drive spreadsheet.
First file: Tony3 -
Class TempSETUP
Shared Event checktemp() RaiseEvent Every 30 Seconds
Dim temp As Float = TempSensor.GetTemp()
Dim tempstring As String = temp.ToString()
Lplan.IFTTT("dQoVzrPWk31UKuZDRMXnSW", "Grinder", tempstring, " ",)
End Event
Shared Event blinkgreen() RaiseEvent Every 5000 milliSeconds
LedGreen = Not LedGreen
End Event
End Class
Second File: TempSensor
Class TempSensor
// Function returns the temperature in degree celcius or
// Float.NaN if something is wrong
Shared Function GetTemp() As Float
// Define the properties of the I2C peripheral and device address
Dim sensor As I2c
sensor = I2c.Create(400000, Pin.SCL, Pin.SDA, 0x48)
// Power up the sensor and give it some time to settle
Device.EnableTempSensor()
Thread.Sleep(40000) // See page 13 of the datasheet
// Read the sensor (only 2 bytes to read
Dim res As ListOfByte = sensor.Read(2)
// See Tmp102 documentation how to interpret the data (page 8)
Dim temp As Float = Float.NaN
If res <> Nothing Then
// Shift the partial part to the right nibble
Dim part As Float = res(1) >> 4
// Temperature partial is 1/16*n where n is between 0 and 15
part = part / 16
// Sign extend the byte to an integer
temp = res(0).SignExtend() + part
End If
// power off
Device.DisableTempSensor()
Return temp
End Function
Shared Function GetDieTemp() As Float
// Just get the temperature and return
Return Device.TempDie
End Function
Shared Function ToFarenheit(celcius As Float) As Float
Return (celcius * 9) / 5 + 32
End Function
Shared Function ToCelcius(farenheit As Float) As Float
Return (farenheit - 32) * 5 / 9
End Function
End Class
-
Hello.
Is this code exactly what you are using? if that's the case then i have to say that it seems that you IFTTT key is to short, please verify that you are using the correct key.
-
I'm having similar trouble. I'm trying to figure out if the gateway is actually connecting out. I think we could do with some kind of diagnostic tool to check gateway to internet connection is working. The amber light is on.
-
What do you mean with similar issue?
If you like to test external connection then you could setup a MQTT broker on internet and verify with a MQTT client that your mcGateway is sending to broker.
The code against IFTTT does work, if your spreadsheet not update then verify IFTTT Key and that IFTTT has permission to write to your Google drive account.
If you want to verify your IFTTT account then you could send me your key and recipe name in an PM and I will test against your account from one of my mcModules.
-
Hello
Yes this is the code I'm using - I have since started again and now have a longer code - "jsaIqb28FNkdmR0qFCmOSaNXA7JRJvnTaUG6q5uDfnb"
But it is still not working.
Blank spreadsheet.
-
If you post your recipe name that you use on IFTTT then i could test to update your spreadsheet from one of my devices, to verify if the problem is the code on your device, your mcGateway or the recipe on IFTTT.
-
Recipe ID 428645
'Flook Google drive test'
Maker key jsaIqb28FNkdmR0qFCmOSaNXA7JRJvnTaUG6q5uDfnb
-
Okey, I think that I have found a bug if there is space in the recipe name.
Please test with a recipe name like Temperature or something just no spaces in the name.
Let me know the new name and i will test again.
-
Event name is 'Grinder'
-
Okey, I have now sent a couple of temperatures to that IFTTT event name.
Does it show in your spreadsheet?
-
I have 3 entries, 3:54 PM 3:55 PM and 3:56 PM - last one 26 degrees
I was really hoping they were coming from my module :(
-
My Gateway seems to freeze - either green led stays on or off after a reset. two red led stay on all the time.
Is that good?
-
But now we know that your IFTTT is working.
Do you run this in debug mode in mcStudio when connected to a mcModule?
If not, do that and also set some breakpoints in the code.
One on the raw that fetch the temperature and one the next line that creates a string and finally one on the raw that sends the IFTTT message.
Then you will see if the code actually run and also what value you are pushing to IFTTT.
-
No that's not good, let me guess that when the green LED is not blinking then you can not connect to it with your mcStudio, not even see it?
Does this happen when you pull the plug and reboot it? I mean right away?
-
OK, I agree - Some progress
I'm not sure if this is what your looking for
[attachment deleted by admin]
-
Yes, that looks great. Now you could see that the code runs on your device, if you now click continue twice then I think that your spreadsheet will get an update from your device.
At least everything looks as it should.
-
Well - still nothing from my Gateway to the spreadsheet which has been the issue all along. Really frustrating!
Run out of time today - I'll carve out some time tomorrow hopefully.
Really appreciate you helping me.
-
I think I found the problem.
Please change your raw of code that send the message to this
Lplan.IFTTT("jsaIqb28FNkdmR0qFCmOSaNXA7JRJvnTaUG6q5uDfnb", "Grinder", tempstring, "", "")
Then you will see that it will work :)
-
I made the correction in the string
Still nothing. I really think my Gateway is no good. Is there a way to test it?
-
One thing that you could verify is that your mcGateway is running the latest version. What version does it say in mcStudio when you see the gateway in devices?
Do you have any knowledge about MQTT? With MQTT then it's possible to verify that the gateway is communicating out on internet (with a broker on internet) I could let you use my broker for this test then I could check the logs.
-
Hey guys,
one thing that I have seen happen sometimes with IFTTT is that you, on occasion, need to reconnect your maker channel. I can't seem to find the reason why the channel needs to be reconnected (maybe there is updates on the IFTTT side?). You can do this when you log into maker.ifttt.com (after you sign up for IFTTT service of course). If you do run into issues, attempt to re-connect your IFTTT maker channel. Re-connecting also will give you a new key if you need a new one for whatever reason.
Also, please note that IFTTT recipes are case-sensitive which may be a cause of some issues for some folks
-
Hi guys
I'm just trying again to see if I can get the temperature to post to my IFTTT account/google drive
It's still not working?
Can someone send me the correct text so I can test.
I have two files running
First is 'Tony3'
Class TempSETUP
Shared Event checktemp() RaiseEvent Every 30 Seconds
Dim temp As Float = TempSensor.GetTemp()
Dim tempstring As String = temp.ToString()
Lplan.IFTTT("ixPSxhVnzVN2Fw-PZ5gkDdaGxToDLkLTtpMQ7axDQ7R", "Grinder", tempstring, "", "")
End Event
Shared Event blinkgreen() RaiseEvent Every 500 milliSeconds
LedGreen = Not LedGreen
End Event
End Class
And the second is 'Temp Sensor'
Class TempSensor
// Function returns the temperature in degree celcius or
// Float.NaN if something is wrong
Shared Function GetTemp() As Float
// Define the properties of the I2C peripheral and device address
Dim sensor As I2c
sensor = I2c.Create(250000, Pin.SCL, Pin.SDA, 0x48)
// Power up the sensor and give it some time to settle
Device.EnableTempSensor()
Thread.Sleep(40000) // See page 13 of the datasheet
// Read the sensor (only 2 bytes to read
Dim res As ListOfByte = sensor.Read(2)
// See Tmp102 documentation how to interpret the data (page 8)
Dim temp As Float = Float.NaN
If res <> Nothing Then
// Shift the partial part to the right nibble
Dim part As Float = res(1) >> 4
// Temperature partial is 1/16*n where n is between 0 and 15
part = part / 16
// Sign extend the byte to an integer
temp = res(0).SignExtend() + part
End If
// power off
Device.DisableTempSensor()
Return temp
End Function
Shared Function GetDieTemp() As Float
// Just get the temperature and return
Return Device.TempDie
End Function
Shared Function ToFarenheit(celcius As Float) As Float
Return (celcius * 9) / 5 + 32
End Function
Shared Function ToCelcius(farenheit As Float) As Float
Return (farenheit - 32) * 5 / 9
End Function
End Class