# Script for collecting and displaying trace/debug info

**URL:** <https://community.homey.app/t/script-for-collecting-and-displaying-trace-debug-info/73243>\
**Category:** Questions & Help\
**Created:** [December 7, 2022, 4:52pm UTC](https://community.homey.app/t/script-for-collecting-and-displaying-trace-debug-info/73243 "2022-12-07T16:52:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tiwas](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/tiwas/32/10066_2.png) [@Tiwas](https://community.homey.app/u/Tiwas)\
**Post date:** [December 7, 2022, 4:52pm UTC](https://community.homey.app/t/script-for-collecting-and-displaying-trace-debug-info/73243/1 "2022-12-07T16:52:24Z")

</div>

Hi,

The programmer in me likes to display summaries after execution and possibly debug info. How ever, javascript is something I’ve never felt the urge to play with…

Could someone please point me in the right direction for declaring a local variable, append to it and print it on flow end?

Thanks 🕶

---

<div class="post-metadata">

**Author:** ![JPe4619](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jpe4619/32/9017_2.png) [@JPe4619](https://community.homey.app/u/JPe4619)\
**Post date:** [December 7, 2022, 5:14pm UTC](https://community.homey.app/t/script-for-collecting-and-displaying-trace-debug-info/73243/2 "2022-12-07T17:14:36Z")

</div>

Look in HomeyScript for these examples:  
 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/f/d/fd31a33dad047bfcd7fa3eb9f63d778ea0c2bf23.png)

![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/a/7/a74d78458ed973d744edeadcf24be1a8185f3ec7.png)

It’s for Global variables not Local (don’t think it is possible)

---

<div class="post-metadata">

**Author:** ![Tiwas](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/tiwas/32/10066_2.png) [@Tiwas](https://community.homey.app/u/Tiwas)\
**Post date:** [December 7, 2022, 5:46pm UTC](https://community.homey.app/t/script-for-collecting-and-displaying-trace-debug-info/73243/3 "2022-12-07T17:46:46Z")

</div>

Ok, thanks. Was hoping for something “disposable” that would not risk being overwritten by concurrent flows. I’ll have a look 🕶

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [December 7, 2022, 10:08pm UTC](https://community.homey.app/t/script-for-collecting-and-displaying-trace-debug-info/73243/4 "2022-12-07T22:08:30Z")

</div>

Maybe this is what you look for?

> [@Setting Logic Variable by HomeyScript](https://community.homey.app/t/setting-logic-variable-by-homeyscript/14819/41):
>
> I’m not good at javascript, but I bashed and bashed at the keyboard until I could use the name of the variable for the whole operation, not manually find the id first. So it’s not beautiful, but works: //Set or get variable in Homey by name of variable const varName = 'myVariable' //The name of your variable let Logic = await Homey.logic.getVariables(); let idArr = Object.entries(Logic); let filtered = idArr.filter(([key, value]) =\> value.name==varName); let [[,{ id: varID}]] = filtered; /…

---

<div class="post-metadata">

**Author:** ![dooniem](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/dooniem/32/58384_2.png) [@dooniem](https://community.homey.app/u/dooniem)\
**Post date:** [December 8, 2022, 9:41am UTC](https://community.homey.app/t/script-for-collecting-and-displaying-trace-debug-info/73243/5 "2022-12-08T09:41:15Z")

</div>

Maybe you’d like to get a push notification of the summary you’re after?  
Here’s how you can use Homeyscript to output whatever you want as a push notification:

```auto
//Send push notification through Homeyscript (Only tested on a Homey with 1 account)
const usrs = await Homey.users.getUserMe();
let idArr = Object.entries(usrs);
const usrID = idArr[1][1]
const athomID = idArr[3][1]

await Homey.flow.runFlowCardAction({
  uri: "homey:manager:mobile",
  id: "push_text" ,
  args: {
	"user": {
		"id": usrID,
		"athomId": athomID
      },
 //Change the sample text and the variables to your needs
  "text": "Sample text line 1: " +varResult1
  	+"\n"+"Sample text line 2: " + varResult2
    },
});

```
