# \[Pro\]\[Dashboard\] SmartDash - a dashboard for Homey \[CLOSED\]

**URL:** <https://community.homey.app/t/pro-dashboard-smartdash-a-dashboard-for-homey-closed/83385>\
**Category:** Apps\
**Tags:** flow, dashboard, ios, homey-pro, android\
**Created:** [June 27, 2023, 8:41pm UTC](https://community.homey.app/t/pro-dashboard-smartdash-a-dashboard-for-homey-closed/83385 "2023-06-27T20:41:13Z")\
**Posts on this page:** 20\
**Page:** 11

<div class="post-metadata">

**Author:** ![diapolon](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/diapolon/32/82612_2.png) [@diapolon](https://community.homey.app/u/diapolon)\
**Post date:** [February 2, 2024, 8:22am UTC](https://community.homey.app/t/pro-dashboard-smartdash-a-dashboard-for-homey-closed/83385/203 "2024-02-02T08:22:51Z")

</div>

**v 0.240202.1**

> - Fixed regression when clicking widget buttons: now vibration, sound click and spinner are back.
> - Moved button for return to dashboard in bottom bar
> - On nspanelpro, when you go in info page the system automatically checks if there is an update

---

<div class="post-metadata">

**Author:** ![diapolon](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/diapolon/32/82612_2.png) [@diapolon](https://community.homey.app/u/diapolon)\
**Post date:** [February 2, 2024, 8:25am UTC](https://community.homey.app/t/pro-dashboard-smartdash-a-dashboard-for-homey-closed/83385/204 "2024-02-02T08:25:38Z")

</div>

The forecast is in todo list 😉  
I’ll think about the other functionality!

---

<div class="post-metadata">

**Author:** ![diapolon](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/diapolon/32/82612_2.png) [@diapolon](https://community.homey.app/u/diapolon)\
**Post date:** [February 2, 2024, 11:37am UTC](https://community.homey.app/t/pro-dashboard-smartdash-a-dashboard-for-homey-closed/83385/205 "2024-02-02T11:37:55Z")

</div>

This is awesome, i did not think about it!

> [@Joel\_Larsson](#):
>
> In the screensaver, being able to have both weather and time, and cycle them. And if its possible also add forecast so that you could have two different weather cyckling.

---

<div class="post-metadata">

**Author:** ![diapolon](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/diapolon/32/82612_2.png) [@diapolon](https://community.homey.app/u/diapolon)\
**Post date:** [February 2, 2024, 11:50am UTC](https://community.homey.app/t/pro-dashboard-smartdash-a-dashboard-for-homey-closed/83385/206 "2024-02-02T11:50:27Z")

</div>

For this,  
you would like to insert the power measure into the thermostat widget?

> [@Joel\_Larsson](#):
>
> Maybe this can be done another way, but in my setup I have a Shelly EM to measure the power consumption of heat/cooling-pumps. Would be really niceto being able to get them into the same widget as the heater widget. So what I mean is the possibility to get power consumption from another device.

---

<div class="post-metadata">

**Author:** ![Julien\_Moors](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/julien_moors/32/26538_2.png) [@Julien\_Moors](https://community.homey.app/u/Julien_Moors)\
**Post date:** [February 2, 2024, 1:08pm UTC](https://community.homey.app/t/pro-dashboard-smartdash-a-dashboard-for-homey-closed/83385/207 "2024-02-02T13:08:26Z")

</div>

Hello Ralf, did you find a solution to get a bearer token ?

It’s the third time i’ve to copy/past a new bearer to SmartDash since I installed it on my Sonoff (5 days ago)

---

<div class="post-metadata">

**Author:** ![diapolon](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/diapolon/32/82612_2.png) [@diapolon](https://community.homey.app/u/diapolon)\
**Post date:** [February 5, 2024, 9:42am UTC](https://community.homey.app/t/pro-dashboard-smartdash-a-dashboard-for-homey-closed/83385/208 "2024-02-05T09:42:49Z")

</div>

**HOW TO GET BEARER TOKEN IN HOMEY PRO 2016/2019**

**1) Create this homeyscript:**

```auto
const email = 'your_mail';
const password = 'your_password';
const client_id = '5a8d4ca6eb9f7a2c9d6ccf6d';
const client_secret = 'e3ace394af9f615857ceaa61b053f966ddcfb12a';
const redirect_url = 'http://localhost';
const cloudid = 'your_cloudid';

const between = function(str, strf, strt) {
    return str.split(strf).pop().split(strt)[0].trim();
}

const authurl = 'https://accounts.athom.com/login';

const response2 = await fetch(authurl, {
  'headers': {
    'accept': 'application/json, text/javascript, */*; q=0.01',
    'content-type': 'application/x-www-form-urlencoded; charset=UTF-8'
  },
  'referrerPolicy': 'no-referrer-when-downgrade',
  'body': 'email='+ encodeURIComponent(email) +'&password='+ encodeURIComponent(password) +'&otptoken=',
  'method': 'POST',
  'mode': 'cors',
  'credentials': 'omit'
});
const body2 = await response2.text();
const token = JSON.parse(body2);

const authorizeurl = 'https://accounts.athom.com/oauth2/authorise?client_id='+ client_id +'&redirect_uri='+ encodeURIComponent(redirect_url) +'&response_type=code&user_token='+ token.token;

const response3 = await fetch(authorizeurl, {
  'headers': {
  },
  'method': 'GET',
  'mode': 'cors',
  'credentials': 'include'
});
const body3 = await response3.text();
let csrf = between(body3, 'name="_csrf" value="', '">');

let raw = response3.headers.raw()['set-cookie'];
let cookiecsrf = null;
raw.forEach(el => {
    let dc = el.split('=');
    if (dc[0] === '_csrf') cookiecsrf = dc[1];    
});

let cookie4 = '_csrf=' + cookiecsrf;

let authorizeurl2 = 'https://accounts.athom.com/authorise?client_id='+ client_id +'&redirect_uri='+ encodeURIComponent(redirect_url) +'&response_type=code&user_token='+ token.token;
const response4 = await fetch(authorizeurl2, {
  'headers': {
    'content-type': 'application/x-www-form-urlencoded',
    'cookie': cookie4
  },
  'redirect': 'manual',
  'body': 'resource=resource.homey.'+ cloudid +'&_csrf='+ csrf +'&allow=Allow',
  'method': 'POST',
  'mode': 'cors',
  'credentials': 'include'
});

const body4 = await response4.text();
let code = response4.headers.get('location').split('=')[1];

let tokenendpoint = 'https://api.athom.com/oauth2/token';
const response5 = await fetch(tokenendpoint, {
  'headers': {
    'content-type': 'application/x-www-form-urlencoded'
  },
  'body': 'client_id='+ encodeURIComponent(client_id) +'&client_secret='+ encodeURIComponent(client_secret) + '&grant_type=authorization_code&code='+ encodeURIComponent(code),
  'method': 'POST',
  'mode': 'cors',
  'credentials': 'include'
});

const body5 = await response5.text();
let accesstoken = JSON.parse(body5);

let delegationEndpoint = 'https://api.athom.com/delegation/token?audience=homey';
const response6 = await fetch(delegationEndpoint, {
  'headers': {
    'content-type': 'application/x-www-form-urlencoded',
    'authorization': 'Bearer '+ accesstoken.access_token
  },
  'referrerPolicy': 'no-referrer-when-downgrade',
  'body': 'client_id='+ client_id +' &client_secret='+ client_secret +'&grant_type=refresh_token&refresh_token='+ accesstoken.refresh_token,
  'method': 'POST',
  'mode': 'cors',
  'credentials': 'include'
});

const body6 = await response6.json();

let endpoint7 = 'https://'+ cloudid +'.connect.athom.com/api/manager/users/login';

const response7 = await fetch(endpoint7, {
  'headers': {
    'content-type': 'application/json' 
  },
  'body': JSON.stringify({ 'token': body6 }),
  'method': 'POST'
});

const body7 = await response7.json()
await tag('access_token', '{ "token": "'+ body7 +'"}');  
return true;

```

This homeyscript estract the bearer token and put it into a tag

**2) Create a flow with call the homeyscript every day and put the token into a global variable**  
[https://homey.app/it-it/flow/n-F3VR/](https://homey.app/it-it/flow/n-F3VR/)

**3) Create a flow for send the token in a local url** ([Is needed this app](https://homey.app/it-it/app/dev.dadda.localapi/Local-API/))  
[https://homey.app/it-it/flow/l6V3VR/](https://homey.app/it-it/flow/l6V3VR/)

**4) Test the result**  
If your homey ip is 192.168.1.110 and in Local API you have set port 8066,  
the result is a link like this **[http://192.168.1.110:8066/token](http://192.168.1.110:8066/token)** that return a json

**NOTE:** client\_id and client\_secret are a test user, it can’t full access homey (here it is explained why insights don’t work)

---

<div class="post-metadata">

**Author:** ![Julien\_Moors](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/julien_moors/32/26538_2.png) [@Julien\_Moors](https://community.homey.app/u/Julien_Moors)\
**Post date:** [February 5, 2024, 11:28am UTC](https://community.homey.app/t/pro-dashboard-smartdash-a-dashboard-for-homey-closed/83385/209 "2024-02-05T11:28:44Z")

</div>

Hey !  
Thank you a lot !

It looks like it works for me 🙂

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

Now I’ve to know how local api works 🙂

---

<div class="post-metadata">

**Author:** ![diapolon](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/diapolon/32/82612_2.png) [@diapolon](https://community.homey.app/u/diapolon)\
**Post date:** [February 5, 2024, 11:38am UTC](https://community.homey.app/t/pro-dashboard-smartdash-a-dashboard-for-homey-closed/83385/210 "2024-02-05T11:38:30Z")

</div>

perfect!  
now you can add this at end of homeyscript:

```auto
await tag('access_token', '{ "token": "'+ body7 +'"}');  

```

and you can create a flow like this  
[https://homey.app/f/n-F3VR/](https://homey.app/f/n-F3VR/)  
and a flow like this  
[https://homey.app/f/l6V3VR/](https://homey.app/f/l6V3VR/)

if your homey ip is 192.168.1.110 and with local api you have set port 8066,  
the result is a link like this 192.168.1.110:8066/token that return a json  
I’m modifying SmartDash app to handle fetching the token automatically

---

<div class="post-metadata">

**Author:** ![diapolon](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/diapolon/32/82612_2.png) [@diapolon](https://community.homey.app/u/diapolon)\
**Post date:** [February 5, 2024, 3:48pm UTC](https://community.homey.app/t/pro-dashboard-smartdash-a-dashboard-for-homey-closed/83385/211 "2024-02-05T15:48:39Z")

</div>

![Screenshot 2024-02-05 alle 16.44.53](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/0/4/044aaa84ec5c0efffeb74755425ed761da643c27.png)

**Coming soon.**  
With new release you can insert an url for polling new token every hour.  
Url return a json (from App Local API) where $token is your valid token

```auto
{"status":"success","url":"/token","method":"GET","data":{"token":"$token"}}

```

---

<div class="post-metadata">

**Author:** ![Julien\_Moors](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/julien_moors/32/26538_2.png) [@Julien\_Moors](https://community.homey.app/u/Julien_Moors)\
**Post date:** [February 5, 2024, 5:13pm UTC](https://community.homey.app/t/pro-dashboard-smartdash-a-dashboard-for-homey-closed/83385/212 "2024-02-05T17:13:13Z")

</div>

> [@diapolon](#):
>
> 8066

Hello

1. So, I’ve added the line to the script:  

2. I’ve created a variable called “access\_token”

3. I’ve a flow named “Bearer” like this:  

4. I’ve installed and create a flow named “bearerSender” like this:  

5. I’ve configured LocalAPI like this:  

My Homey’s IP is 192.168.2.253  
My Sonoff’s IP is 192.168.2.61

Do I need to configure something else before your next release ?

---

<div class="post-metadata">

**Author:** ![diapolon](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/diapolon/32/82612_2.png) [@diapolon](https://community.homey.app/u/diapolon)\
**Post date:** [February 5, 2024, 5:57pm UTC](https://community.homey.app/t/pro-dashboard-smartdash-a-dashboard-for-homey-closed/83385/213 "2024-02-05T17:57:08Z")

</div>

you need enable cors and add \* in it

---

<div class="post-metadata">

**Author:** ![diapolon](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/diapolon/32/82612_2.png) [@diapolon](https://community.homey.app/u/diapolon)\
**Post date:** [February 5, 2024, 5:59pm UTC](https://community.homey.app/t/pro-dashboard-smartdash-a-dashboard-for-homey-closed/83385/214 "2024-02-05T17:59:17Z")

</div>

Open  
192.168.2.253:8066/token and check il json has your token

---

<div class="post-metadata">

**Author:** ![diapolon](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/diapolon/32/82612_2.png) [@diapolon](https://community.homey.app/u/diapolon)\
**Post date:** [February 5, 2024, 6:28pm UTC](https://community.homey.app/t/pro-dashboard-smartdash-a-dashboard-for-homey-closed/83385/215 "2024-02-05T18:28:50Z")

</div>

Tomorrow i release the update for testing

---

<div class="post-metadata">

**Author:** ![Julien\_Moors](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/julien_moors/32/26538_2.png) [@Julien\_Moors](https://community.homey.app/u/Julien_Moors)\
**Post date:** [February 5, 2024, 6:40pm UTC](https://community.homey.app/t/pro-dashboard-smartdash-a-dashboard-for-homey-closed/83385/216 "2024-02-05T18:40:10Z")

</div>

Configuration:

 ![Capture d’écran 2024-02-05 à 19.20.35](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/a/0/a0da2e99b6656d3f62837e87143674303d83f7ec.png)

Checking access:

 ![Capture d’écran 2024-02-05 à 19.39.52](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/6/4/64230ecf23209969c529ce0f2c12ddc3d3d93b7c.png)

---

<div class="post-metadata">

**Author:** ![Julien\_Moors](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/julien_moors/32/26538_2.png) [@Julien\_Moors](https://community.homey.app/u/Julien_Moors)\
**Post date:** [February 5, 2024, 7:33pm UTC](https://community.homey.app/t/pro-dashboard-smartdash-a-dashboard-for-homey-closed/83385/217 "2024-02-05T19:33:29Z")

</div>

I’ve tried with another port and it works !

Local API:

 ![Capture d’écran 2024-02-05 à 20.31.26](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/a/3/a386b0e4bb6ee5d5f5c14b3a2560e18e7a11a4e9.png)

JSON respons:

 ![Capture d’écran 2024-02-05 à 20.29.38](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/6/7/67499a6e7623fa9b17c857046af1ffed9bcbb954.png)

---

<div class="post-metadata">

**Author:** ![diapolon](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/diapolon/32/82612_2.png) [@diapolon](https://community.homey.app/u/diapolon)\
**Post date:** [February 5, 2024, 7:59pm UTC](https://community.homey.app/t/pro-dashboard-smartdash-a-dashboard-for-homey-closed/83385/218 "2024-02-05T19:59:19Z")

</div>

OK perfect!  
I have released nspanel pro version, check if it works (it may take some days to figure out if it works well)

---

<div class="post-metadata">

**Author:** ![Julien\_Moors](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/julien_moors/32/26538_2.png) [@Julien\_Moors](https://community.homey.app/u/Julien_Moors)\
**Post date:** [February 5, 2024, 10:59pm UTC](https://community.homey.app/t/pro-dashboard-smartdash-a-dashboard-for-homey-closed/83385/219 "2024-02-05T22:59:20Z")

</div>

Done !

I’ll give you a feedback !

Thank you a lot for your work !

---

<div class="post-metadata">

**Author:** ![diapolon](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/diapolon/32/82612_2.png) [@diapolon](https://community.homey.app/u/diapolon)\
**Post date:** [February 6, 2024, 5:14am UTC](https://community.homey.app/t/pro-dashboard-smartdash-a-dashboard-for-homey-closed/83385/220 "2024-02-06T05:14:34Z")

</div>

**v 0.240205.1**

> - added method for auto retrieve bearer token (needed for Homey Pro 2016/19)

---

<div class="post-metadata">

**Author:** ![diapolon](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/diapolon/32/82612_2.png) [@diapolon](https://community.homey.app/u/diapolon)\
**Post date:** [February 6, 2024, 8:51am UTC](https://community.homey.app/t/pro-dashboard-smartdash-a-dashboard-for-homey-closed/83385/222 "2024-02-06T08:51:03Z")

</div>

Damn,i think it’s unsolvable

---

<div class="post-metadata">

**Author:** ![diapolon](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/diapolon/32/82612_2.png) [@diapolon](https://community.homey.app/u/diapolon)\
**Post date:** [February 6, 2024, 9:48am UTC](https://community.homey.app/t/pro-dashboard-smartdash-a-dashboard-for-homey-closed/83385/223 "2024-02-06T09:48:47Z")

</div>

> [@Julien\_Moors](#):
>
> ![Capture d’écran 2024-02-05 à 18.03.50](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/2/b/2b236102f614fba329b7af6cd25d4daf465afd13.png)

You can remove 142 row

[Previous page](https://community.homey.app/t/pro-dashboard-smartdash-a-dashboard-for-homey-closed/83385.md?page=10)

[Next page](https://community.homey.app/t/pro-dashboard-smartdash-a-dashboard-for-homey-closed/83385.md?page=12)
