I have two provisions, the first one update some params and add a tag:
const now = Date.now()
declare(
'VirtualParameters.bytesReceived',
{ value: now },
)
const wait = ext('getTimestamp', 'getTimestamp', JSON.stringify({ now }))
declare(
'InternetGatewayDevice.WANDevice.1.WANCommonInterfaceConfig.TotalBytesReceived',
{path: now},
)
declare('Tags.Updated', null, {value: true})
log('Atualização finalizada')
After this, I have other that collect the values and do some math.
The question is: the values are just updated after both provisions end, but I read that there’s a implicit commit() at end of each provision, so, why the values are not updated before the second provisions starts?
This is not refresh the value from the router. {value: 1} means if there is currently a value in the mongo db for the param requested, use that. You need to use {value: Date.now()} to refresh the value.
What are you trying to do with this line? I don’t see it used anywhere in your provision script.
Actually I do like this in the firts provision, the second it’s just to get the values already updated, but, as I said, the parameter is just updated before two provisions end, so,the value I get is not a updated value.
About
const wait = ext('getTimestamp', 'getTimestamp', JSON.stringify({ now }))
It’s an external function to wait 2 seconds. My idea is use that to get traffic in real time, got it?
Another option is to get the stats directly from the access controller. I poll our access controller once per second and then I graph this data in our subscriber management system. Blue dashed line is the max download speed. Orange dashed line is max upload speed. They are offset from each other so we customers have a symmetrical connection, you can still see both lines. See screenshot 2.