0

Line Chart Block and Group Feeds
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Line Chart Block and Group Feeds

by btreichel on Mon Dec 04, 2017 1:30 pm

I run the code below, and the dashboard runs perfectly.
Untitled.png
Untitled.png (104.41 KiB) Viewed 171 times


I uncomment these lines and the dashboard normally does not update 'count-2.
Capture2.PNG
Capture2.PNG (88.94 KiB) Viewed 171 times


As you can see from the screenshots the data makes it and is read back correctly. I have placed 100 ms delays before, during after group sets, etc, no effect.

Why does the dashboard work for two value in a group, but drop the middle value for three?

int count_3 = 20;
group->onMessage("count-3", three);
group->set("count-3", count_3);
count_3 += 1;

Here is the code with the lines commented out.
Code: Select all | TOGGLE FULL SIZE
// Adafruit IO Group Subscribe Example
//
// Adafruit invests time and resources providing this open source code.
// Please support Adafruit and open source hardware by purchasing
// products from Adafruit!
//
// Written by Todd Treece for Adafruit Industries
// Copyright (c) 2016 Adafruit Industries
// Licensed under the MIT license.
//
// All text above must be included in any redistribution.

/************************** Configuration ***********************************/

// edit the config.h tab and enter your Adafruit IO credentials
// and any additional configuration needed for WiFi, cellular,
// or ethernet clients.
#include "config.h"

/************************ Example Starts Here *******************************/

// set up the group
AdafruitIO_Group *group = io.group("example");
int count_1 = 0;
int count_2 = 10;
//int count_3 = 20;

void setup() {

  // start the serial connection
  Serial.begin(57600);

  // wait for serial monitor to open
  while(! Serial);

  // connect to io.adafruit.com
  Serial.print("Connecting to Adafruit IO");
  io.connect();

  group->onMessage("count-1", one);
  group->onMessage("count-2", two);
 // group->onMessage("count-3", three);

  // wait for a connection
  while(io.status() < AIO_CONNECTED) {
    Serial.print(".");
    delay(500);
  }

  // we are connected
  Serial.println();
  Serial.println(io.statusText());

}

void loop() {

  // io.run(); is required for all sketches.
  // it should always be present at the top of your loop
  // function. it keeps the client connected to
  // io.adafruit.com, and processes any incoming data.
  io.run();

  group->set("count-1", count_1);
  group->set("count-2", count_2);
 // group->set("count-3", count_3);
  group->save();

   // increment the count by 1
  count_1 += 1;
  count_2 += 1;
//  count_3 += 1;

  // wait one second (1000 milliseconds == 1 second)
  delay(1000);
}


// this function is called whenever a 'counter-1' message
// is received from Adafruit IO. it was attached to
// the counter-1 feed in the setup() function above.
void one(AdafruitIO_Data *data) {
  Serial.print("received example.count-1 <- ");
  Serial.println(data->value());
 
}

// this function is called whenever a 'counter-2' message
// is received from Adafruit IO. it was attached to
// the counter-2 feed in the setup() function above.
void two(AdafruitIO_Data *data) {
  Serial.print("received example.count-2 <- ");
  Serial.println(data->value());
}

void three(AdafruitIO_Data *data) {
  Serial.print("received example.count-3 <- ");
  Serial.println(data->value());
}

btreichel
 
Posts: 64
Joined: Tue Jul 25, 2017 3:00 pm

Re: Line Chart Block and Group Feeds

by btreichel on Tue Dec 05, 2017 11:35 am

So, I re-did the code to create two groups, with two values each, at half the rate. Same result, Only the 1st value in the first group, and that last value in the 2nd group update properly to the dasboard (i.e everytime, not just 1 in 1000, or..)

The behavior that should be seen is the 1&2 increment by 1 every 2 seconds, while 3&4 decrement.

here the dashboard https://io.adafruit.com/btreichel/dashboards/two-group

Anybody from adafruit listening?

btreichel
 
Posts: 64
Joined: Tue Jul 25, 2017 3:00 pm

Re: Line Chart Block and Group Feeds

by abachman on Wed Dec 06, 2017 5:25 pm

Hi btreichel, we're here, don't worry.

I'm seeing the same problem on my end and am taking a look now.

All the data is being stored properly and it's coming through on the MQTT group subscription topic (in my case, `abachman/groups/example/csv`) and the three individual MQTT feed subscriptions (`abachman/feeds/example.counter-1`, etc.), but it's not showing up live in the browser which means the missing value either isn't reaching the browser or isn't being stored correctly when it gets there. I suspect it's the latter.

I'll post here when I know what's up.


Cheers,
Adam

abachman
 
Posts: 74
Joined: Mon Feb 01, 2010 12:48 pm

Re: Line Chart Block and Group Feeds

by btreichel on Wed Dec 06, 2017 6:03 pm

Excellent! Thank you. I left my feed running and public in case it is of help. Figured this was good time to work on the minimal skills in fusion 360. After all that was the stsred reason fro needing a new laptop.

btreichel
 
Posts: 64
Joined: Tue Jul 25, 2017 3:00 pm

Re: Line Chart Block and Group Feeds

by abachman on Wed Dec 06, 2017 8:08 pm

btreichel,


We've deployed a fix that addresses the lost-messages problem, could you refresh your browser page and take a look at your dashboard? Our best guess is that it's related to some (we thought) unrelated dependency upgrades in our Javascript libraries that we pushed out late last week.

I'm running this code and seeing all three counter feeds publishing to my chart and stream blocks.

Screen Shot 2017-12-06 at 7.04.15 PM.png
Screen Shot 2017-12-06 at 7.04.15 PM.png (103.71 KiB) Viewed 103 times


Hopefully it's working for you too!


- Adam

abachman
 
Posts: 74
Joined: Mon Feb 01, 2010 12:48 pm

Re: Line Chart Block and Group Feeds

by btreichel on Wed Dec 06, 2017 8:25 pm

Yep, the 2 group version is working.

btreichel
 
Posts: 64
Joined: Tue Jul 25, 2017 3:00 pm

Re: Line Chart Block and Group Feeds

by btreichel on Thu Dec 07, 2017 6:06 pm

Got the prototype roaster interface working. you can see it here.https://io.adafruit.com/btreichel/dashboards/roaster

Its running on a Huzzah breakout, coded with the arduino ide. Roast data is faked, I do have an arduino controller that I could pass actual data to and from the dashboard via serial (software). Basically this would allow other people to watch the data from the roaster, and I could control the roaster from a browser. I can post the code if anybody really wants it. I did have to add the slider data into the roast data group to get a persistent value to show from the control sliders. Fits with the throttle limits thanks to using 'group' .

btreichel
 
Posts: 64
Joined: Tue Jul 25, 2017 3:00 pm

Please be positive and constructive with your questions and comments.


cron