I have added a simple On/Off State Widget in the thinger.io Dashboard to control the relay on my Sonoff device.
If I try to set the Widget to On it immediately goes back to Off (and the relay also goes On to Off).
I get the same “on then immediately off” behaviour if I trigger a Web Request from IFTTT Maker channel to turn the relay On.
However if I control the relay through the API Explorer everything works as it should.
I think that you are defining the resource like the stock Arduino example, that is no well suited for dashboards. Will update the examples soon using the latest improvements as announced in Arduino Client Libraries 2.1.0
Try defining your relay something like that: (D1 is my digital pin)
thing["relay"] << digitalPin(D1);
This will define an input resource, for controlling a digital pin. But it will also allow reading the pin state for dashboards. This way, if IFTTT calls your relay, and you are connected to the dashboard, you should see how the IFTTT updates the relay state to on or off.
Current project will turn on the front porch light when i’m nearing my home.
I use the Android Location channel to trigger IFTTT events and a hacked Sonoff device for the light control.
But I’m really just playing around with the possibilities at the moment.
Hi, my project is with raspberry Pi 3 B+ and a relay. I got the same problem in Dashboard that the Widget goes back to Off at once when I turn it to On however the Device API works really perfect. Can anybody help me about it.
My main.cpp: