It is currently May 6th, 2024, 3:02 pm

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

Get help with creating, editing & fixing problems with skins
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'll be here for two shows a night folks! Be sure to tip your waitress and drive safely!
User avatar
bobgrosh
Posts: 134
Joined: May 1st, 2011, 10:33 pm

Re: Almost there

Post by bobgrosh »

My only problem is the long update period.
If I take a phone off the hook it takes about 30 seconds to show the change in the skin.
The change is instant when I view the page in chrome.
Cable-PhonePreview.png
Code for the phone skin:

Code: Select all

[Rainmeter]
Author=Bob Grosh
AppVersion=1003000
DynamicWindowSize=1
update=100
MouseActionCursor=0
MiddleMouseDownAction=!RainmeterDeactivateConfig
BackgroundMode=1

[Metadata]
Name=System
Description=Shows your Cable Modem Status. 
Instructions=Click on the icon to open the Thomson web interface.
Manual=http://homepage.ntlworld.com/robin.d.h.walker/cmtips/signal.html#caution
Version=1.3.0
License=Creative Commons BY-NC-SA 3.0

[Variables]
skin.Style=Horizontal
@Include=#ROOTCONFIGPATH#SETTINGS\Variables.inc
skin.Width=#width.System#


;  S T Y L E S

@Include2=#ROOTCONFIGPATH#SETTINGS\Style#skin.Style#.inc


;  M E A S U R E S

[MeasureModem]
Measure=Plugin
Plugin=Plugins\WebParser.dll
;URL=file://#CURRENTPATH#cable.html
URL=http://192.168.100.1/CmState.htm

RegExp="(?siU)Line 1 State.*<td>(.*)</td>.*Line 2 State.*<td>(.*)</td>"

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

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



;  M E T E R S 


[Icon]
Meter=IMAGE
MeterStyle=sIcon
ImageName=Phone.png
ToolTipText="Open Thompson Admin Page"
LeftMouseUpAction=!Execute ["http://192.168.100.1"]
MouseActionCursor=1

[Line]
Meter=IMAGE
MeterStyle=sLine

[Title]
Meter=STRING
MeterStyle=sTitle
Text=Phone Status


;  P H O N E   L I N E   O N E   S T A T U S 

[L1Left]
Meter=STRING
MeterStyle=sTextL
Y=#h.Item#
Text="Line 1"

[L1Right]
Meter=STRING
MeterStyle=sTextR
MeasureName=MeasureL1Stat
Text="%1"
Percentual=1

[L1Bar]
Meter=BAR
MeterStyle=sSeperator
MeasureName=MeasureL1Stat


;  P H O N E   L I N E   T W O   S T A T U S 

[L2Left]
Meter=STRING
MeterStyle=sTextL
Y=2r
Text="Line 2"

[L2Right]
Meter=STRING
MeterStyle=sTextR
MeasureName=MeasureL2Stat
Text="%1"
Percentual=1

[L2Bar]
Meter=BAR
MeterStyle=sSeperator
MeasureName=MeasureL2Stat

Code for the Cable Modem internet status

Code: Select all

[Rainmeter]
Author=Bob Grosh
AppVersion=1003000
DynamicWindowSize=1
update=100
MouseActionCursor=0
MiddleMouseDownAction=!RainmeterDeactivateConfig
BackgroundMode=1

[Metadata]
Name=System
Description=Shows your Cable Modem Status. 
Instructions=Click on the icon to open the Thomson web interface.
Manual=http://homepage.ntlworld.com/robin.d.h.walker/cmtips/signal.html#caution
Version=1.3.0
License=Creative Commons BY-NC-SA 3.0

[Variables]
skin.Style=Horizontal
@Include=#ROOTCONFIGPATH#SETTINGS\Variables.inc
skin.Width=#width.System#


;  S T Y L E S

@Include2=#ROOTCONFIGPATH#SETTINGS\Style#skin.Style#.inc


;  M E A S U R E S

[MeasureModem]
Measure=Plugin
Plugin=Plugins\WebParser.dll
;URL=file://#CURRENTPATH#cable.html
URL=http://192.168.100.1/BasicLan.htm

RegExp="(?siU)<b>Downstream.*Frequency.*<td>(.*)</td>.*Power.*<td>(.*)</td>.*Signal to Noise Ratio.*<td>(.*)</td>.*<b>Upstream.*Frequency.*<td>(.*)</td>.*Power.*<td>(.*)</td>.*uptime.*<td>(.*)</td>.*CM.*<td>(.*)</td>"

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

[MeasureDownPower]
Measure=Plugin
Plugin=Plugins\WebParser.dll
URL=[MeasureModem]
StringIndex=2
minvalue=-3
maxvalue=3

[MeasureDownStNR]
Measure=Plugin
Plugin=Plugins\WebParser.dll
URL=[MeasureModem]
StringIndex=3
minvalue=0
maxvalue=100

[MeasureUpFreq]
Measure=Plugin
Plugin=Plugins\WebParser.dll
URL=[MeasureModem]
StringIndex=4

[MeasureUpPower]
Measure=Plugin
Plugin=Plugins\WebParser.dll
URL=[MeasureModem]
StringIndex=5
minvalue=0
maxvalue=60

[MeasureUpTime]
Measure=Plugin
Plugin=Plugins\WebParser.dll
URL=[MeasureModem]
StringIndex=6

[MeasurePhoneSystem]
Measure=Plugin
Plugin=Plugins\WebParser.dll
URL=[MeasureModem]
StringIndex=7


;  M E T E R S 


[Icon]
Meter=IMAGE
MeterStyle=sIcon
ImageName=RCAMODEM.png
ToolTipText="Open Thompson Admin Page"
LeftMouseUpAction=!Execute ["http://192.168.100.1"]
MouseActionCursor=1

[Line]
Meter=IMAGE
MeterStyle=sLine

[Title]
Meter=STRING
MeterStyle=sTitle
Text=Cable Modem

[Subtitle]
Meter=STRING
MeterStyle=sSubtitle
MeasureName=MeasureUpTime


;  SIGNAL TO NOISE RATIO

[SNRLeft]
Meter=STRING
MeterStyle=sTextL
Y=#h.Item#
Text="Signal to Noise Ratio"

[SNRRight]
Meter=STRING
MeterStyle=sTextR
MeasureName=MeasureDownStNR
Text="%1"
Percentual=1

[SNRUBar]
Meter=BAR
MeterStyle=sSeperator
MeasureName=MeasureDownStNR


;  U P S T R E A M   P O W E R 

[PwrULeft]
Meter=STRING
MeterStyle=sTextL
Y=2r
Text="Upstream Power"

[PwrURight]
Meter=STRING
MeterStyle=sTextR
MeasureName=MeasureUpPower
Text="%1"
Percentual=1

[PwrUBar]
Meter=BAR
MeterStyle=sSeperator
MeasureName=MeasureUpPower

;  D O W N S T R E A M   P O W E R 

[PwrDLeft]
Meter=STRING
MeterStyle=sTextL
Y=2r
Text="Downstream Power"

[PwrDRight]
Meter=STRING
MeterStyle=sTextR
MeasureName=MeasureDownPower
Text="%1"
Percentual=1

[PwrDBar]
Meter=BAR
MeterStyle=sSeperator
MeasureName=MeasureDownPower

(Note: I am using the variables and styles from Gnometer, For now, just copy them into the same directory as the skin and these skins will match the system skin width and style.)
You do not have the required permissions to view the files attached to this post.
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 »

Two things to do:

1) Set ForceReload=1 on [MeasureModem]. If WebParser does not "detect" a change in a website when it hits it, it will use a cached version. This can very often cause a lag of a cycle or three before a fresh copy is retrieved on some sites. This is for instance true of the RSS feed for these very forums. I need to use that setting or deleting a post does not effect the feed for some time, while adding a new post is there instantly. Not sure why that is, but ForceReload fixes it.

2) Set an UpdateRate= to what you want on [MeasureModem]. Unlike the default of 1 for UpdateDivider= used on most measures, UpdateRate= on WebParser defaults to 600 if you do not explicitly set it. This was done to prevent Rainmeter accidentally causing DoS attacks on sites. As a caveat, I DO NOT recommend a skin with an Update of 100 have an UpdateRate of 1 or something on a WebParser measure hitting a modem / router and asking it to do a self-check and produce a page of HTML. You WILL cripple the performance of your own system if you are not reasonable about the snappiness of the skin.
User avatar
bobgrosh
Posts: 134
Joined: May 1st, 2011, 10:33 pm

Re: trying to parse the cable company's modem

Post by bobgrosh »

Thanks JS

That worked
I settled on once per second,
I have a gigabit Ethernet here and it doesn't seem to impact the network. The phone HTML page is rather short.

One or two seconds is about all the delay I could tolerate.

I also added the win 7 audio plugin stuff and got my PC speakers to mute when I pick up the phone and un-mute when I hang up.

That was really the whole point of parsing the modem pages. I really can't have the studio monitor speakers blaring when I take a phone call. Any Radio station DJ knows why.

Not sure why I had so much trouble figuring this skin out, but, once I got turned on to RainRegExp utility it got much easier. Great little utility!

My only regret is that the RCA modem provided by Comcast does not have any access to things like the voice mail, call history, or even caller ID.

Thanks to Rainmeter I'll never again have to search for that little speaker icon while fumbling to answer the phone.

Later
Bob

PS

LOL, I just realized, I used a 3,000.00 computer to accomplish what my dad did with a $2.00 relay fifty years ago.