juhu
so funktioniert es jetzt
var id = "s7.0.DBs.DB100.Aussentemp";
//var maxid = 'javascript.0.Statistik.Luft1.Max24';
//var minid = 'javascript.0.Statistik.Luft1.Min24';
var maxid = "javascript.0.scriptEnabled.common.minmax.Statistik.Aussentemp.max24";/*max24*/
var minid = "javascript.0.scriptEnabled.common.minmax.Statistik.Aussentemp.min24";/*min24*/
var dt = 24;//Zeitraum in Stunden
dt = dt*3600*1000;
schedule("*/5 * * * *", function(){SQLAbfrage(id);});
SQLAbfrage(id);
// minimum
function minimum(result)
{
log('Fn Min'+JSON.stringify(result.result));
setState(minid, result.result[0].MinVal);
}
// maximum
function maximum(result)
{
log('Fn Max'+ JSON.stringify(result.result));
setState(maxid, result.result[0].MaxVal);
}
function SQLAbfrage ()
{
log('Name: '+id);
sendTo('sql.0', 'query', 'SELECT * FROM iobroker.datapoints WHERE name = \'' + id + '\'', GetResults);
}
function GetResults (dpoint)
{
var end_time = new Date().getTime();
var start_time = new Date().getTime() - dt;
log('startzeit: '+start_time);
log('endzeit: '+end_time);
log(JSON.stringify(dpoint.result));
log('id: '+dpoint.result[0].name);
//log(JSON.stringify(dpoint.result)+'//'+start_time);
//log(dpoint.result[0].id + '---//---' + dpoint.result[0].name);
sendTo('sql.0', 'query', 'SELECT Round(Min(val),1) As MinVal FROM iobroker.ts_number WHERE ts >= ' + start_time + ' AND id=' + dpoint.result[0].id + ' GROUP BY id',minimum);
sendTo('sql.0', 'query', 'SELECT Round(Max(val),1) As MaxVal FROM iobroker.ts_number WHERE ts >= ' + start_time + ' AND id=' + dpoint.result[0].id + ' GROUP BY id',maximum);
}
meldung im Log:
18:26:27.313 [info] javascript.0 Stop script script.js.common.minmax.Aussentemp
18:26:27.352 [info] javascript.0 Start javascript script.js.common.minmax.Aussentemp
18:26:27.353 [info] javascript.0 script.js.common.minmax.Aussentemp: schedule(cron=*/5 * * * *)
18:26:27.354 [info] javascript.0 script.js.common.minmax.Aussentemp: Name: s7.0.DBs.DB100.Aussentemp
18:26:27.354 [info] javascript.0 script.js.common.minmax.Aussentemp: sendTo(adapter=sql.0, cmd=query, msg="SELECT * FROM iobroker.datapoints WHERE name = 's7.0.DBs.DB100.Aussentemp'")
18:26:27.355 [info] javascript.0 script.js.common.minmax.Aussentemp: registered 0 subscriptions and 1 schedule
18:26:27.472 [info] javascript.0 script.js.common.minmax.Aussentemp: startzeit: 1514913987450
18:26:27.472 [info] javascript.0 script.js.common.minmax.Aussentemp: endzeit: 1515000387450
18:26:27.473 [info] javascript.0 script.js.common.minmax.Aussentemp: [{"id":11,"name":"s7.0.DBs.DB100.Aussentemp","type":0}]
18:26:27.474 [info] javascript.0 script.js.common.minmax.Aussentemp: id: s7.0.DBs.DB100.Aussentemp
18:26:27.475 [info] javascript.0 script.js.common.minmax.Aussentemp: sendTo(adapter=sql.0, cmd=query, msg="SELECT Round(Min(val),1) As MinVal FROM iobroker.ts_number WHERE ts >= 1514913987450 AND id=11 GROUP BY id")
18:26:27.475 [info] javascript.0 script.js.common.minmax.Aussentemp: sendTo(adapter=sql.0, cmd=query, msg="SELECT Round(Max(val),1) As MaxVal FROM iobroker.ts_number WHERE ts >= 1514913987450 AND id=11 GROUP BY id")
18:26:28.007 [info] javascript.0 script.js.common.minmax.Aussentemp: Fn Max[{"MaxVal":6.2}]
18:26:28.008 [info] javascript.0 script.js.common.minmax.Aussentemp: setForeignState(id=javascript.0.scriptEnabled.common.minmax.Statistik.Aussentemp.max24, state=6.2)
18:26:28.029 [info] javascript.0 script.js.common.minmax.Aussentemp: Fn Min[{"MinVal":1.5}]
18:26:28.030 [info] javascript.0 script.js.common.minmax.Aussentemp: setForeignState(id=javascript.0.scriptEnabled.common.minmax.Statistik.Aussentemp.min24, state=1.5)
finde keine error ausgabe, sollte also funzn
Vielen Dank bis hierhin schon mal und für die Geduld 
hab jetzt nur noch diese Fehlermeldung in der Log
:
admin.0 2018-01-03 18:26:28.047 error change ID is empty: {"common":{"enabled":1.5},"from":"system.adapter.javascript.0","ts":1515000388026,"_id":null}
cloud.0 2018-01-03 18:26:28.037 error change ID is empty: {"common":{"enabled":1.5},"from":"system.adapter.javascript.0","ts":1515000388026,"_id":null}
sql.0 2018-01-03 18:26:28.036 error change ID is empty: {"common":{"enabled":1.5},"from":"system.adapter.javascript.0","ts":1515000388026,"_id":null}
javascript.0 2018-01-03 18:26:28.035 error change ID is empty: {"common":{"enabled":1.5},"from":"system.adapter.javascript.0","ts":1515000388026,"_id":null}
web.0 2018-01-03 18:26:28.033 error change ID is empty: {"common":{"enabled":1.5},"from":"system.adapter.javascript.0","ts":1515000388026,"_id":null}
sql.0 2018-01-03 18:26:28.021 error change ID is empty: {"common":{"enabled":6.2},"from":"system.adapter.javascript.0","ts":1515000388010,"_id":null}
javascript.0 2018-01-03 18:26:28.023 error change ID is empty: {"common":{"enabled":6.2},"from":"system.adapter.javascript.0","ts":1515000388010,"_id":null}
cloud.0 2018-01-03 18:26:28.022 error change ID is empty: {"common":{"enabled":6.2},"from":"system.adapter.javascript.0","ts":1515000388010,"_id":null}
web.0 2018-01-03 18:26:28.018 error change ID is empty: {"common":{"enabled":6.2},"from":"system.adapter.javascript.0","ts":1515000388010,"_id":null}
die Werte stehen aber im Datenpunkt

mach ich da noch etwas verkehrt
hab die error-meldungen mal in ein eigenen Thread gesetzt
http://forum.iobroker.net/viewtopic.php?f=8&t=10313