# \[APP\]\[Pro\] Insights Graphs

**URL:** <https://community.homey.app/t/app-pro-insights-graphs/86856>\
**Category:** Apps\
**Tags:** app, flow, insights, homey-pro, advancedflow\
**Created:** [August 12, 2023, 10:32am UTC](https://community.homey.app/t/app-pro-insights-graphs/86856 "2023-08-12T10:32:40Z")\
**Posts on this page:** 20\
**Page:** 4

<div class="post-metadata">

**Author:** ![Daniel\_Fille](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/daniel_fille/32/15219_2.png) [@Daniel\_Fille](https://community.homey.app/u/Daniel_Fille)\
**Post date:** [August 20, 2023, 2:00pm UTC](https://community.homey.app/t/app-pro-insights-graphs/86856/62 "2023-08-20T14:00:02Z")

</div>

Ahh will try this tonight! Thanks for making this app ☺

---

<div class="post-metadata">

**Author:** ![LRvdLinden](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/lrvdlinden/32/80786_2.png) [@LRvdLinden](https://community.homey.app/u/LRvdLinden)\
**Post date:** [August 20, 2023, 2:07pm UTC](https://community.homey.app/t/app-pro-insights-graphs/86856/63 "2023-08-20T14:07:26Z")

</div>

Good option @Menno_van_Hout, also double lines.

---

<div class="post-metadata">

**Author:** ![Menno\_van\_Hout](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/menno_van_hout/32/77843_2.png) [@Menno\_van\_Hout](https://community.homey.app/u/Menno_van_Hout)\
**Post date:** [August 20, 2023, 2:12pm UTC](https://community.homey.app/t/app-pro-insights-graphs/86856/64 "2023-08-20T14:12:13Z")

</div>

Yes this is possible I collect them within the autocomplete of sensors. I can just add the data! Good idea!!!

---

<div class="post-metadata">

**Author:** ![Menno\_van\_Hout](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/menno_van_hout/32/77843_2.png) [@Menno\_van\_Hout](https://community.homey.app/u/Menno_van_Hout)\
**Post date:** [August 20, 2023, 2:12pm UTC](https://community.homey.app/t/app-pro-insights-graphs/86856/65 "2023-08-20T14:12:41Z")

</div>

Double lines is probably not coming anytime soon…

---

<div class="post-metadata">

**Author:** ![basvanderploeg](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/basvanderploeg/32/83556_2.png) [@basvanderploeg](https://community.homey.app/u/basvanderploeg)\
**Post date:** [August 20, 2023, 4:33pm UTC](https://community.homey.app/t/app-pro-insights-graphs/86856/66 "2023-08-20T16:33:00Z")

</div>

I experimented a bit further to get gradients working. Unfortunately it doesn’t seem to work with `chart-to-image`. But the [developer](https://github.com/typpo/chartjs-to-image/issues/34) recommended [quickchart-js](https://github.com/typpo/quickchart-js/). I tried it, and gradients work instantly with that. It’s a one-to-one replacement for `chart-to-image`, so it can easily be swapped.

 ![insights-graphs](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/4/7/47570f89dcb1a901b5c22cea60a9b795a4fa886b.jpeg)

---

<div class="post-metadata">

**Author:** ![Menno\_van\_Hout](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/menno_van_hout/32/77843_2.png) [@Menno\_van\_Hout](https://community.homey.app/u/Menno_van_Hout)\
**Post date:** [August 20, 2023, 4:45pm UTC](https://community.homey.app/t/app-pro-insights-graphs/86856/67 "2023-08-20T16:45:22Z")

</div>

Only that one isn’t internet independent?

---

<div class="post-metadata">

**Author:** ![spkesDE](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/spkesde/32/54352_2.png) [@spkesDE](https://community.homey.app/u/spkesDE)\
**Post date:** [August 20, 2023, 4:55pm UTC](https://community.homey.app/t/app-pro-insights-graphs/86856/68 "2023-08-20T16:55:25Z")

</div>

Sure, Insights Trends Reloaded is open source.

```ts
    /**
     * Calculates the trend of the Insight
     * @param id
     * @param uri
     * @param range
     * @param unit
     * @param percent - optional
     * @param type - optional
     *
     * @returns object {
     * trendline: [
     * {X: number (timestamp): y: number}
     * ]
     * min: number
     * max: number
     * mean: number
     * median: number
     * standardDeviation: number
     * trend: number
     * firstvalue: number
     * firstvalue_timestamp: number (timestamp)
     * firstvalue_time: string
     * lastvalue: number
     * lastvalue_timestamp: number (timestamp)
     * lastvalue_time: string
     * size: number,
     * percentile: number
     * percent: number,
     * data: [
     * {x: number (timestamp), y: number}
     * ]
     * }
     */
    public async getInsightCalculated(id: string, uri: string, range: number, unit: string, percent: number = 50, type?: string)

```

```ts
appApi.getInsightCalculated("homey:manager:apps:com.spkes.insightTrendsReloaded-cpu", "homey:manager:apps", 24, 60) (24 * 60 == 24h) (23 * 1440 == 31 days)

return:
{
  trendLine: [
    { x: 1692014400000, y: 0.0391722558765224 },
    { x: 1692511200000, y: 0.02808720634975259 }
  ],
  min: 0.0270062,
  max: 0.0907134,
  mean: 0.0336297,
  median: 0.0310396,
  standardDeviation: 0.0123327,
  trend: -0,
  firstvalue: 0.0907134,
  firstvalue_timestamp: 1692014400000,
  firstvalue_time: '14/08/2023, 14:00:00',
  lastvalue: 0.0277778,
  lastvalue_timestamp: 1692511200000,
  lastvalue_time: '20/08/2023, 08:00:00',
  size: 24,
  percentile: 0.03103956228956229,
  percent: '50',
  data: [
    { x: 1692014400000, y: 0.09071343448177728 },
    ...
  ]
}

```

> **[Web API](https://apps.developer.homey.app/advanced/web-api)**
>
> Exposing and consuming a custom REST API for your Homey App with support for real-time events.

Edit: FYI this is my configuration.

> <https://github.com/spkesDE/com.spkes.insightTrendsReloaded/blob/master/settings/index.js#L9>

---

<div class="post-metadata">

**Author:** ![basvanderploeg](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/basvanderploeg/32/83556_2.png) [@basvanderploeg](https://community.homey.app/u/basvanderploeg)\
**Post date:** [August 20, 2023, 6:50pm UTC](https://community.homey.app/t/app-pro-insights-graphs/86856/69 "2023-08-20T18:50:55Z")

</div>

I’m afraid that I misinterpreted the way `chartjs-to-image` works. In the background it [still seems to outsource](https://quickchart.io/documentation/chart-js/image-export/#using-chartjs-to-image) the rendering, in this case to QuickChart’s web service. So it’s not internet independent after all.

`quickchart-js` is also using that service, but it enables gradients for the graphs. Which makes everything look just a bit nicer.

There is also `chartjs-node-canvas`, which _actually_ runs locally. But it’s not really maintained anymore [by the looks of it](https://github.com/SeanSobey/ChartjsNodeCanvas).

---

<div class="post-metadata">

**Author:** ![spkesDE](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/spkesde/32/54352_2.png) [@spkesDE](https://community.homey.app/u/spkesDE)\
**Post date:** [August 20, 2023, 7:04pm UTC](https://community.homey.app/t/app-pro-insights-graphs/86856/70 "2023-08-20T19:04:50Z")

</div>

~~No, you are right. `quickchart-js` is also local.~~

> **[GitHub - typpo/quickchart-js: Javascript client for quickchart.io](https://github.com/typpo/quickchart-js/#usage)**
>
> Javascript client for quickchart.io. Contribute to typpo/quickchart-js development by creating an account on GitHub.

~~Or write it to disk:~~

```auto
myChart.toFile('/tmp/mychart.png');

```

Edit: Nvm it’s just a client. The rendere runs on there server.  
Edit2: Just looked the source code of `chart-to-image`, It uses the same stuff as `quickchart-js`. So both are not fully local.

---

<div class="post-metadata">

**Author:** ![basvanderploeg](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/basvanderploeg/32/83556_2.png) [@basvanderploeg](https://community.homey.app/u/basvanderploeg)\
**Post date:** [August 20, 2023, 7:22pm UTC](https://community.homey.app/t/app-pro-insights-graphs/86856/71 "2023-08-20T19:22:56Z")

</div>

Yeah, that’s what I found.

So probably the easiest option is to switch over to `quickchart-js` (with the gradient rendering) and just live with the fact that it’s not internet independent.

---

<div class="post-metadata">

**Author:** ![Daniel\_Fille](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/daniel_fille/32/15219_2.png) [@Daniel\_Fille](https://community.homey.app/u/Daniel_Fille)\
**Post date:** [August 20, 2023, 11:03pm UTC](https://community.homey.app/t/app-pro-insights-graphs/86856/72 "2023-08-20T23:03:11Z")

</div>

I don’t get it to work, any idea? @Menno_van_Hout

 ![Skärmavbild 2023-08-21 kl. 00.58.04](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/9/9/99ea70c4a9252093e5d5f75394aef053e9ed1c34.jpeg)

---

<div class="post-metadata">

**Author:** ![Guido\_Groeneweg](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/guido_groeneweg/32/81606_2.png) [@Guido\_Groeneweg](https://community.homey.app/u/Guido_Groeneweg)\
**Post date:** [August 21, 2023, 9:41am UTC](https://community.homey.app/t/app-pro-insights-graphs/86856/73 "2023-08-21T09:41:08Z")

</div>

Hi,  
Thanks for this app, because I was looking for a more proactive way instead of looking graphs up using Insights.

Question: is it possible to have an interval of 12 hours instead of 6 or 24 hours?

---

<div class="post-metadata">

**Author:** ![LRvdLinden](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/lrvdlinden/32/80786_2.png) [@LRvdLinden](https://community.homey.app/u/LRvdLinden)\
**Post date:** [August 21, 2023, 9:45am UTC](https://community.homey.app/t/app-pro-insights-graphs/86856/74 "2023-08-21T09:45:26Z")

</div>

Only the time windows that you can choose in Homey her Insights is supported by our app.

---

<div class="post-metadata">

**Author:** ![Menno\_van\_Hout](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/menno_van_hout/32/77843_2.png) [@Menno\_van\_Hout](https://community.homey.app/u/Menno_van_Hout)\
**Post date:** [August 22, 2023, 2:57pm UTC](https://community.homey.app/t/app-pro-insights-graphs/86856/75 "2023-08-22T14:57:10Z")

</div>

Thanks and @spkesDE I will change the used package and add a gradient!

---

<div class="post-metadata">

**Author:** ![Menno\_van\_Hout](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/menno_van_hout/32/77843_2.png) [@Menno\_van\_Hout](https://community.homey.app/u/Menno_van_Hout)\
**Post date:** [August 22, 2023, 2:58pm UTC](https://community.homey.app/t/app-pro-insights-graphs/86856/76 "2023-08-22T14:58:09Z")

</div>

Which homey do you have? an early 2023?

---

<div class="post-metadata">

**Author:** ![Daniel\_Fille](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/daniel_fille/32/15219_2.png) [@Daniel\_Fille](https://community.homey.app/u/Daniel_Fille)\
**Post date:** [August 22, 2023, 3:10pm UTC](https://community.homey.app/t/app-pro-insights-graphs/86856/77 "2023-08-22T15:10:32Z")

</div>

Yes, running the 2023 Homey 🤔 What is this error code all about? 😅 @Menno_van_Hout

---

<div class="post-metadata">

**Author:** ![Valentin\_Ciopei](https://avatars.discourse-cdn.com/v4/letter/v/6bbea6/32.png) [@Valentin\_Ciopei](https://community.homey.app/u/Valentin_Ciopei)\
**Post date:** [August 29, 2023, 6:33pm UTC](https://community.homey.app/t/app-pro-insights-graphs/86856/78 "2023-08-29T18:33:23Z")

</div>

Hours on graphs are not right?  
I just created one the hours are just off.

1. it starts at 18:00
2. the temperature shown in the graph at 06:00 should be around 09:00.
3. it ends at 18:00 and I ran it at 21:00. why?

 ![x](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/7/8/78717821c845dd58d17295d6fc4c1b9228734c66.png)

---

<div class="post-metadata">

**Author:** ![Menno\_van\_Hout](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/menno_van_hout/32/77843_2.png) [@Menno\_van\_Hout](https://community.homey.app/u/Menno_van_Hout)\
**Post date:** [August 29, 2023, 6:45pm UTC](https://community.homey.app/t/app-pro-insights-graphs/86856/79 "2023-08-29T18:45:47Z")

</div>

Can you share your advanced flow card?

---

<div class="post-metadata">

**Author:** ![RonnyW](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ronnyw/32/10879_2.png) [@RonnyW](https://community.homey.app/u/RonnyW)\
**Post date:** [August 29, 2023, 6:57pm UTC](https://community.homey.app/t/app-pro-insights-graphs/86856/80 "2023-08-29T18:57:19Z")

</div>

What’s your timezone? Perhaps the insigths/chart is using Homeys internal timestamps (UTC)?

---

<div class="post-metadata">

**Author:** ![Valentin\_Ciopei](https://avatars.discourse-cdn.com/v4/letter/v/6bbea6/32.png) [@Valentin\_Ciopei](https://community.homey.app/u/Valentin_Ciopei)\
**Post date:** [August 29, 2023, 6:57pm UTC](https://community.homey.app/t/app-pro-insights-graphs/86856/81 "2023-08-29T18:57:42Z")

</div>

here it is

 ![Screenshot 2023-08-29 at 21.56.25](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/2/4/24b6766aa6ae3fb9e7afabfc77e45b68c86b14e0.png)

[Previous page](https://community.homey.app/t/app-pro-insights-graphs/86856.md?page=3)

[Next page](https://community.homey.app/t/app-pro-insights-graphs/86856.md?page=5)
