Thing.write_bucket() with two resources?

Hi,
can I write a bucket with concatenated resources?

thing.write_bucket(BUCKET_MIN, "measure", "feedback");

does not throw an error, but only the resouce “measure” updates the bucket.

Does it need another syntax to concatenate?

I am not sure if I understand your question, but you can stream output resources like this:
thing.stream("ResourceName");

This requires preparing the bucket:

Write bucket is OK, I just need to write the data from TWO resources
“measure” and “feedback” together into the bucket.
I would prefer not having to define a third resource containing all the data from the both above.

Hi,

Third parameter at write bucket instruction is to enable the writing confirmation, somehow you need to condense both pson values into one to be written by the write bucket instruction.

Hope this helps.

Thank you for the clue.
" you need to condense both pson values into one "
Do you know a way to do that, other than redefining completely a third thinger property repeating all value assignments of “measure” and “feedback”?

Regards

Hi,

I have doubts, need to do some tests before give any recommendation, what would I do is to define a pson variable and try to assign the defined resource values. Idk if it would work, need to do some try and failure.

Try this approach:

Use the same TimeStamp

time_now = ts;

thing["measure"] >> [](pson& out){                              
                              out["ts"]   =  time_now ;
                              out["temp"] =  temp;
};

thing["feedback"] >> [](pson& out){
                              out["ts"] =  time_now;
                              out["fb"] =  val_med;
};

thing.write_bucket(BUCKET_MIN, thing["measure"]);
thing.write_bucket(BUCKET_MIN, thing["feedback"]);

Be careful not to have keys with the same name.

Thank you George, I am not sure, that will probably be considerd as two writes and fail on the 1 minute update limit on free and maker accounts (which don’t imho use Influx)
That is what happens, when two or more devices write in the same bucket.
Even with hourly updates, on a maker account, I had to shift the hourly updates of one minute between the devices to avoid breaching the limit.
It was quite weird to get values disappearing silently…