It is currently April 19th, 2024, 4:28 pm

Rainmeter 4.5.2 Having issues with NetIn NetOut after update

Get help with creating, editing & fixing problems with skins
User avatar
Sh8dyDan
Posts: 19
Joined: August 22nd, 2021, 6:10 pm

Rainmeter 4.5.2 Having issues with NetIn NetOut after update

Post by Sh8dyDan »

Having issues with the update to 4.5.2.

NetIn and NetOut are not working correctly.

I also did a fresh install and reset statics.

4.5.0 Works great.

4.5.2 Does not report NetIn and NetOut correctly. And it appears to switch the interface index numbers. WiFi meter is displaying Ethernet NetIn stats and Ethernet is displaying Wifi NetIn stats. Totals for Wi-Fi are blank.

I've attached the skin am using. It's something I created.

In the Variables.inc file under Network you can input your index numbers for your network interfaces. See this link to find them https://forum.rainmeter.net/viewtopic.php?t=12248.

Thank you.
Dan
You do not have the required permissions to view the files attached to this post.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Rainmeter 4.5.2 Having issues with NetIn NetOut after update

Post by jsmorley »

The "index" numbers are obtained a bit differently in 4.5.2 than they were in earlier versions.

I strongly recommend that you set SysInfoData=Best on all SysInfo and NetIn/NetOut measures accessing network stuff. If you set DynamicVariables=1 on the measures, the meaning of "Best" will automatically change when you switch between ethernet and wifi.

If you really want to use the index numbers, you can get the current correct ones by opening Powershell, and pasting in:

Get-NetAdapter -Name * -IncludeHidden | format-list -property "Name", "InterfaceDescription", "InterfaceIndex"

However, I warn that those numbers can be changed by Windows at any time.
User avatar
Brian
Developer
Posts: 2679
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: Rainmeter 4.5.2 Having issues with NetIn NetOut after update

Post by Brian »

That guide is really out of date. We have since added the "Best" option for NET measures, which is probably what you want to use.
https://docs.rainmeter.net/manual/measures/net/#Interface

Also, from Rainmeter version 4.5.1 on, we also change what the "numeric" value references. Before this version, the numbered option for "Interface" referenced the position in the array of interfaces Windows returned. Now, it references the actual "interface index", which is now reported in the "debug" messages when Rainmeter starts.

You can also use the name of the interface as well.

So your "Interface" option could looks something like one of these:

Code: Select all

; The recommended way to get your "active" interface
Interface=Best

; "7" represents the "interface index", not the 7th position in the array.
Interface=7

; The name of the interface
Interface=Realtek Gaming GbE Family Controller
If you look at the "Debug" messages when Rainmeter starts, you will see new information that will help you decide. It could look like this:

Code: Select all

DBUG (23:00:47.031) :  20: Name: Realtek Gaming GbE Family Controller
DBUG (23:00:47.031) :      Alias: Ethernet
DBUG (23:00:47.031) :      GUID: {46B3CC5E-85FB-4AF8-9F42-2602C1D87C7E}
DBUG (23:00:47.031) :      Type=Ethernet(6), Hardware=Yes, Filter=No
DBUG (23:00:47.031) :      IfIndex=7, State=Connected, Status=Up(1)
So the "Interface" for this entry should be Interface=7, not "20"

I hope that clears some things up. We usually do not like to sacrifice backwards compatibility, but it did not make sense for the SysInfo measure and the NET measures to have different meanings for the same interface.

-Brian
User avatar
SilverAzide
Rainmeter Sage
Posts: 2603
Joined: March 23rd, 2015, 5:26 pm

Re: Rainmeter 4.5.2 Having issues with NetIn NetOut after update

Post by SilverAzide »

That posting, Finding your Network Interface (NIC) for Rainmeter, is from 2012 and now contains incorrect information for the current version of Rainmeter. Should it be removed/edited to note this to prevent confusion? There are probably a thousand similar posts, so maybe it is not worth fixing.
Gadgets Wiki GitHub More Gadgets...
User avatar
Sh8dyDan
Posts: 19
Joined: August 22nd, 2021, 6:10 pm

Re: Rainmeter 4.5.2 Having issues with NetIn NetOut after update

Post by Sh8dyDan »

Thanks for the reply Brian and JSMorley.

In my skin, I show both Wi-Fi and Ethernet as separate meters in the same panel.
Screenshot 2021-09-15 211451.jpg
Sh8dyStatsHWiNFO_1.1.8.rmskin

With what you told me. I adapted existing code to keep the info current if it changes within Windows.
-Measure to find Network Interfaces and store as a Variable
-Measure to find Network Interfaces Index and store as a Variable

Is this a good solution?


Also should I convert my

[MeasureSysInfo]
Measure=Plugin
Plugin=SysInfo

To the new

[MeasureSysInfo]
Measure=SysInfo

Code: Select all

[----------WAN-IP----------]

[MeasureWANIP]
Measure=WebParser
URL=http://icanhazip.com/
RegExp=(?siU)^(.*)$
StringIndex=1


[----------WiFi-Interface----------]

[MeasureWiFiInterface]
Measure=Plugin
Plugin=RunCommand
Program=powershell.exe
Parameter="-NoProfile -ExecutionPolicy Bypass -NonInteractive -Command "(Get-WmiObject -Class MSFT_NetAdapter -Filter 'InterfaceType = 71 and Virtual = False' -Namespace root\StandardCimv2 | Sort -Property InterfaceDescription | Select -First 1).InterfaceDescription""
OutputType=ANSI
State=Hide
Timeout=10000
Substitute="#CRLF#":""
IfMatch=^.+$
IfMatchAction=[!Log "Found wireless adapter: [MeasureWiFiInterface]" Notice]
FinishAction=[!SetVariable WirelessInterface [MeasureWiFiInterface]][!WriteKeyValue Variables WirelessInterface "[MeasureWiFiInterface]" "#@#Variables.inc"][!Log "Wireless interface autoconfig completed, restarting!" Notice]


[----------WiFi-Interface-Index----------]

[MeasureWiFiInterfaceIndex]
Measure=Plugin
Plugin=RunCommand
Program=powershell.exe
Parameter="-NoProfile -ExecutionPolicy Bypass -NonInteractive -Command "(Get-WmiObject -Class MSFT_NetAdapter -Filter 'InterfaceType = 71 and Virtual = False' -Namespace root\StandardCimv2 | Sort -Property InterfaceIndex | Select -First 1).InterfaceIndex""
OutputType=ANSI
State=Hide
Timeout=10000
Substitute="#CRLF#":""
IfMatch=^.+$
IfMatchAction=[!Log "Found wireless interface index: [MeasureWiFiInterfaceIndex]" Notice]
FinishAction=[!SetVariable WirelessInterfaceIndex [MeasureWiFiInterfaceIndex]][!WriteKeyValue Variables WirelessInterfaceIndex "[MeasureWiFiInterfaceIndex]" "#@#Variables.inc"][!Log "Wireless interface index autoconfig completed, restarting!" Notice]


[----------Ethernet-Interface----------]

[MeasureEthernetInterface]
Measure=Plugin
Plugin=RunCommand
Program=powershell.exe
Parameter="-NoProfile -ExecutionPolicy Bypass -NonInteractive -Command "(Get-WmiObject -Class MSFT_NetAdapter -Filter 'InterfaceType = 6 and Virtual = False' -Namespace root\StandardCimv2 | Sort -Property InterfaceDescription | Select -First 1).InterfaceDescription""
OutputType=ANSI
State=Hide
Timeout=10000
Substitute="#CRLF#":""
IfMatch=^.+$
IfMatchAction=[!Log "Found ethernet adapter: [MeasureEthernetInterface]" Notice]
FinishAction=[!SetVariable EthernetInterface [MeasureEthernetInterface]][!WriteKeyValue Variables EthernetInterface "[MeasureEthernetInterface]" "#@#Variables.inc"][!Log "Ethernet interface autoconfig completed, restarting!" Notice]


[----------Ethernet-Interface-Index----------]

[MeasureEthernetInterfaceIndex]
Measure=Plugin
Plugin=RunCommand
Program=powershell.exe
Parameter="-NoProfile -ExecutionPolicy Bypass -NonInteractive -Command "(Get-WmiObject -Class MSFT_NetAdapter -Filter 'InterfaceType = 6 and Virtual = False' -Namespace root\StandardCimv2 | Sort -Property InterfaceIndex | Select -First 1).InterfaceIndex""
OutputType=ANSI
State=Hide
Timeout=10000
Substitute="#CRLF#":""
IfMatch=^.+$
IfMatchAction=[!Log "Found ethernet interface index: [MeasureEthernetInterfaceIndex]" Notice]
FinishAction=[!SetVariable EthernetInterfaceIndex [MeasureEthernetInterfaceIndex]][!WriteKeyValue Variables EthernetInterfaceIndex "[MeasureEthernetInterfaceIndex]" "#@#Variables.inc"][!Log "Network interface index autoconfig completed, restarting!" Notice]


[----------WiFi-IP----------]

[MeasureWiFiIP]
Measure=Plugin
Plugin=SysInfo
SysInfoType=IP_ADDRESS
SysInfoData=#WirelessInterface#


[----------Ethernet-IP----------]

[MeasureEthernetIP]
Measure=Plugin
Plugin=SysInfo
SysInfoType=IP_ADDRESS
SysInfoData=#EthernetInterface#


[----------WiFi-Download-Speed----------]

[MeasureWiFiNetIn]
Measure=NetIn
Interface=#WirelessInterfaceIndex#
UseBits=1
AverageSize=3


[----------WiFi-Upload-Speed----------]

[MeasureWiFiNetOut]
Measure=NetOut
Interface=#WirelessInterfaceIndex#
UseBits=1
AverageSize=3

[----------Wi-Fi-Download-Total----------]

[MeasureWiFiNetInTotal]
Measure=NetIn
Cumulative=1
Interface=#WirelessInterfaceIndex#


[----------Wi-Fi-Upload-Total----------]

[MeasureWiFiNetOutTotal]
Measure=NetOut
Cumulative=1
Interface=#WirelessInterfaceIndex#


[----------Ethernet-Download-Speed----------]

[MeasureEthernetNetIn]
Measure=NetIn
Interface=#EthernetInterfaceIndex#
UseBits=1
AverageSize=3


[----------Ethernet-Upload-Speed----------]

[MeasureEthernetNetOut]
Measure=NetOut
Interface=#EthernetInterfaceIndex#
UseBits=1
AverageSize=3


[----------Ethernet-Download-Total----------]

[MeasureEthernetNetInTotal]
Measure=NetIn
Cumulative=1
Interface=#EthernetInterfaceIndex#


[----------Ethernet-Upload-Total----------]

[MeasureEthernetNetOutTotal]
Measure=NetOut
Cumulative=1
Interface=#EthernetInterfaceIndex#


[----------Meters----------]


[---------WAN-IP----------]

[MeterWANIP]
Meter=STRING
MeterStyle=Text | Right
Y=0r
MeasureName=MeasureWANIP
Text="%1"


[----------WiFi-IP----------]

[MeterWiFiIP]
Meter=STRING
MeterStyle=Text | Right
Y=0r
MeasureName=MeasureWiFiIP
Text="%1"


[----------Wi-Fi-Upload-Speed----------]

[MeterWiFiUp]
Meter=String
MeterStyle=Text
X=130
Y=0r
MeasureName=MeasureWiFiNetOut
NumOfDecimals=1
AutoScale=1
UseBits=1
Text=▲ %1b/s


[----------Wi-Fi-Download-Speed----------]

[MeterWiFiDown]
Meter=String
MeterStyle=Text | Right
Y=0r
MeasureName=MeasureWiFiNetIn
NumOfDecimals=1
AutoScale=1
UseBits=1
Text=▼ %1b/s


[----------WiFi-Upload-Total----------]

[MeterWiFiUpTotal]
Meter=String
MeterStyle=Text
X=130
Y=0r
MeasureName=MeasureWiFiNetOutTotal
NumOfDecimals=1
AutoScale=1
Text=▲ %1B


[----------WiFi-Download-Total----------]

[MeterWiFiDownTotal]
Meter=String
MeterStyle=Text | Right
Y=0r
MeasureName=MeasureWiFiNetInTotal
NumOfDecimals=1
AutoScale=1
Text=▼ %1B


[----------Ethernet-IP----------]

[MeterEthernetIP]
Meter=STRING
MeterStyle=Text | Right
Y=0r
MeasureName=MeasureEthernetIP
Text="%1"


[----------Ethernet-Transfer-Speed-Label----------]

[MeterEthernetTransferLabel]
Meter=String
MeterStyle=Text | Left
Y=147
Text=Speed


[----------Ethernet-Upload-Speed----------]

[MeterEthernetUp]
Meter=String
MeterStyle=Text
X=130
Y=0r
MeasureName=MeasureEthernetNetOut
NumOfDecimals=1
AutoScale=1
UseBits=1
Text=▲ %1b/s


[----------Ethernet-Download-Speed----------]

[MeterEthernetDown]
Meter=String
MeterStyle=Text | Right
Y=0r
MeasureName=MeasureEthernetNetIn
NumOfDecimals=1
AutoScale=1
UseBits=1
Text=▼ %1b/s


[----------Ethernet-Upload-Total----------]

[MeterEthernetUpTotal]
Meter=String
MeterStyle=Text
X=130
Y=0r
MeasureName=MeasureEthernetNetOutTotal
NumOfDecimals=1
AutoScale=1
Text=▲ %1B


[----------Ethernet-Download-Total----------]

[MeterEthernetDownTotal]
Meter=String
MeterStyle=Text | Right
Y=0r
MeasureName=MeasureEthernetNetInTotal
NumOfDecimals=1
AutoScale=1
Text=▼ %1B

Code: Select all

[Variables]

;----------NETWORK----------

WirelessInterface=Intel(R) Wi-Fi 6 AX201 160MHz
WirelessInterfaceIndex=20
EthernetInterface=Realtek PCIe 2.5GbE Family Controller
EthernetInterfaceIndex=12
You do not have the required permissions to view the files attached to this post.
User avatar
SilverAzide
Rainmeter Sage
Posts: 2603
Joined: March 23rd, 2015, 5:26 pm

Re: Rainmeter 4.5.2 Having issues with NetIn NetOut after update

Post by SilverAzide »

Sh8dyDan wrote: September 16th, 2021, 1:31 am With what you told me. I adapted existing code to keep the info current if it changes within Windows.
-Measure to find Network Interfaces and store as a Variable
-Measure to find Network Interfaces Index and store as a Variable

Is this a good solution?
Not exactly. There is a much simpler solution. Since you are already grabbing the interface adapter's NAME, don't bother with the interface INDEX anymore. It is completely unnecessary. You can use the name in every place you would use the index, so there is no need for both. As a bonus, the name is valid for as long as that adapter is present in your machine, whereas the indexes change all the time and at the drop of a hat, so they are highly unreliable. I'd recommend never using them.
Gadgets Wiki GitHub More Gadgets...
User avatar
SilverAzide
Rainmeter Sage
Posts: 2603
Joined: March 23rd, 2015, 5:26 pm

Re: Rainmeter 4.5.2 Having issues with NetIn NetOut after update

Post by SilverAzide »

Sh8dyDan wrote: September 16th, 2021, 1:31 am
Also, you have a logic flaw in your PowerShell commands. Your code to grab the adapter name grabs all adapters of a particular type, sorts them by name, then grabs the first one in the list. Your code to grab the adapter index grabs all adapters of a particular type, sorts them by index, then grabs the first. That can easily cause the adapter with a particular name to be mismatched with its index if you have more than one adapter of a particular type. For better results, you should sort the lists using the same order; for even better results, you should use a single PS command to grab both values along with a WebParser to parse them so you don't need two commands; and for the best results of all, ditch the whole index thing and just use names.
:)
Gadgets Wiki GitHub More Gadgets...
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Rainmeter 4.5.2 Having issues with NetIn NetOut after update

Post by jsmorley »

SilverAzide wrote: September 16th, 2021, 12:47 am That posting, Finding your Network Interface (NIC) for Rainmeter, is from 2012 and now contains incorrect information for the current version of Rainmeter. Should it be removed/edited to note this to prevent confusion? There are probably a thousand similar posts, so maybe it is not worth fixing.
I have removed that thread. I will be posting a new version shortly.
User avatar
CodeCode
Posts: 1365
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: Rainmeter 4.5.2 Having issues with NetIn NetOut after update

Post by CodeCode »

jsmorley wrote: September 16th, 2021, 10:58 am I have removed that thread. I will be posting a new version shortly.
Looking forward to that. My new project will be managing this stuff in the background - or as much as possible, that is. :thumbup:
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Rainmeter 4.5.2 Having issues with NetIn NetOut after update

Post by jsmorley »

CodeCode wrote: September 16th, 2021, 11:58 am Looking forward to that. My new project will be managing this stuff in the background - or as much as possible, that is. :thumbup:
https://forum.rainmeter.net/viewtopic.php?f=118&t=38440&p=197748#p197748