Is this possible? Store data from Asus Router ajax .asp page for Temperature data.
-
And the rule?
-
OK. In
RouterMemoryFree
expression remove all of the(\\d+)
strings so that the middle/second argument tomatch()
is just"Mem:"
by itself (no spaces or other data). Restart and hard refresh. Then re-check. -
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.