Feed data not show any decimal places after 6 feeds

Moderators: adafruit_support_bill, adafruit

Forum rules
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.
Locked
User avatar
BillJuv
 
Posts: 5
Joined: Tue Feb 01, 2022 11:37 pm

Feed data not show any decimal places after 6 feeds

Post by BillJuv »

I was having trouble with one on my waterflow sensors not giving needed decimal values on the Adafruit IO but all others had them. I finally determined - at least in a group instance - that if you have over six feeds, the 7th will not show any decimal places after the whole number (not sure about 8th, 9th, so forth - only had 7 feeds). Changing the order, I found it’s the last one in the “group->set(“Value7”, value7);” statement (I believe just in the void loop) that won’t display the usual 6 decimal places in the feed on IO.

As a workaround, I moved “Battery Percent of charge” to the last position, as I don’t need the decimals. This note is just to make you aware of the issue.

I would also like to suggest other examples for using groups (besides publish and subscribe) as I took me a full day to figure out how to do it, and then figure out why it wouldn’t update on IO (I’ve come a long way in the past 6 months, but still have a lot to learn).

Key info in my code…

#include "config.h"
#include <Wire.h>
#include <SPI.h>
#include "Adafruit_SHT31.h"
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include "AdafruitIO.h"
#include "AdafruitIO_Group.h"
#include <OneWire.h> //DS18B20
#include <DallasTemperature.h>//DS18B20

#define IO_LOOP_DELAY 30000
unsigned long lastUpdate;
// set up the sensor feeds for AdafruitIO
AdafruitIO_Group *group = io.group("TestFeed6");
AdafruitIO_Feed *AirTempF = io.feed("airtempf");
AdafruitIO_Feed *Humidity = io.feed("humid");
AdafruitIO_Feed *WaterTemp = io.feed("watertemp");
AdafruitIO_Feed *Flow1 = io.feed("flow1");
AdafruitIO_Feed *Flow2 = io.feed("flow2");
AdafruitIO_Feed *BattVolt = io.feed("voltage");
AdafruitIO_Feed *BattPercent = io.feed("battpercent");


in void setup();
group->set("WaterTemp", H20F);
group->set("AirTempF", AirF);
group->set("Humidity", RelHum);
group->set("Flow1", WFlow1);
group->set("Flow2", WFlow2);
group->set("BattVolt", BatVlt);
group->set("BattPercent", BatPct);


in void loop();
if (millis() > (lastUpdate + IO_LOOP_DELAY)) {
Serial.println("AdaIO Update Time");
group->set("WaterTemp", watertempf);
group->set("AirTempF", tempf);
group->set("Humidity", humid);
group->set("Flow1", flow1);
group->set("Flow2", flow2);
group->set("BattVolt", voltage);
group->set("BattPercent", battpercent); //if over 6 sets, 7th has no trailing decimals shown
group->save();
// update IO timer
lastUpdate = millis();
}
} // end Void Loop()


void H20F(AdafruitIO_Data *data) {
WaterTemp->save (watertempf);
}
void AirF(AdafruitIO_Data *data) {
AirTempF->save(tempf);
}
void RelHum(AdafruitIO_Data *data) {
Humidity->save(humid);
}
void BatPct(AdafruitIO_Data *data) {
BattPercent->save(battpercent);
}
void BatVlt(AdafruitIO_Data *data) {
BattVolt->save(voltage);
}
void WFlow1(AdafruitIO_Data *data) {
Flow1->save(flow1);
}
void WFlow2(AdafruitIO_Data *data) {
Flow2->save(flow2);
}

Using ESP8266 Wemos D1 mini, Arduino IDE
TestFeed5.pdf
(399.24 KiB) Downloaded 4 times

User avatar
mikeysklar
 
Posts: 13946
Joined: Mon Aug 01, 2016 8:10 pm

Re: Feed data not show any decimal places after 6 feeds

Post by mikeysklar »

Thank you for sharing your code and explaining the decimal working around for over six feeds.

Did you want to open an issue with the github repo for AIO? This seems like a bug that can be reproduced and resolvable.

https://github.com/adafruit/Adafruit_IO_Arduino/issues

User avatar
mikeysklar
 
Posts: 13946
Joined: Mon Aug 01, 2016 8:10 pm

Re: Feed data not show any decimal places after 6 feeds

Post by mikeysklar »

Thank you for sharing your code and explaining the decimal working around for over six feeds.

Did you want to open an issue with the github repo for AIO? This seems like a bug that can be reproduced and resolvable.

https://github.com/adafruit/Adafruit_IO_Arduino/issues

Locked
Forum rules
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.

Return to “Internet of Things: Adafruit IO and Wippersnapper”