Missing Published Variables [SOLVED]

In my setup I am publishing 4 variables but only 2 are visible when doing the GET request to view them. I tried to delay between them since the 1st and 3rd ones are showing but that didn’t change anything.

My code:

void setup() {

    Particle.variable("temp", &temp, DOUBLE);
    Particle.variable("humidity", &humidity, DOUBLE);
    Particle.variable("light", &lightStatus, BOOLEAN);
    Particle.variable("light_manual", &lightManual, BOOLEAN);


Here is the JSON:

  "id": "xxxxxxx",
  "name": "my_name",
  "connected": true,
  "variables": {
    "temp": "double",
    "light": "bool"
  "functions": [
  "cc3000_patch_version": null,
  "product_id": 6,
  "last_heard": "2016-01-26T13:06:17.736Z",
  "last_ip_address": "xx.xx.xx.xx",
  "status": "normal"

I know it is setting the humidity in the loop because I’m pushing that to Librato via a webhook.



    temp = DHT.getFahrenheit();
    humidity = DHT.getHumidity();
    temp = round(temp*10)/10.0;
    humidity = round(humidity*10)/10.0;

    Particle.publish("librato_temp", String(temp), 60, PRIVATE);
    Particle.publish("librato_humidity", String(humidity), 60, PRIVATE);

Thanks for any help!

@tyler785, BOOLEAN is not a valid type for Particle.variables. You will need to use INT or convert the value to a STRING (eg. “true”, “false”). See here:


1 Like

Thanks, I was truncating my example code on here and then I realized that that was my issue after looking at the doc. My variable names were too long! I need more coffee!

To me it looks like BOOLEAN is support just not documented because my original returned this from the API:

   "variables": {
    "temp": "double",
    "light": "bool" 

And if I access the specific variable in the API I get this:

  "cmd": "VarReturn",
  "name": "light",
  "result": false,
  "coreInfo": {
    "last_app": "",
    "last_heard": "2016-01-26T14:13:51.302Z",
    "connected": true,
    "last_handshake_at": "2016-01-26T14:11:04.154Z",
    "deviceID": "xxxxxx",
    "product_id": 6

Thank you for your time!

[quote=“tyler785, post:3, topic:19467”]
To me it looks like BOOLEAN is support just not documented
[/quote] Well, that’s odd because the code says otherwise. Are you converting “light” to a string value?

@mdma, I don’t see BOOLEAN being supported in the code. Any comments?

Ok, so after reading this:

Prior to 0.4.7 firmware, variables were defined with an additional 3rd parameter to specify the data type of the variable. From 0.4.7 onwards, the system can infer the type from the actual variable. Additionally, the variable address was passed via the address-of operator (&). With 0.4.7 and newer, this is no longer required.

I changed it to:

Particle.variable("light", lightStatus);

and it detected it as

"light": "int32",

But it seems I can force cast it to BOOLEAN by using the old syntax but probably not the best to do since it could probably fail in a future update? I’ll probably just change it to an INT and use 0 and 1 to get the job done.

1 Like

@tyler785, using “BOOLEAN” is not casting anything since this is describing a parameter. That’s why I poked @mdma to get his feedback. :wink: