# Edge actions - how to return values and "see" the stream

**URL:** <https://forum.sierrawireless.com/t/edge-actions-how-to-return-values-and-see-the-stream/18229>\
**Category:** Octave\
**Created:** [November 7, 2019, 11:10am UTC](https://forum.sierrawireless.com/t/edge-actions-how-to-return-values-and-see-the-stream/18229 "2019-11-07T11:10:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![johnofleek](https://sea1.discourse-cdn.com/flex025/user_avatar/forum.sierrawireless.com/johnofleek/32/4726_2.png) [@johnofleek](https://forum.sierrawireless.com/u/johnofleek)\
**Post date:** [November 7, 2019, 11:10am UTC](https://forum.sierrawireless.com/t/edge-actions-how-to-return-values-and-see-the-stream/18229/1 "2019-11-07T11:10:31Z")

</div>

A simple edge action example

```auto
function(event) {
  var accelValue = 25;

  return {
    // "cl://accelValue": [accelValue] // --- stream :default {"value":25}
    // "cl://": { // --- Run error: TypeError: wrong type of argument"
    // key1 : [1, 2, 1000],
    // key2 : [23]
    // }
     "cl://john": [{ // --- works but I don't know where the data is going
      key1 : [1, 2, 1000],
      key2 : [23]
    }]
  }

```

Questions

- Do I have the event return format correct?
- where is the doc for the event handler?
- what do I need to do see the device stream “john” ?

Thanks  
John

---

<div class="post-metadata">

**Author:** ![johnofleek](https://sea1.discourse-cdn.com/flex025/user_avatar/forum.sierrawireless.com/johnofleek/32/4726_2.png) [@johnofleek](https://forum.sierrawireless.com/u/johnofleek)\
**Post date:** [November 13, 2019, 2:56pm UTC](https://forum.sierrawireless.com/t/edge-actions-how-to-return-values-and-see-the-stream/18229/2 "2019-11-13T14:56:49Z")

</div>

Ok so I had a think - maybe the payload array can only contain ints, floats and strings  
But maybe the server understands JSON in string form

Quick test -

```auto
function(event) {
  var obj = { name: "John", age: 30, city: "New York" };
  var myJSON = JSON.stringify(obj);
  console.log(myJSON);
  return {
    "cl://result1" : [myJSON]
  };
}

```

This seems to be better - device \> streams \> mydevice \> :default I see

```auto
14:48:51 13-11-2019
14:48:10 13-11-2019
{"age":30,"city":"New York","name":"John"}
{
  "creationDate": 1573656531579,
  "creatorId": "i000000000000000000000001",
  "elems": {
    "age": 30,
    "city": "New York",
    "name": "John"
  },
  "generatedDate": 1573656490349,
  "hash": null,
  "id": "e5dcc17d31d6bd70a67dea02b",
  "lastEditDate": null,
  "location": null,
  "metadata": null,
  "path": "/iinnovate/devices/john_test_yellow/:default",
  "streamId": "s5db01378b8c3502a9e5c1f35",
  "tags": {
  }
}

```

Which looks like sensible data to me.

So the next question is how do I stop using :default and use a stream I created?  
Should I ask this in a new thread?

PS  
note the first time I posted this I missed the “;” of the console.log (too much python lately) the event handler ran twice but then croaked on subsequent calls by the Octave system

---

<div class="post-metadata">

**Author:** ![johnofleek](https://sea1.discourse-cdn.com/flex025/user_avatar/forum.sierrawireless.com/johnofleek/32/4726_2.png) [@johnofleek](https://forum.sierrawireless.com/u/johnofleek)\
**Post date:** [November 20, 2019, 9:47pm UTC](https://forum.sierrawireless.com/t/edge-actions-how-to-return-values-and-see-the-stream/18229/4 "2019-11-20T21:47:45Z")

</div>

For an answer to the :default stream question also see

> [@Device \> Edge Actions - why do return streams go to :default?](https://forum.sierrawireless.com/t/device-edge-actions-why-do-return-streams-go-to-default/18394):
>
> For Device \> Edge Actions why does the returned data appear in the stream \>\> :default Is it possible to send it to another stream or is this intended behaviour? function(event) { var p1 = {}; p1.weather = {} p1.weather.humidity = 30; p1.weather.pressure = 10000; p1.weather.temperature = 27.3; p1.weather.light = 23; return { "cl://result1" : [JSON.stringify(p1.weather)] }; returns on a stream the following (note “path”: “/iinnovate/devices/john\_test\_yellow/:default”,) …

---

<div class="post-metadata">

**Author:** ![djudkins](https://avatars.discourse-cdn.com/v4/letter/d/7ea924/32.png) [@djudkins](https://forum.sierrawireless.com/u/djudkins)\
**Post date:** [January 8, 2020, 6:17pm UTC](https://forum.sierrawireless.com/t/edge-actions-how-to-return-values-and-see-the-stream/18229/5 "2020-01-08T18:17:46Z")

</div>

Hello John,  
In the past, you could create a stream on the fly from an edge action. This is not possible anymore due to mess created by folks in development mode. You have to actually create a stream via the UI or via Octave API.

You can then point your edge action to the stream that has been created.

As fyi, streams can be created under the device or under your account. Streams not created under the device, can be seen in UI via the cloud - streams folder in Octave
