Giter Site home page Giter Site logo

walnut's Introduction

walNUT

WHAT IS IT?

walNUT is nothing more than an interface between you and NUT (Network UPS Tools), using NUT’s own upsc and upscmd. It provides you a handy panel menu and icon to monitor your devices and execute NUT’s instant commands.

Before you start, you need an already up and running NUT: basically if everything goes well with upsc and upscmd, chances are high that walNUT will work right out of the box.

1. INSTALLATION

You can install this extension for your user by executing:

cd ~/.local/share/gnome-shell/extensions
git clone git://github.com/zykh/walNUT.git walnut@networkupstools
glib-compile-schemas walnut@networkupstools/schemas/

After the installation you’ll need to restart Gnome Shell:

  • ALT+F2 to open the command prompt

  • Enter r to restart Gnome Shell

Then you can enable the extension through Gnome Tweak Tool (Shell Extensions → walNUT → On) or through https://extensions.gnome.org/local/

Note
In addition to NUT, you need also timeout (see known issues).

2. FIRST EXECUTION

Once you’ve installed walNUT, when it’s executed for the first time, or every time its device list is empty, it’ll try and search automatically for new devices at localhost:3493.
So, for most installations, it should have already found your devices. If not, you have to add them through the find new devices box.

It’s important that you understand how walNUT communicates with you and how you can customize it: please read panel icon/label, panel menu and preferences sections.
Don’t miss the known issues section!

3. PANEL ICON/LABEL

walNUT's icon and label are customizable through the preferences.
Here is explained how they behave.

Panel Icon

Panel icon standardly displays only battery charge [A], but it can display also device load [B], if available.
In that case the ‘seed’ of the walnut will be split up in two pieces: the leftmost [1] will display battery charge, the rightmost [2] load level.

Caution
In case you set also to Display load in panel icon in preferences and battery charge is not available, the icon will be exactly the same as that for battery charge only [A]: please pay attention.

Panel Icon - Online/On Battery + Charged/Charging

Panel icon displays also the state of the line: if the device is on line (main is not absent, ups.status: OL) there will be a small lightning [C] at the right of the nut that wont be displayed if the device is on battery [D].
That lightning will show also if the device is charged or not: if battery charge is 100% or if battery charge is not available and the device isn’t telling us it’s charging or discharging (ups.status: CHRG/DISCHRG) we’ll assume it’s charged and the lightning will be transparent [E], otherwise it’ll be at full opacity [F].

Panel Icon - Caution

For other status (ups.status: BYPASS, TRIM, ..) or if an alarm arises (ups.status: ALARM + ups.alarm) there will be an exclamation mark on the right top angle of the nut.

Panel Icon - Ghost

If battery charge is not available or if also Display load in panel icon option is selected in preferences and both device load and battery charge aren’t available the icon will be a full transparent nut.

Panel Icon - Error

That’s the icon displayed in case of errors.

Panel Labels

walNUT can also display a label, at the right of the icon in panel, with battery charge [G], device load [H] or both [I], if available.

Note

Icon shows charge/load through 3 bars:

Icon Bars Meaning

3 bars for charge/load

3 bars

More than 75%

2 bars for charge/load

2 bars

Between 50% and 75%

1 bar for charge/load

1 bar

Between 25% and 50%

No bars for charge/load

no bars

Less than 25%

4. PANEL MENU

Here’s a quick overview of panel menu.
Standardly the menu look like this:

Panel Menu

With all the available options set:

Panel Menu - Complete

Menu can be split up in various sections:

A

Device List

B

Device Model

C

Device Status

D

Device Alarm

E

Data Table

F

Raw Vars

G

Device’s Commands

H

I

Control Buttons

In case of an error, the menu appears like this:

Panel Menu - Error

Where the device list [A] is visible or not, depending on the type of error [L].

4.1. DEVICE LIST

Device List

Devices are listed in hostname:port alphabetical order and then alphabetically by their name.

Note
Every device stored in walNUT's own list will be prompted for availability every time you change some option or gnome shell is refreshed (e.g. return from screen block ..and so on) or when the menu is opened, provided that more than 15 minutes has passed after the last update.
Device List opened

Not available devices are signaled with a (N/A) [A] at their right. You can choose either to display or not not available devices in preferences.

4.2. DEVICE MODEL

Device Model

If available both device manufacturer and device model will be shown here.

Tip
If your device isn’t providing one of device manufacturer/model or both or if you want a more appealing label, you can override one of them or both in ups.conf.

4.3. DEVICE STATUS

Device Status

Device status will show: line status [A] (online/on battery), and then, on the second row, every status reported by the device [B] (bypass, trim, ..).

4.4. DEVICE ALARM

Device Alarm

If an alarm is set (ups.status: ALARM and ups.alarm) it’ll be showed here.

Note
An alarm will be signaled also through an ‘exclamation mark’ on the panel icon.

4.5. DATA TABLE

Data Table

If available, [C] battery charge, [D] backup time, [E] device load and [F] temperature will be shown here.
Battery icon [1] will display actual charge through the number of horizontal bars (as the ones of panel icon).

4.6. RAW VARS

Raw Vars

If you want a deep dive in all the variables available for a device you have to select the Display raw data option in the preferences: raw vars will be displayed in a scrollable submenu.

4.7. DEVICE’S COMMANDS

Device’s Commands - Combo Box

If you want to execute NUT’s instant commands through walNUT you have to set the Display device’s commands option in preferences.
You can choose to show device’s instant command either in a combo box [A] or as a submenu [B].

Device’s Commands - Sub Menu

If combo box [A] is chosen, first you have to select the command, and then click on the [1] ‘execute’ button on the right of command’s description [2].

Device’s Commands - Combo box, chosen

If submenu [B] is chosen, when you click on a command, it’ll be executed.

Tip

Submenu standardly display also a localized description of commands [C], but if you think that it steals too much space you can set not to display it [D] in preferences.

Device’s Commands - Sub Menu, with or w/o description

Once a command has been executed, you’ll be notified whether it has been successfully sent to the driver [E] or not [F].

Device’s Commands - Notify
Note
The main advantage of the combo box is that it’s a two-step process, while the submenu gives you a scrollable interface if you have limited vertical space.

4.8. CONTROL BUTTONS

Control Buttons

At the bottom of panel menu there’s a handful of control buttons, some of which will open their own box [A] just before the controls row [B].

Control Buttons + Control Box

The buttons will show:

4.9. CREDENTIALS BOX

Credentials Box

Clicking on the ‘credentials’ button [A] credentials box [B] will open. This box is used to store username and password for devices so that you don’t have to be prompted for them every time you execute a command.

Note
If you want to delete username, password or both (e.g. so that you will be prompted for them from now on), you have to save them void.

If you click on the [1] ‘undo and close’ button any change you have made to user/password before clicking on [2] ‘save’ button will be discarded.

Tip
Standardly password is hidden, but if you want, you can choose not to hide it in preferences.

4.10. FIND NEW DEVICES/FIND NEW DEVICES BOX

Find new devices Box

In order to find new devices, once you clicked on the [A] ‘find’ button, you have to insert the devices' hostname [1] and port [2] and then click on the [B] ‘start search’ button.

Note
If hostname isn’t given it’ll be localhost, while port, if not given, will fall back to 3493.

You will be notified either if new devices are found [C] or not [D].

Find new devices - Notify

4.11. DELETE DEVICES/DELETE DEVICES BOX

Delete device Box

If you want to delete a device, first you have to select it from device list, and then you have to click on the [A] ‘delete’ button.
A new box [B] will appear asking you if you really want to delete it [1] or not [2].

Note
If you want to delete a device that’s not currently available, check first to have enabled the Display not available devices option in preferences.

5. DEVICE CREDENTIALS

If you want to execute device’s instant commands you have to provide a valid username and password (as set in upsd.user configuration file). You can either save them through credentials box or insert them in credentials dialog every time you execute a command.

Note
If the saved user and password prove to be wrong you will be prompted for them with credential dialog when you try and execute a command.

5.1. CREDENTIALS DIALOG

Credentials dialog

Credentials dialog will prompt you to insert a valid username or password either if they’ve not been saved through credentials box or if they proved to be wrong [A].

Credentials dialog - error
Note
The [B] ‘execute’ button will be sensitive only if both username and password are not void.
Caution
Once you have inserted username and password, when you click on the [B] ‘execute’ button, the command will be sent to the driver.

6. PREFERENCES

To fine tune walNUT to suit your needs you may want to change some options.

Preferences Button

You can access the preferences from the [A] preferences button in the panel menu.

A new window will open, where you can set the various options.

Preferences
Available Options
# Option Description

1

Seconds before next update

The seconds after walNUT updates the data from the device. (default: 15)

2

Temperature unit

The unit (Centigrade or Fahrenheit) walNUT should display the temperature in. (default: Centigrade)

3

Display not available devices

Display also not available devices in the combo box in panel menu (chosen device will be always displayed, also if not available, in spite of this option). (default: OFF)

4

Display raw data

Show also raw data in a submenu. (default: OFF)

5

Display device’s commands

Display device’s available commands. Requires upsd user and password to execute them. (default: OFF)

6

Device’s commands in a combobox

Whether the extension should display the device’s commands in a combobox or not (if not, commands are displayed in a sub menu). (default: ON)

7

Display description of device’s commands (submenu)

Display also a localized description of device’s available commands in the sub menu. (default: ON)

8

Hide password at credentials box

Whether the password at credentials box should be hidden or not. (default: ON)

9

Display load in panel icon

Whether the device load should be displayed in panel icon or not. (default: OFF)

10

Display load in panel label

Whether the device load should be displayed in panel label or not. (default: OFF)

11

Display charge in panel label

Whether the battery charge should be displayed in panel label or not. (default: OFF)

7. KNOWN ISSUES

Since walNUT relies on NUT’s upsc to search new devices and to tell if one is available or not, if a hostname:port is not resolvable, or if the host doesn’t have an up and running NUT, upsc will take some time to tell us, so every time the devices list get updated or when a research for new devices is invoked or, if the ‘problematic’ device is the currently chosen one, every time walNUT tries and update its variables, it could potentially freeze gnome shell for some seconds (~3 for every ‘problematic’ device).

In order to prevent these freezes every invocation of upsc/upscmd is done through a timeout of 150ms.
If your device isn’t found (e.g. it needs more than 150ms to reply), you can change that timeout by changing the timeout setting (default: 0.150) either through dconf-editor (org → gnome → shell → extensions → walnut) or executing:

gsettings set org.gnome.shell.extensions.walnut timeout N.NNN

Where N.NNN is the timeout in seconds.

Caution
Regardless of this timeout, it’s better not to play around with find new devices box and ‘fantasy’ hosts and it’s higly recommeded that you remove from the list devices whose hostname:port is going to be no longer resolvable.

8. HELP

If this manual doesn’t answer your questions or for every problem you may encounter, you can find some help at NUT’s list:

If you want to help, you are welcomed in NUT’s list and NUT’s developers list:

8.1. TRANSLATORS

A guide to translate extensions can be found in gnome shell extensions FAQ.

walNUT's documentation is done in AsciiDoc and then processed either to the html version and to the Mallard version for Yelp.
Help file must be put in extension’s help subdir, creating a directory named after the desired locale’s language code (e.g. en, it, ..) or, for country-specific locales, language code and country code (e.g. pt_BR, pt_PT).

The html version must be compiled with:

asciidoc --backend=xhtml11 \
	 -a lang=XX \
	 --out-file help.html \
	 manual.txt

Where help.html is the name the help file must have, manual.txt is the name of your source file and XX is the desired locale’s language code (e.g. it, es, ..).

While the Mallard version needs some further steps:

  1. Download this Mallard backend for AsciiDoc (documentation here)

  2. Install the backend

    asciidoc --backend install mallard.zip
  3. Compile your source file (e.g. manual.txt) with:

    asciidoc --backend=mallard \
    	 -a chunked=1 \
    	 -a toc \
    	 --out-file temp.page \
    	 manual.txt
  4. Download chunkenizer bash script (documentation here)

  5. Give chunkenizer bash script executable permissions:

    chmod +x chunkenizer
  6. Process the previously created temp file temp.page with it:

    ./chunkenizer --yelp temp.page outdir

    Where outdir is the output directory named after your locale (e.g. pt_BR).

Note

If you want to use english manual’s images you have to make a symbolic link to their directory in your locale dir:

ln -s ../C/img img

9. AUTHOR

Daniele Pezzini <[email protected]>

walnut's People

Contributors

zykh avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.