Thingspeak Library not working with Mesh

Apparently the Thingspeak library does not work with Mesh devices.

Are there any workarounds? I would appreciate any help as this is a vital library to upload data from the Boron.

Could you elaborate on what exactly isn’t working?

When compiling, I get this error:

lib/ThingSpeak/ThingSpeak.h:66:3: #error Only Spark Core/Photon/Electron/P1 are supported.

The sketch is below:


// This #include statement was automatically added by the Particle IDE.
#include <ThingSpeak.h>

// This #include statement was automatically added by the Particle IDE.
#include <PublishManager.h>

// This #include statement was automatically added by the Particle IDE.
#include <SSD1306_128x32.h>

// This #include statement was automatically added by the Particle IDE.
#include "Utilities.h"

void setup() {

}

void loop() {

}

You can use a webhook integration and simply publish (without using the Library).

After a lot of testing, I found the webhook uses less data (tested w/ Electron) verses using the ThingSpeak Library or using MQTT.

Also, I believe the Library creates many String Objects (going from memory here).

Thank you @Rftop. I am using a sketch which was running on an Electron (and which makes use of that library) and would hate (with my limited knowledge of webhooks) to try all over again …

It seems that the library had various defines in place to check what device is being used. You could try raising an issue on their github to see if they can update it.

Thank you @Moors7.

I followed your advice and just heard back from them with the following:

We tried to get early access to the new Particle devices so we could have the library ready. We still have not received shipping confirmation on our pre-order.

I can try to change the .h file but where are the Platform_IDs for the Mesh products?

#define PLATFORM_SPARK_CORE 0
#define PLATFORM_SPARK_CORE_HD 2
#define PLATFORM_GCC 3
#define PLATFORM_PHOTON_DEV 4
#define PLATFORM_TEACUP_PIGTAIL_DEV 5
#define PLATFORM_PHOTON_PRODUCTION 6
#define PLATFORM_TEACUP_PIGTAIL_PRODUCTION 7
#define PLATFORM_P1 8
#define PLATFORM_ETHERNET_PROTO 9
#define PLATFORM_ELECTRON_PRODUCTION 10
#define PLATFORM_ARGON 12
#define PLATFORM_BORON 13
#define PLATFORM_XENON 14
#define PLATFORM_NEWHAL 60000

#endif /* PLATFORMS_H */

Thank you @ParticleD .

I realize the code below is not clean, but it works because of the compatibility between the Photon/Electron and the Argon/Boron/Xenon.

// Create platform defines for Particle devices
#if PLATFORM_ID == 0
	#define PARTICLE_CORE
#elif PLATFORM_ID == 6
	#define PARTICLE_PHOTON
	#define PARTICLE_PHOTONELECTRON
#elif PLATFORM_ID == 8
	#define PARTICLE_P1
	#define PARTICLE_PHOTONELECTRON
#elif PLATFORM_ID == 10
	#define PARTICLE_ELECTRON
	#define PARTICLE_PHOTONELECTRON
#elif PLATFORM_ID == 12
	#define PARTICLE_PHOTON
	#define PARTICLE_PHOTONELECTRON
#elif PLATFORM_ID == 13
	#define PARTICLE_PHOTON
	#define PARTICLE_PHOTONELECTRON
#elif PLATFORM_ID == 14
	#define PARTICLE_PHOTON
	#define PARTICLE_PHOTONELECTRON
#else
	#error Only Spark Core/Photon/Electron/P1 are supported.
#endif

@Jimmie
Can you please elaborate on how you you made your ThingSpeak library tweeks work? I tried pasting your lines in for the platform defines and could not upload the library because I was not the "owner: of the library. With that solved through adding my initials to the library name in the properties, I can’t get my program to compile. The error is “ThingSpeak_RB.h: No such file or directory”, yet i have of course included it in the program from My Libraries.

Hello @Acrop

What I did was add the two library files in my code.

So copy the .h and .cpp belonging to the library to your code, then make the changes I show in the code above.

So basically, do not reference the library.

Hi @Jimmie,
Thanks for the quick reply!
So if I understand correctly, open two new tabs in my program and paste the contents of the .ccp and .h files in these. Make the changes to the .h file as you showed. No ThingSpeak library loaded.
Doing this I get multiple errors: “ThingSpeak’ was not declared in this scope” These refer to the lines where the library would normally get called:
ThingSpeak.begin(client);
and
ThingSpeak.setField(1, (float)Weight);
ThingSpeak.setField(2, (float)temp);
Any other hints?

Hello @Acrop

  1. In your code, make sure the ThingSpeak.h and ThingSpeak.cpp are in tabs in your code.
  2. In your main code window,

#include "ThingSpeak.h"

char writeAPIKey[] = "XENUO..........";     // Change this to your channel Write API Key.
long channelID = 63....;                     // Change this to your channel number.

Then the rest …

That worked - thank you!