Ahh will try this tonight! Thanks for making this app
Good option @Menno_van_Hout, also double lines.
Yes this is possible I collect them within the autocomplete of sensors. I can just add the data! Good idea!!!
Double lines is probably not coming anytime soon…
I experimented a bit further to get gradients working. Unfortunately it doesn’t seem to work with chart-to-image
. But the developer recommended 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.
Only that one isn’t internet independent?
Sure, Insights Trends Reloaded is open source.
/**
* 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)
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 },
...
]
}
Edit: FYI this is my configuration.
I’m afraid that I misinterpreted the way chartjs-to-image
works. In the background it still seems to outsource 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.
No, you are right. quickchart-js
is also local.
Or write it to disk:
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.
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.
I don’t get it to work, any idea? @Menno_van_Hout
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?
Only the time windows that you can choose in Homey her Insights is supported by our app.
Thanks and @spkesDE I will change the used package and add a gradient!
Which homey do you have? an early 2023?
Yes, running the 2023 Homey What is this error code all about?
@Menno_van_Hout
Hours on graphs are not right?
I just created one the hours are just off.
- it starts at 18:00
- the temperature shown in the graph at 06:00 should be around 09:00.
- it ends at 18:00 and I ran it at 21:00. why?
Can you share your advanced flow card?
What’s your timezone? Perhaps the insigths/chart is using Homeys internal timestamps (UTC)?