'14664688782849' 'pdl' STORE
'wxY1EMjOd7w8E9__Br7NFheX3bfIlTx.g1AN2kUwMBymFJW3y2NLH7uoQqk5uLDlRxWAySz45rEDTQgT9NBBCYtPyh_KujzrSwGDe6T5OEsZct.XTgsDby9ouOAdXaTa'
'token' STORE
[ $token 'enedis.linky' { 'pdl' $pdl } NOW 365 d ] FETCH '1y' STORE
$1y NOW 30 d TIMECLIP '30d' STORE
$30d 0 GET LASTTICK 'lasttick' STORE
$30d $lasttick ATTICK 0 GET REVERSE 0 GET 'lastvalue' STORE
$30d $lasttick 24 h TIMECLIP '24h' STORE
{
'title' 'Linky'
'description' 'Personal electric consumption'
'options' { 'scheme' 'CHARTANA' }
'tiles' [
{
'title' '1 year average'
'x' 2 'y' 0 'w' 2 'h' 1
'type' 'display' 'unit' 'kW'
'data' $1y 'gts' STORE
[ $gts bucketizer.mean 0 0 1 ] BUCKETIZE 0 GET 'gts' STORE
$gts VALUES 0 GET 1000.0 / 1000.0 * ROUND 1000.0 /
}
{
'title' 'Last known consumption'
'x' 4 'y' 0 'w' 2 'h' 1
'type' 'display' 'unit' 'kW'
'data' $lastvalue 1000.0 / 1000.0 * ROUND 1000.0 /
}
{
'title' 'Max 1 month'
'x' 10 'y' 2 'w' 2 'h' 1
'type' 'display' 'unit' 'kW'
'data' [ $30d bucketizer.max 0 0 1 ] BUCKETIZE 0 GET 'gts' STORE
$gts VALUES 0 GET 1000.0 / 1000.0 * ROUND 1000.0 / 'data' STORE
$gts LABELS 'subscribed' GET 'subscribed' STORE
{
'data' $data
'globalParams' {
'bgColor' <% $data $subscribed TODOUBLE <= %> <% '#32cb0099' %> <% '#ff616f99' %> IFTE
'fontColor' '#ffffff'
}
}
}
{
'title' 'Last sync date'
'x' 0 'y' 0 'w' 2 'h' 1
'type' 'display'
'data' { 'data' $lasttick 'globalParams' { 'timeMode' 'duration' } }
}
{
'title' 'Last 24h of data '
'x' 6 'y' 0 'w' 4 'h' 1
'type' 'bar'
'data' [ $24h bucketizer.max 0 1 h 0 ] BUCKETIZE
}
{
'title' 'Week forecast'
'x' 6 'y' 3 'w' 6 'h' 2
'type' 'area'
'endpoint' 'https://sandbox.senx.io/api/v0/exec'
'macro' <%
// Variables
'14664688782849' 'mypdl' STORE
'wxY1EMjOd7w8E9__Br7NFheX3bfIlTx.g1AN2kUwMBymFJW3y2NLH7uoQqk5uLDlRxWAySz45rEDTQgT9NBBCYtPyh_KujzrSwGDe6T5OEsZct.XTgsDby9ouOAdXaTa' 'token' STORE
NOW ->TSELEMENTS [ 0 2 ] SUBLIST TSELEMENTS-> 'now' STORE
<'
NOW ->TSELEMENTS [ 0 2 ] SUBLIST TSELEMENTS-> 'now' STORE
[ '{{token}}' 'enedis.linky' { 'pdl' '{{pdl}}' } $now 365 d - ISO8601 $now ISO8601 ] FETCH
[ SWAP bucketizer.max 0 1 h 0 ] BUCKETIZE INTERPOLATE 'conso' STORE
$conso 0 GET SNAPSHOT
'>
{
'token' $token
'pdl' $mypdl
} TEMPLATE
'https://warp.senx.io/api/v0/exec'
'REXEC' EVAL EVAL 'gts' STORE [
$gts $now 15 d TIMECLIP SORT
$gts 12 7 * 'SEARCH.SARIMA' EVAL 24 7 * 'FORECAST' EVAL 'forecast' RENAME
] 'data' STORE
{ 'data' $data 'params' [ { } { 'type' 'line' 'datasetColor' '#ef5350' } ] }
%>
}
{
'title' 'Last year evolution'
'x' 3 'y' 3 'w' 3 'h' 2
'type' 'area'
'data' [ [ $1y bucketizer.max 0 1 d 0 ] BUCKETIZE 0 GET 0 INTEGRATE ]
}
{
'title' 'Last month evolution'
'x' 0 'y' 3 'w' 3 'h' 2
'type' 'area'
'data' [ [ $30d bucketizer.max 0 1 d 0 ] BUCKETIZE 0 GET 0 INTEGRATE ]
}
{
'title' 'Last month consumption'
'x' 0 'y' 1 'w' 5 'h' 2
'type' 'line'
'data' [ $30d bucketizer.max NOW 3 h 0 ] BUCKETIZE 0 GET 'conso' STORE
$conso LABELS 'subscribed' GET TOLONG 1000 * 'subscribed' STORE
$conso TICKLIST REVERSE 0 GET 'first' STORE
$conso LASTTICK 'last' STORE
NEWGTS 'subscribed' RENAME 'psGTS' STORE
$conso
$psGTS $first NaN NaN NaN $subscribed ADDVALUE DROP
$psGTS $last NaN NaN NaN $subscribed ADDVALUE
2 ->LIST 'data' STORE
{ 'data' [ $data ] 'params' [ { 'type' 'area' } { 'datasetColor' '#ef5350' } ] }
}
{
'title' 'Last year consumption'
'x' 5 'y' 1 'w' 5 'h' 2
'type' 'line'
'data' [ $1y bucketizer.max NOW 1 d 0 ] BUCKETIZE 0 GET 'conso' STORE
$conso LABELS 'subscribed' GET TOLONG 1000 * 'subscribed' STORE
$conso TICKLIST REVERSE 0 GET 'first' STORE
$conso LASTTICK 'last' STORE
NEWGTS 'subscribed' RENAME 'psGTS' STORE
$conso
$psGTS $first NaN NaN NaN $subscribed ADDVALUE DROP
$psGTS $last NaN NaN NaN $subscribed ADDVALUE
2 ->LIST 'data' STORE
{ 'data' [ $data ] 'params' [ { 'type' 'area' } { 'datasetColor' '#ef5350' } ] }
}
{
'title' 'Max in 1 year'
'x' 10 'y' 1 'w' 2 'h' 1
'type' 'display' 'unit' 'kW'
'data' [ $1y bucketizer.max 0 0 1 ] BUCKETIZE 0 GET 'gts' STORE
$gts VALUES 0 GET 1000.0 / 1000.0 * ROUND 1000.0 / 'data' STORE
$gts LABELS 'subscribed' GET 'subscribed' STORE
{
'data' $data
'globalParams' {
'bgColor' <% $data $subscribed TODOUBLE <= %> <% '#32cb0099' %> <% '#ff616f99' %> IFTE
'fontColor' '#ffffff'
}
}
}
{
'title' 'Max in 24 h'
'x' 10 'y' 0 'w' 2 'h' 1
'type' 'display' 'unit' 'kW'
'data' [ $24h bucketizer.max 0 0 1 ] BUCKETIZE 0 GET 'gts' STORE
$gts VALUES 0 GET 1000.0 / 1000.0 * ROUND 1000.0 / 'data' STORE
$gts LABELS 'subscribed' GET 'subscribed' STORE
{
'data' $data
'globalParams' {
'bgColor' <% $data $subscribed TODOUBLE <= %> <% '#32cb0099' %> <% '#ff616f99' %> IFTE
'fontColor' '#ffffff'
}
}
}
]
}