Is this possible? Store data from Asus Router ajax .asp page for Temperature data.
-
Yes, that's fine.
-
OK. So your pattern isn't matching, it seems is actually the problem. You may have some special characters or strange spacing in your pattern that I cannot see in the screen shots. There could also be a tab or other non-space character that looks like a space coming back in the shell command output.
Try using this expression for
RouterMemoryFree
:match( RouterMemoryResponse, "Mem: (\\d+) (\\d+) (\\d+)", 3 )
-
-
OK. Try changing all of the spaces to
\\s*
like this:match( RouterMemoryResponse, "Mem:\\s*(\\d+)\\s*(\\d+)\\s*(\\d+)", 3 )
-
OK. Try changing all of the spaces to
\\s*
like this:match( RouterMemoryResponse, "Mem:\\s*(\\d+)\\s*(\\d+)\\s*(\\d+)", 3 )
@toggledbits That seems to work.
-
OK. So your router must be returning some space-looking character that isn't space in the string somewhere. That's fine... the
\\s
means match anything that looks like a space. That's your path forward. -
If you are only going to push them out in the same Reaction to other places, that's fine. You don't be able to use them in conditions, though.
-
Oh... wait though... rule-based expressions evaluate a bit differently from global.
As global expressions, when "Response" changes, it triggers an immediate update/re-evaluation of
Free
andUsed
, as was happening in our troubleshooting.When you move them to rule-based however, expressions in rules are only evaluated when the rule's trigger conditions are checked. That means the interval will cause
Response
to get fetched and updated, butFree
andUsed
as local variables will not be updated immediately after... they will not update until the next time the interval triggers an evaluation of the rule, so each response will not have its new values posted until the interval period lapses. Do you understand what I'm on about here? I think you should be able to observe this behavior in the rule status. -
Sure, use it just like you've shown. As long as there is not a local variable with the same name, it will find/choose the global variable.
-
Also FYI, I fixed the initialization so a function like
match()
returning a null initial result won't leave the "not yet evaluated" message stuck in the display, even though it has actually been evaluated. Next build. -
I am confused now. I deleted the local expressions in the rule. I then created the global ones again. When I run the actions of the rule e.g. run the shell command and populate the "RouterMemoryResponse" Global expression that works OK.
However the other two global expressions were not automatically evaluated.
I pressed the play button on one and that is why that one has a value now. but the other one does not have a value.
Running the rules actions again and its the same.
Looking in a test trigger in a rule the value is null for "RouterMemoryUsed".
So I am still not convinced these global expressions are auto evaluating.
EDIT: Ignore this I forgot to restart MSR, seems I have to do that first ?
Now when I run the rules actions all three Global Expressions flash green.
-
I am confused now. I deleted the local expressions in the rule. I then created the global ones again. When I run the actions of the rule e.g. run the shell command and populate the "RouterMemoryResponse" Global expression that works OK.
However the other two global expressions were not automatically evaluated.
I pressed the play button on one and that is why that one has a value now. but the other one does not have a value.
Running the rules actions again and its the same.
Looking in a test trigger in a rule the value is null for "RouterMemoryUsed".
So I am still not convinced these global expressions are auto evaluating.
EDIT: Ignore this I forgot to restart MSR, seems I have to do that first ?
Now when I run the rules actions all three Global Expressions flash green.
@cw-kid said in Is this possible? Store data from Asus Router ajax .asp page for Temperature data.:
EDIT: Ignore this I forgot to restart MSR, seems I have to do that first ?
Yes, this is a current limitation. I'm trying to invent a way to fix this elegantly. The expression parser is a separate module that doesn't have quite enough smarts for the way MSR needs to use it, so MSR needs one pass over the variables to figure out what the dependencies are (the expression parser can't tell it up front). It's on my list.
-
@cw-kid said in Is this possible? Store data from Asus Router ajax .asp page for Temperature data.:
EDIT: Ignore this I forgot to restart MSR, seems I have to do that first ?
Yes, this is a current limitation. I'm trying to invent a way to fix this elegantly. The expression parser is a separate module that doesn't have quite enough smarts for the way MSR needs to use it, so MSR needs one pass over the variables to figure out what the dependencies are (the expression parser can't tell it up front). It's on my list.
@toggledbits OK great. I think I have everything setup and working now. I also made all the Router Temperature expressions just Global ones, I was using a mixture of global and also local as I didn't realise I could use global expression values in the action with the $ wild card thing.
I will monitor my setup but I think its all working now.
Thank you.