Connected device can't access the API


Hi, the Dashboard shows that my device (Arduino Yun) is connected, and moreover there is data being received by the buckets but when I try to view the API window at the Devices dashboard I get the following error message:

> Ooops! Cannot connect to your device! Is it connected?

Any hints of what could be the cause?



HI, device appears as connected when you enter in the device?


Yes it does. Please see video on the link below:

By the way I have a strong feeling that this issue is related with the one mentioned in the post below


Hi, it seems that your device is connected, but some of your resources is resetting the device or making it crash. Making your device to not answer to the API discovery. Can you share your code?



Hi Alvaro, many thanks for your prompt answer. Please find the code below, my project is about a Water Consumption Monitor. Hope code is easy enough to understand. I would also like to point out that exactly the same code run without any problem for a few hours and the issue arose once the device was disconnected and reconnected (just to change the power source)

//#define DEBUG

#include <BridgeSSLClient.h>
#include <ThingerYun.h>
#include <Process.h>

Process date; // process used to get the date
int hours, minutes, seconds; // for the results
int lastSecond = -1; // need an impossible value for comparison
int lastMinute = -1; // used to avoid sending more than one reading at the same time, start with
// impossible value

// Setup of used as Dashboard and to send email in case of critical consumption
#define USERNAME “OldNerd”
#define DEVICE_ID “Yun”
#define DEVICE_CREDENTIAL “------------”


float ValLitros; //Count how many Liters are consumed by the hour
float TotalDia; //Keeps track of the daily consumption by adding the above value

// Flow Sensor handling variables

byte sensorInterrupt = 4; // 4 = digital pin 7 on the Yun
byte sensorPin = 7;
volatile float pulseCount; // keeps track of the pulses coming from the flow sensor

void setup() {
//Serial.begin (115200);

// initialize bridge

thing[“led”] << digitalPin(LED_BUILTIN);

thing[“litros”] >> outputValue(ValLitros);
thing[“TotalDiario”] >> outputValue (TotalDia);

// run an initial date process. Should return:
// hh:mm:ss :
if (!date.running()) {

// interrupt setup
pinMode(sensorPin, INPUT);
digitalWrite(sensorPin, HIGH);
pulseCount = 0;
TotalDia = 0;
// The Hall-effect sensor is connected to pin 7 which uses interrupt 4.
// Configured to trigger on a FALLING state change (transition from HIGH
// state to LOW state)
attachInterrupt(sensorInterrupt, pulseCounter, FALLING);


void loop()
// check if it is time to send a new reading, for testing will send one reading per minute
//if ((minutes == 00) || (minutes ==15) || (minutes == 30) || (minutes == 45))
if (minutes != lastMinute)
if (minutes == 0)
pulseCount = 0;
pulseCount = pulseCount + random (300); //for testing only it is simulating sensor readings
ValLitros = pulseCount;

// send email waring if the water consumption is higher than a given value
    if (ValLitros > 20000)

    TotalDia = TotalDia + ValLitros ;
    lastMinute = minutes;
    if (minutes == 0)
    pulseCount = 0; //reset counter to start new cycle
    // at the start of every day reset the Daily Total
    if (hours == 1)
    TotalDia = 0;
//delay (3000);


void checktime ()
if (hours <= 9) {
//Serial.print(“0”); // adjust for 0-9

 if (minutes <= 9) {
  //Serial.print("0");  // adjust for 0-9
// restart the date process:
if (!date.running()) {

//if there’s a result from the date process, parse it:
while (date.available() > 0) {
// get the result of the date process (should be hh:mm:ss):
String timeString = date.readString();

// find the colons:
int firstColon = timeString.indexOf(":");
int secondColon = timeString.lastIndexOf(":");

// get the substrings for hour, minute second:
String hourString = timeString.substring(0, firstColon);
String minString = timeString.substring(firstColon + 1, secondColon);

// convert to ints, returning hours and minutes to be used 
hours = hourString.toInt();
minutes = minString.toInt();


Interrupt Service Routine
void pulseCounter()
// Increment the pulse counter
pulseCount = pulseCount + 1;


@alvarolb not sure if you did something or not but the fact is that it has been stable for the last 24 hours. I thought I should let you know about it.