LeeVD / plasma-applet-net-bandwidth-monitor

Network bandwidth monitor for plasma using dbus
GNU General Public License v3.0
24 stars 4 forks source link

No reading after reboot #11

Closed qingxiang-jia closed 1 year ago

qingxiang-jia commented 1 year ago

After restart, the applet no longer has network readings. However, if I re-add it to the desktop, it will work fine.

Operating System: Arch Linux KDE Plasma Version: 5.27.0 KDE Frameworks Version: 5.103.0 Qt Version: 5.15.8 Kernel Version: 6.1.12-zen1-1-zen (64-bit) Graphics Platform: X11 Processors: 8 × AMD Ryzen 5 3400G with Radeon Vega Graphics Memory: 13.6 GiB of RAM Graphics Processor: AMD Radeon Vega 11 Graphics Manufacturer: Micro-Star International Co., Ltd. Product Name: MS-7A40 System Version: 2.0

CatEricka commented 1 year ago

Same issue.

Operating System: Debian GNU/Linux KDE Plasma Version: 5.26.90 KDE Frameworks Version: 5.102.0 Qt Version: 5.15.8 Kernel Version: 6.1.0-3-amd64 (64-bit) Graphics Platform: X11 Processors: 32 × AMD Ryzen 9 7950X 16-Core Processor Memory: 30.5 GiB of RAM Graphics Processor: AMD Radeon Graphics Manufacturer: Gigabyte Technology Co., Ltd. Product Name: X670 AORUS ELITE AX System Version: -CF

LeeVD commented 1 year ago

Thanks for the info. Can you please confirm if you are monitoring a single or multiple, wireless or wired connection(s)?

I've been building on a laptop with wired (via dock) and wireless connections to test dual monitoring and it seemed to be working. Yesterday i disconnected the laptop from dock and booted, had similar results you mention. I had to enter the 'Interfaces(s)' settings section to get the monitoring working again.

CatEricka commented 1 year ago

Add those line to the end of addSource() function:

    //2nd
    function addSources() {

...
        netDataAccumulator =        { down:  0, up:  0 };
        dbusData.subscribe(sensorList);
        //numberOfNets = count;
        numCheckedNets = checkedCount
        ready = true;
+        console.log("network_plasmoid_debug:")
+        console.log(sensorList)
    }

Reboot system, then execute command LC_ALL=C journalctl --user -b:

Feb 20 18:37:24 debian plasmashell[1863]: qml: network_plasmoid_debug:
Feb 20 18:37:24 debian plasmashell[1863]: qml: []

I noticed that the addSource() is not called after network state changed.

LeeVD commented 1 year ago

I'll try that thanks. There's code that 'should' refresh the interfaces on boot up / app start. In 'Network Interface(s) settings there is similar references to refreshing DBUS data. Strange. I'll run some tests and feedback. Ta.

CatEricka commented 1 year ago

This maybe has a serialization error because of:

        plasmoid.configuration.netSources = netInterfaces       // PUSH FOUND INTERFACES TO STORED SETTINGS 
        pcn = plasmoid.configuration.netSources                 // REFRESH DATA IN VARIABLE
    <group name="Network">
        <entry name="netSources" type="StringList">
            <default></default>
        </entry>
    </group>

It's StringList.

qingxiang-jia commented 1 year ago

Thanks for the info. Can you please confirm if you are monitoring a single or multiple, wireless or wired connection(s)?

I've been building on a laptop with wired (via dock) and wireless connections to test dual monitoring and it seemed to be working. Yesterday i disconnected the laptop from dock and booted, had similar results you mention. I had to enter the 'Interfaces(s)' settings section to get the monitoring working again.

For me, the computer has two internet card, one is wired, the other is wireless. When this issue happens, the settings page has none of them, only one checkbox that cannot be interacted with.

Thanks for the help!

CatEricka commented 1 year ago

This maybe has a serialization error because of:

Try to serialize the object to JSON (this is just a try and should not be merged directly):

https://github.com/CatEricka/plasma-applet-net-bandwidth-monitor/tree/netsource-property


By the way, there still have a issue: if you add a network connection, there is no way to detect the new network unless poll sensors regularly

LeeVD commented 1 year ago

This maybe has a serialization error because of:

Try to serialize the object to JSON (this is just a try and should not be merged directly):

https://github.com/CatEricka/plasma-applet-net-bandwidth-monitor/tree/netsource-property

By the way, there still have a issue: if you add a network connection, there is no way to detect the new network unless poll sensors regularly

Yes, that i am aware of. If the user heads into the Network Interface(s) section it should then update the interfaces. Like you say unless the polling is constantly checking for changes it wont auto update. Something to add to the 'needs adding' list. Thanks CatEricka, i'll take a look at that code when i get a chance.

LeeVD commented 1 year ago

v0.3 should fix this issue. I've done a lot of testing and it works on my system. @CatEricka was absolutely correct, it was a serialisation issue. Many thanks for pointing me in the right direction and the fixes/code.

adrianvg commented 1 year ago

After restart, the applet no longer has network readings. However, if I re-add it to the desktop, it will work fine. Checking the box doesn't do anything unfortunately.

Seeing the same problem as @qingxiang-jia. Running plasma-applet-net-bandwidth-monitor v0.3. After I logoff and-or reboot the NIC is unchecked and no readings are shown.

My system: 2023-03-11_17-01-10

2023-03-11_17-00-04

After removing and readding the widget to the panel: 2023-03-11_17-02-40

2023-03-11_17-03-01

Anything I can test to make this great applet work?

CatEricka commented 1 year ago

@adrianvg You are running v0.2, because v0.3 'Network Interface' renamed to 'Network'. The installation and uninstallation of plasmoid seems to be a bit of a problem, manual removal may be works.

adrianvg commented 1 year ago

@adrianvg You are running v0.2, because v0.3 'Network Interface' rename to 'Network'. The installation and uninstallation of plasmoid seems to be a bit of a problem, manual removal may be works.

Huh? Taking a second look. I installed v0.3 from "Install widget from local file", after downloading it from this site.

CatEricka commented 1 year ago

@adrianvg You are running v0.2, because v0.3 'Network Interface' rename to 'Network'. The installation and uninstallation of plasmoid seems to be a bit of a problem, manual removal may be works.

Huh? Taking a second look. I installed v0.3 from "Install widget from local file", after downloading it from this site.

This is v0.3:

图片

图片

图片

That's why I said: "The installation and uninstallation of plasmoid seems to be a bit of a problem, manual removal may be works."

For my case the install directory is $HOME/.local/share/plasma/plasmoids/.

adrianvg commented 1 year ago

Ok, now I got the correct version. Needed some work to uninstall the old version and getting the new one in.

2023-03-12_13-58-28

The network tab seems weird though. Nothing is listed, but the widget still seems to read from something.

2023-03-12_13-59-51

Will try to logoff and reboot and see if it sticks.

adrianvg commented 1 year ago

Logged off and on again and the readings still work! And now also shows the NIC.

2023-03-12_14-04-47

Logging off and rebooting same as above - I'm happy. Thanks to you all; @CatEricka, @LeeVD !

CatEricka commented 1 year ago

Maybe there is some error in the configuration file, open file $HOME/.config/plasma-org.kde.plasma.desktop-appletsrc if it exists, then search netSources. Delete this entry, and then re-add the widget.

v0.3 works fine on my desktop, mine version of netSources is:

[Containments][1][Applets][62][Configuration][Network]
netSources=[{"path":"network/enp13s0"\\,"name":"Wired connection 1"\\,"index":8\\,"checked":true}]
adrianvg commented 1 year ago

Maybe there is some error in the configuration file, open file $HOME/.config/plasma-org.kde.plasma.desktop-appletsrc if it exists, then search netSources. Delete this entry, and then re-add the widget.

v0.3 works fine on my desktop, the content of the entry is:

[Containments][1][Applets][62][Configuration][Network]
netSources=[{"path":"network/enp13s0"\\,"name":"Wired connection 1"\\,"index":8\\,"checked":true}]

Works fine for me now. Seems the logoff was needed to settle things. See above post!

CatEricka commented 1 year ago

Works fine for me now. Seems the logoff was needed to settle things. See above post!

Yah, sometimes need logoff; I don't really understand why, but at least the install and uninstall of plasmoid have had this issue for the last few months. Until last week, the size and position of widgets would be messed up every time I loggin. At least this week the widgets aren't run around anymore. (My OS: Debian bookworm)

CatEricka commented 1 year ago

Just in case someone needs this: There was a issue with the previous config file, v0.3 changed the format of the config format (it is now an escaped JSON string) in order to properly serialize netSource object to the config file. The code of v0.3 was not considered for compatibility issues (as the old code was actually incorrect and the netSource object was never properly serialized, which is why #11 happened), so some conflicts may need to be handled manually.

The config file for plasmoid is $HOME/.config/plasma-org.kde.plasma.desktop-appletsrc, this file also stores all desktop custom settings, including desktop icons.


Needed some work to uninstall the old version and getting the new one in.

It should be noted that this is not the issue mentioned above, but a issue of plasma itself.

adrianvg commented 1 year ago

@LeeVD Connecting with VPN is no problem, shows speed as expected.

LeeVD commented 1 year ago

In my testing I saw the install and uninstall wasn't always accurate. Last attempt i used plasmapkg2 to install the plasmoid v0.3 file which worked, after I uploaded v0.3 to pling/kde store and i went to the desktop section to get widgets/plasmoids it showed it needed upgrading. I'm not sure of the expected plasma way to handle upgrading the software, if anyone knows that please let me know.

It seems a reboot/log off may be necessary for the new version to work correctly. I'll add that to the read me section. Due to code rewrites and future additions, i sometimes change the variable types, I'm sure that doesn't help either!

Thanks for the feedback @adrianvg @CatEricka. I'm glad things are finally working...ish :)