It is currently May 7th, 2024, 3:22 am

[Solved] trying to parse the cable company's modem

Get help with creating, editing & fixing problems with skins
User avatar
bobgrosh
Posts: 134
Joined: May 1st, 2011, 10:33 pm

[Solved] trying to parse the cable company's modem

Post by bobgrosh »

In chrome I can type "192.168.100.1" and get a nice report about the signal levels, frequencies, and signal to noise ratios, along with lots of other stuff.

Been having trouble since my neighbor had the cable co out.

Thought I'd make a meter to show a histogram of the key values.

this code just doesn't work.

Code: Select all

[Rainmeter]
Author=Bob Grosh
Update=1000

[Variables]
URL="http://192.168.100.1/BasicLan.htm"
FontColor=255, 255, 255, 255
FontFace=rockwell
Substitute="&":"&",""":"","&Quot;":"","<br>":"","![CDATA

[":"","]]":"","...":"","<":"",">":"","/PRE>":"","PRE>":"","<":""

;[WEBSITE MEASURES]===============================

[measureWebsite]
Measure=Plugin
Plugin=Plugins\WebParser.dll
UpdateRate=1000
Url=#URL#
;debug=1
RegExp="(?siU)<Title>(*.)</Title>"

[MeasureDownstreamPower]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[MeasureWebsite]
StringIndex=1

;[DISPLAY METERS]==================================

[MeterBackground]
Meter=IMAGE
X=1
Y=1
H=220
W=300
SolidColor=0,0,0,255

[MeterDownstreamPower]
MeasureName=MeasureDownstreamPower
Meter=STRING
X=2
Y=2
FontColor=#FontColor#
FontSize=12
StringAlign=LEFT
FontFace=#FontFace#
Antialias=1
Prefix="Downstream Power: "

Here is a text file I created by saving the web page while it was displayed in Chrome.

Code: Select all

<html>

<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252">
<link href="styles/StyleA.css" type="text/css" rel="STYLESHEET">
<script type="text/javascript" language="javascript" src="menu.js"></script>
<title>Basic Status - LAN</title>
</head>
<body>

<table border="0" cellspacing="0" width="1003" id="AutoNumber1" height="488" style="border-collapse: collapse" bordercolor="#111111" cellpadding="0">

  <TR>
    <TD width=238 valign="top">
        <TABLE WIDTH=238 BORDER=0 CELLPADDING=0 CELLSPACING=0  >
            <TR>
                <TD WIDTH="238" HEIGHT=98 COLSPAN=2 valign="top">
			        <IMG border=0 SRC="logo.jpg" ></TD>
            </TR>
            <TR>
        		<TD WIDTH="238" height="83" COLSPAN=2 valign="top">
			        <IMG border=0 SRC="u-04.jpg"></TD>
            </TR>
            <TR>
                <TD WIDTH=210 bgcolor="#dfdee2" height="420" align="right" valign="top"> 
                <br>
                    <TABLE WIDTH=180 HEIGHT=400 BORDER=0  CELLPADDING=0 CELLSPACING=0  >
                        
                        <script type="text/javascript">
                            ShowSubMenu("Basic lan", "BasicLan.htm", "1");

                            ShowSubMenu("Hardware info", "HardwareInfo.htm", "0");

                            ShowSubMenu("Event log", "EventLog_CM.htm", "0");

                            ShowSubMenu("Cm state", "CmState.htm", "0");

                        </script>
                        
                        <tr valign="bottom"><td class="footer"> &copy; - Thomson - 2007</td></tr>
                    </table>
                </TD>
        		<TD WIDTH=28 valign="top" background="u-09.jpg"><img src="u-09.jpg" width="28" height="32"></TD>
            </TR>
        </TABLE>
    </TD>

    <TD width=765 valign="top" >
        <TABLE WIDTH=765 BORDER=0 CELLPADDING=0 CELLSPACING=0  >
            <TR>
		    <TD HEIGHT=67 COLSPAN=3>
			    <IMG SRC="u-02.jpg" width="765" border=0 ></TD>
            </TR>
            <TR>
                <TD WIDTH=16 bgcolor="#dfdee2"> </TD>
       		  <TD height="31" width="720"  bgcolor="#dfdee2">
                    <TABLE WIDTH=720 height=30 BORDER=0  CELLPADDING=0 CELLSPACING=0 bordercolor="#111111" >
                        <tr>
                        <script type="text/javascript"> 
                            ShowRgMenu("Basic","BasicLan.htm","1");

                            /*
                            ShowRgMenu("Advanced_MTA","ProductDetail.htm","0");

                            */
                        </script>
                        </tr>
                    </table>
              </TD>
        		<TD width="28" height="31" >
        			<IMG border=0 SRC="u-00.jpg" WIDTH=28 HEIGHT=31></TD>
        	</TR>
            <TR>
		        <TD COLSPAN=3>
			    <IMG WIDTH=765 HEIGHT=5 border=0 SRC="u-05.jpg" ></TD>
            </TR>
            <TR>
		        <TD COLSPAN=3>
                    <TABLE WIDTH=765 BORDER=0  CELLPADDING=0 CELLSPACING=0 >
                        <TR HEIGHT=60>
                            <TD>        
                            <p> <font face="Arial" size=4 ><b>Basic Status</b> </font></p>
                            <P class="desc"><b>Basic LAN</b> </p></TD>
                        </TR>
                        <TR HEIGHT=400 align="center">
						  <TD valign="TOP" align="left" >
							  <hr >
							  <br>
                            <form action=/goform/BasicLan method=POST name="BasicLan"> 
                            <table class="light" cellspacing=0 cellpadding=2 border=1>
                                <tr><td colspan=4><b>RF Parameters</b></td></tr>
                                <tr><td colspan=4><b>Downstream</b></td></tr>
                                <tr><td><b>Frequency</b></td><td>579 MHz</td><td><b>Power</b></td><td>1 dBmV</td></tr>
                                <tr><td><b>Signal to Noise Ratio</b></td><td>39 dB</td><td><b>Modulation</b></td><td>QAM256</td></tr>
                                <tr><td colspan=4><b>Upstream</b></td></tr>
                                <tr><td><b>Frequency</b></td><td>27.900 MHz</td><td><b>Power</b></td><td>51 dBmV</td></tr>
                                <tr><td><b>Upstream Data Rate</b></td><td>5120 Ksym/sec</td><td><b>Modulation</b></td><td>QAM64</td></tr>
                            </table>
                            <br>
                            <table class="light" cellspacing=0 cellpadding=2 border=1>
                                <tr><td colspan=2><b>Status</b></td></tr>
                                <tr><td><b>System uptime</b></td><td>0 days 01h:35m:47s</td></tr>
                                <tr><td><b>Computers detected</b></td><td>1</td></tr>
                                <tr><td><b>CM Status</b></td><td>Operational</td></tr>
                                <tr><td><b>WAN Isolation</b></td><td>OFF</td></tr>
                                <tr><td><b>Time and Date</b></td><td>Fri Jun 24 13:25:14 2011
</td></tr>
                            </table>
                            <br>
                            <table class="light" cellspacing=0 cellpadding=2 border=1>
                                <tr><td colspan=4><b>Interface Parameters</b></td></tr>
                                <tr><td colspan=4><b>Interface Name :</b> <FONT face=Arial color=blue><select name="mInterfaceName" onChange="submit();"><option VALUE=0 SELECTED>LAN</option><option VALUE=1 >CABLE</option><option VALUE=3 >MTA</option></select></FONT></td></tr>
                                <tr><td><b>Provisioned</b></td><td>Enabled</td><td><b>State</b></td><td>Up</td></tr>
                                <tr><td><b>Speed</b></td><td>100 Mbps</td><td><b>MAC address</b></td><td>00-10-95-ff-ff-fe</td></tr>
                            </table>
                            <br>
                            </form>
                            </td>

						  </TR>
                  </TABLE>
                </TD>
            </TR>
      </TABLE>
    </TD>
</TR>
</TABLE>
</BODY>
</HTML>
I've studied the webparser primer here -->http://rainmeter.net/cms/Tips-WebParserPrimer

I downloaded the example, installed it and ran it. It works.

I started modifying it to pars out the download power value, but never got webparser to return any value at all.

Finally, I deleted everything except what you see above and even modified it to just get the title. It won't even get that.

There seems to be some differences in the manual, the tutorial and the example about where to put the (")s and I tried several variations but still no luck.

I know I am ( A G A I N ) doing something stupid.

Somebody give me a head slapping insight.
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: trying to parse the cable company's modem

Post by jsmorley »

I used your output sample and did this:

Code: Select all

[MeasureModem]
Measure=Plugin
Plugin=Plugins\WebParser.dll
URL=file://#CURRENTPATH#cable.html
RegExp="(?siU)<b>Downstream.*Frequency.*<td>(.*)</td>.*Power.*<td>(.*)</td>.*Signal to Noise Ratio.*<td>(.*)</td>"

[MeasureDownFreq]
Measure=Plugin
Plugin=Plugins\WebParser.dll
URL=[MeasureModem]
StringIndex=1

[MeasureDownPower]
Measure=Plugin
Plugin=Plugins\WebParser.dll
URL=[MeasureModem]
StringIndex=2

[MeasureDownStNR]
Measure=Plugin
Plugin=Plugins\WebParser.dll
URL=[MeasureModem]
StringIndex=3

[MeterDownFreg]
Meter=String
MeasureName=MeasureDownFreq
FontSize=12
FontColor=255,255,255,255
X=0
Y=2R

[MeterDownPower]
Meter=String
MeasureName=MeasureDownPower
FontSize=12
FontColor=255,255,255,255
X=0
Y=2R

[MeterDownStNR]
Meter=String
MeasureName=MeasureDownStNR
FontSize=12
FontColor=255,255,255,255
X=0
Y=2R
That gives me:
6-24-2011 5-36-00 PM.jpg
I used RainRegExp to help develop the RegExp= statement, as it makes it a lot easier to debug.
6-24-2011 5-36-20 PM.jpg
You will of course want to change the URL=file://... in mine to URL=http://192.168.100.1/BasicLan.htm, but otherwise it should work to get you started. (Note, quotes around a URL are optional, as a URL never ever has spaces in it)

P.S. Your basic problem was that you were using (*.) to get captures instead of the proper (.*) and that won't work. Let me know if that is wrong in the documentation somewhere, nothing would surprise me given how fast we knocked all that out.
You do not have the required permissions to view the files attached to this post.
User avatar
bobgrosh
Posts: 134
Joined: May 1st, 2011, 10:33 pm

Re: trying to parse the cable company's modem

Post by bobgrosh »

jsmorley wrote:I used your output sample and did this:

Code: Select all

[MeasureModem]
Measure=Plugin
Plugin=Plugins\WebParser.dll
URL=file://#CURRENTPATH#cable.html
RegExp="(?siU)<b>Downstream.*Frequency.*<td>(.*)</td>.*Power.*<td>(.*)</td>.*Signal to Noise Ratio.*<td>(.*)</td>"

[...
...
...



You will of course want to change the URL=file://... in mine to URL=http://192.168.100.1/BasicLan.htm, but otherwise it should work to get you started. (Note, quotes around a URL are optional, as a URL never ever has spaces in it)

P.S. Your basic problem was that you were using (*.) to get captures instead of the proper (.*) and that won't work. Let me know if that is wrong in the documentation somewhere, nothing would surprise me given how fast we knocked all that out.

ARRRRG!
My brain was dyslexic.
Now it is broke.

OK, I replaced my code with yours.
I copied my example to the same directory as my skin, and named it "cable.html"
I ran it and my old output disappeared, I could not find the skin output so I could refreshit.

So....
I added the line:
Prefix="Down Frequency :"
under the [MeterDownFreg] section.

Now I get the following output"
-----------------------------------------


Down Frequency:




------------------------------------------

Rainmeter/About shows it is running, has the four measures, and they are all blank.

I added Debug=1 in the [MeasureModem] section but do not see any debug files in c:\ root folder.

I must be going insane.

I downloaded the RainregExp utility and installed it.
I'll give that a try next
Stand by... If my modem stays up I'll report the results of using the utility.
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: trying to parse the cable company's modem

Post by jsmorley »

Well, I don't know, you must be zigging in a zag-only lane somewhere. If you want zip up your entire skin and attach it, I can give it a go here.

One thing you need to be careful of going forward is the matter of login / authentication to the modem. If you need to log in with a password and have a cookie set to get to that page on the modem, you won't get anything back at all, as WebParser does not support cookies or any kind of authentication other than HTML authentication by http://username:password@webite.com right on the URL line.
User avatar
bobgrosh
Posts: 134
Joined: May 1st, 2011, 10:33 pm

Re: trying to parse the cable company's modem

Post by bobgrosh »

OK so far I have determined that google chrom will display the page using any of the following in the address box:
http://192.168.100.1/BasicLan.htm
http://192.168.100.1
192.168.100.1/BasicLan.htm
192.168.100.1
Also it gives the same, but static, page using:
C:\Users\Westside\Documents\Rainmeter\Skins\CableModem\cable.htm
file://C:\Users\Westside\Documents\Rainmeter\Skins\CableModem\cable.htm

RainRegExp, does not work with all of the above.
It ONLY works with:
http://192.168.100.1/BasicLan.htm
http://192.168.100.1
C:\Users\Westside\Documents\Rainmeter\Skins\CableModem\cable.htm

The skin (as I described above, your code with an added line) does not work with any of the above url's
It does not display any values as having been parsed, except with these two formats that only partially work:
C:\Users\Westside\Documents\Rainmeter\Skins\CableModem\cable.htm
http://192.168.100.1/BasicLan.htm

For those two formats I get:

---------------------------
Down Frequency :5'


---------------------------
Which is not at all correct.

Still investigating.
May be tomorrow morning before I report back.

I hope I can figure this out without packing up a zip, Thank's for the offer, but let me try a little longer before I resort to that. I'll learn more if you give me less help.

I will pack up this skin and make a rmskin out of it. I am surprised that there aren't a BUNCH of skins out there to monitor the cable modem status. I notice that on another html page I can even tell if one of my phones is off hook. LOL

BTW. There is no authentication or cookies involved in accessing the modum.
I realize that different cable companies use lots of different modems. This one is common for a lot of Comcast customers, the modem is made by RCA.
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: trying to parse the cable company's modem

Post by jsmorley »

Ok, I'll wait to see where you get. I have to say though, that when I use the exact HTML you posted by copy/pasting it from here to a text file, it works fine, and there is no way that your Rainmeter / WebParser is going to treat a local text file different than mine, so there has to be some problem with your RegExp= statement. I would connect to the modem via RainRegExp.exe and then use both my RegExp= statement and yours in that, and see what you get.
User avatar
bobgrosh
Posts: 134
Joined: May 1st, 2011, 10:33 pm

Re: trying to parse the cable company's modem

Post by bobgrosh »

Yea, I know. It is puzzeling.

I did cut and paste your cone into a new variant ini exactly as you posted it.
I was just as convinced as you that it would work. when it didn't I cut and pasted it AGAIN! into another ini.

I am beginning to not trust this particular PC. It is a brand new HP all-in-one with an intel i3 chip set running windows 7 home premium with 6 gig ram. I have already had a couple problems just copying or renaming a file that have to be some new issue with 7.
I also had to re-install Ranimeter to fix a earlier weird problem, seems like the downloaded distribution file got corrupted. I really don't think I could have screwed up the simple copy and paste, but then again, at my age, I guess it's possible. I know that in my younger days I would have spotted the *. / .* reversal easily and never would have needed to start this post in the first place.

Getting old sucks. But, You can't imagine how much more fun it is to be alive in the age of multi-core processors unless you were working on 80 column card readers, paper tape punchers, MITS, TRS-80's and PDP-8's in your prime. I apologize for burdening you guys with my stupid mistakes. Thanks for being so understanding and patient. Maybe when you are 75 you'll understand how much it means to me that you're there helping.

Bob
The Vintage Geek
User avatar
Seahorse
Posts: 1175
Joined: June 9th, 2010, 5:56 pm
Location: Locks heath, UK

Re: trying to parse the cable company's modem

Post by Seahorse »

Finally, someone into computers that's older than me... :rofl:
"Regrettably your planet is one of those scheduled for demolition"
Mike

My Skins at DeviantArt

User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: trying to parse the cable company's modem

Post by jsmorley »

One thing to try Bob:


Put DynamicWindowSize=1 in the [Rainmeter] section of your skin.

That one output you showed with "Frequency: 5" looks to me like it might be working but cutting off the text...
User avatar
bobgrosh
Posts: 134
Joined: May 1st, 2011, 10:33 pm

Re: trying to parse the cable company's modem

Post by bobgrosh »

jsmorley wrote:...Put DynamicWindowSize=1 in the [Rainmeter] section of your skin....
OMG

I finaly got a computer that fixes itself while I sleep. :o

:thumbup: