Raspberry Pi Relay project Dashboard problem

Hello there,

I found thinger.io from google.com and I am trying to learn from beginning in order to bring our IoT project there. Our project bases on Raspberry Pi as we have also other function on it.

It is amazing that it is easy to set up client configuration in Raspberry Pi and connect it to thinger.io. Then I just wanted to learn it from start how to control a relay which is connected to Raspberry Pi.

My main.cpp just like as below:

#include "thinger/thinger.h"
#include <wiringPi.h>

#define USER_ID             "myuserid"
#define DEVICE_ID           "RPI001"
#define DEVICE_CREDENTIAL   "rpi001-led"

#define LED_PIN 0 //GPIO17

int main(void)
{
    thinger_device thing(USER_ID, DEVICE_ID, DEVICE_CREDENTIAL);

        wiringPiSetup();

        pinMode(LED_PIN, OUTPUT);

    thing["light"] << [](pson & in){
        if(in.is_empty()){
                digitalWrite(LED_PIN, in ? HIGH:LOW);
        }
        else{
                if(in){
                        digitalWrite(LED_PIN, LOW);
                }else{
                        digitalWrite(0, HIGH);
                }
        }
    };

    thing.start();
    return 0;
}

In device all function is perfect. But when I add a dashboard with on/off state, it works not so well. The switch goes back to off soon when I turn it on. Any mistake I made?

I searched also many times the topic in community but I can’t find good solution for Raspberry Pi. Hope somebody can help me as it is confused me for several days.

Thank you guys in advance.

Simon