OPEnSLab-OSU / Loom

Arduino library for Internet of Things Rapid Prototyping in environmental sensing
GNU General Public License v3.0
26 stars 3 forks source link

Google Sheets Publishing Platform does not send Multiplexer Data #159

Open rijdmc419 opened 3 years ago

rijdmc419 commented 3 years ago

Describe the bug When I attempt to run the Google Sheets WiFi Publish example it I get a run time error of: [Goog] Publish data is invalid: contents is not an array [Goog] Could not publish without valid data.

Hardware in Use I am using a Multiplexer with the I2C sensors : TSL2591, SHT31D, STEMMA

To Reproduce Steps to reproduce the behavior:

  1. Go to 'Examples'
  2. Click on 'Loom' -> 'GoogleSheetsWiFi'
  3. Enter in your WiFi in the config file, along Google Sheets information
  4. Enable Multiplexer
  5. Run
  6. See error in Serial Monitor

Expected behavior The Serial Monitor will successfully show that all the modules were instantiated and the sensors are working. After the first packet is sent there will be an error showing: [Goog] Publish data is invalid: contents is not an array [Goog] Could not publish without valid data.

Code

///////////////////////////////////////////////////////////////////////////////

// This is the simplest example of logging data to Google Sheets

// The only difference between this example an 'Basic' is the LoomFactory
// settings, the line:
//		Feather.GoogleSheets().publish();
// and the configuration, enabling logging to Google Sheets.

// In the config, you need:
// - WiFi network name and password (or '' if no password)
// - For Google sheets parameters, see:
//   https://github.com/OPEnSLab-OSU/Loom/wiki/Using-Loom-with-Google-Sheets

///////////////////////////////////////////////////////////////////////////////

#include <Loom.h>

// Include configuration
const char* json_config =
#include "config.h"
;

// In Tools menu, set:
// Internet  > WiFi
// Sensors   > Enabled
// Radios    > Disabled
// Actuators > Enabled
// Max       > Disabled

using namespace Loom;

Loom::Manager Feather{};

void setup()
{
	Feather.begin_serial(true);
	Feather.parse_config(json_config);
	Feather.print_config();

	LPrintln("\n ** Setup Complete ** ");
}

void loop()
{
	Feather.measure();
	Feather.package();
	Feather.display_data();

	getGoogleSheets(Feather).publish();

	Feather.pause();
}

Config

"{\
	'general':\
	{\
		'device_name':'Device',\
		'instance_num':1,\
		'interval':3000\
	},\
	'components':[\
		{\
			'name':'Analog',\
			'params':'default'\
		},\
		{\
			'name':'Digital',\
			'params':'default'\
		},\
		{\
			'name':'WiFi',\
			'params':['<ssid>','<password>']\
		},\
		{\
			'name':'GoogleSheets',\
			'params':[\
				'Goog',\
				7002,\
				'/macros/s/<your-script-id>/exec',\
				'<your-sheet-id>',\
/*true to autoname tab*/				true,\
/*not used if previous param is true*/	'<your-tab-name>'\
			]\
		}\
	]\
}"

Additional context

I looked into the Loom 2.5 source code and it was getting stuck at the function: bool LoomPublishPlat::m_validate_json(const JsonObjectConst json) const which is then resulting in .publish() returning an error.

lucasballr commented 3 years ago

Is the device returning correct data in the Loom.displayData() function in the serial monitor?