NEWS
[SOLVED]Log wird von JS Script mit Meldungen geflutet
-
Hallo,
ich habe aus den Untiefen des Netz, ein Script für die Anzeige der Down- Upload Raten der Fritzbox per tr-064.0 gefunden.
Soweit so gut. nur bekomme ich nun unendlich viele Datensätze im Log. ..tr-064.0 2024-06-23 14:24:06.051 info {"NewTotalNumberSyncGroups":"1","NewSyncGroupName":"sync_dsl","NewSyncGroupMode":"VDSL","Newmax_ds":"12824625","Newmax_us":"2548125","Newds_current_bps":"1931,7314,3687,2444,2310,2240,3820,13875,14857,23439,54834,12543,8688,4796,3960,1226,497,896,2353,784","Newmc_current_bps":"0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0","Newus_current_bps":"1118,3251,2627,2594,2452,2346,4321,17131,12809,8726,19851,39991,2352,3258,4737,1113,653,894,1161,965","Newprio_realtime_bps":"709,1540,684,181,890,2050,3674,15481,11139,5726,9817,37168,2040,2249,2716,442,192,273,965,843","Newprio_high_bps":"93,320,95,211,113,227,181,671,493,392,264,325,129,208,163,270,95,228,53,0","Newprio_default_bps":"316,1391,1848,2202,1449,69,466,979,1177,2608,9770,2498,183,801,1858,401,366,393,143,122","Newprio_low_bps":"0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0"} tr-064.0 2024-06-23 14:24:00.209 info {"NewTotalNumberSyncGroups":"1","NewSyncGroupName":"sync_dsl","NewSyncGroupMode":"VDSL","Newmax_ds":"12824625","Newmax_us":"2548125","Newds_current_bps":"3687,2444,2310,2240,3820,13875,14857,23439,54834,12543,8688,4796,3960,1226,497,896,2353,784,5180,2053","Newmc_current_bps":"0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0","Newus_current_bps":"2627,2594,2452,2346,4321,17131,12809,8726,19851,39991,2352,3258,4737,1113,653,894,1161,965,3943,2290","Newprio_realtime_bps":"684,181,890,2050,3674,15481,11139,5726,9817,37168,2040,2249,2716,442,192,273,965,843,2564,2175","Newprio_high_bps":"95,211,113,227,181,671,493,392,264,325,129,208,163,270,95,228,53,0,58,0","Newprio_default_bps":"1848,2202,1449,69,466,979,1177,2608,9770,2498,183,801,1858,401,366,393,143,122,1321,115","Newprio_low_bps":"0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0"}
Wie kann ich den Code ändern, ohne den ganzen Adapter auf debug zu stellen?
const NewByteReceiveRate = '0_userdata.0.Devices.FritzBox.NewByteReceiveRate'; const NewByteSendRate = '0_userdata.0.Devices.FritzBox.NewByteSendRate'; const L1DownMaxRate = '0_userdata.0.Devices.FritzBox.Layer1DownstreamMaxBitRate'; const L1UpMaxRate = '0_userdata.0.Devices.FritzBox.Layer1UpstreamMaxBitRate'; const ReceiveR = '0_userdata.0.Devices.FritzBox.Charts.Receive'; const SendR = '0_userdata.0.Devices.FritzBox.Charts.Send'; createState(NewByteReceiveRate, 0, {type: 'number', read: true, write: true}); createState(NewByteSendRate, 0, {type: 'number', read: true, write: true}); createState(L1DownMaxRate, 0, {type: 'number', read: true, write: true}); createState(L1UpMaxRate, 0, {type: 'number', read: true, write: true}); createState(ReceiveR, 0, {type: 'number', unit: 'MBit/s', read: true, write: true}); createState(SendR, 0, {type: 'number', unit: 'MBit/s', read: true, write: true}); schedule('*/6 * * * * *', function Aktualisierung() { setState('tr-064.0.states.command', '{"service": "urn:dslforum-org:service:WANCommonInterfaceConfig:1","action": "X_AVM-DE_GetOnlineMonitor","params": {"NewSyncGroupIndex": 0}}'); var value=getState('tr-064.0.states.commandResult').val; if (value.indexOf('NewTotalNumber') == 2) { var obj = JSON.parse(value); var DownStream = obj.Newds_current_bps; var UpStream = obj.Newus_current_bps; var ds = DownStream.split(","); var us = UpStream.split(","); var wds = ds[0]; var wus = us[0]; setState(NewByteReceiveRate, wds*1); setState(NewByteSendRate, wus*1); setState(ReceiveR, Math.round((wds*0.000008)*100)/100); setState(SendR, Math.round((wus*0.000008)*100)/100); setState(L1DownMaxRate, obj.Newmax_ds*8); setState(L1UpMaxRate, obj.Newmax_us*8); } });
Gruß Mario
-
@marios774 du musst die Log-Stufe vom TR-064 auf Error setzen. Bei "Info" ist das ja auch kein Wunder.
Ro75.
-
@marios774 sagte: Wie kann ich den Code ändern, ohne den ganzen Adapter auf debug zu stellen?
Gar nicht, denn die Logs kommen aus dem tr-064 Adapter. Stelle die Instanz "tr-064.0" auf Log-Stufe "warn".
-
Ich dachte es gäbe eine andere Möglichkeit...
Danke für die Info.