Git Product home page Git Product logo

batinfo's People

Contributors

almet avatar fabaff avatar hroncok avatar nicolargo avatar webplate avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

batinfo's Issues

Can't update batinfo, maybe

I know GitHub shows changes tagged for 0.1.9, and I know the version number's been updated at least one place:

localhost /usr/src/batinfo [0]# grep -ir '0\.1\.9' *
__init__.py:__version__ = "0.1.9"

Installing either direct from GitHub or from a local Zip created from a "git clone" operation results in pip claiming 0.1.8's installed. Whichever version's really installed, I still can't get battery info from Glances.

Does Glances have some undocumented cmdline flag or hotkey I'm supposed to use to enable battery info? Or is there some problem with the batinfo code on GitHub?

Exception: no module battery

Traceback (most recent call last):
  File "/home/djipey/conky/scripts/bat.py", line 6, in <module>
   import batinfo
  File "/usr/lib/python3.3/site-packages/batinfo/__init__.py", line 29, in <module>
    from battery import battery, batteries
ImportError: No module named 'battery'

Glances is unusable on my system when batinfo is installed

Hello,

I really appreciate Glances as a lightweight system monitor, I was looking for smthg like this for a long time. Thx a lot !

Strangely, on my system and maybe because of the battery linux driver, the battery object behaves like this :
$import batinfo
$a=batinfo.battery()
$repr(a)
'{"status": "Discharging", "name": "BAT0", "uevent": "POWER_SUPPLY_NAME=BAT0\nPOWER_SUPPLY_STATUS=Discharging\nPOWER_SUPPLY_PRESENT=1\nPOWER_SUPPLY_TECHNOLOGY=Li-ion\nPOWER_SUPPLY_CYCLE_COUNT=0\nPOWER_SUPPLY_VOLTAGE_MIN_DESIGN=10800000\nPOWER_SUPPLY_VOLTAGE_NOW=11960000\nPOWER_SUPPLY_CURRENT_NOW=620000\nPOWER_SUPPLY_CHARGE_FULL_DESIGN=4400000\nPOWER_SUPPLY_CHARGE_FULL=3998000\nPOWER_SUPPLY_CHARGE_NOW=3562000\nPOWER_SUPPLY_MODEL_NAME=1005P\nPOWER_SUPPLY_MANUFACTURER=ASUS\nPOWER_SUPPLY_SERIAL_NUMBER=", "alarm": 0, "charge_full": 3998000, "voltage_now": 11960000, "serial_number": "", "model_name": "1005P", "current_now": 620000, "charge_now": 3562000, "type": "Battery", "path": "/sys/class/power_supply/BAT0", "voltage_min_design": 10800000, "manufacturer": "ASUS", "technology": "Li-ion", "cycle_count": 0, "present": 1, "charge_full_design": 4400000}'

$str(a)
CRITICAL:batinfo.battery:Attribute capacity did not exist

So the battrey object correctly initialized, but the kernel doesn't seem to provide the "capacity" attribute. Maybe, batinfo should be quiet about it (it destroys Glances interface otherwise) or perhaps batinfo could deduce the battery current capacity from the uevent attribute... I'm pretty noob, and not sure if I'm getting it right... but if you confirm the coherence of my interpretation I could propose a little patch. Capacity is just the percentage calculated from CHARGEFULL and CHARGENOW right ?

Thanks again for Ur time !

Tests failing on Python 3.3, 3.4 and 3.5

This happens on Python 3.3, 3.4 or 3.5:

$ python3.5 -m unittest
FF.Fbatinfo/test_batinfo.py:53: DeprecationWarning: Please use assertEqual instead.
  self.assertEquals(batteries_count, 2)
.
======================================================================
FAIL: test_batinfo_capacity (test_batinfo.TestBatInfo)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "batinfo/test_batinfo.py", line 42, in test_batinfo_capacity
    self.assertTrue(self.bat.stat[0].capacity == 34)
AssertionError: False is not true

======================================================================
FAIL: test_batinfo_charge_now (test_batinfo.TestBatInfo)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "batinfo/test_batinfo.py", line 47, in test_batinfo_charge_now
    self.assertTrue(self.bat.stat[1].charge_now == 3074000)
AssertionError: False is not true

======================================================================
FAIL: test_batinfo_name_default (test_batinfo.TestBatInfo)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "batinfo/test_batinfo.py", line 37, in test_batinfo_name_default
    self.assertTrue(self.bat.stat[0].name == "BAT1")
AssertionError: False is not true

----------------------------------------------------------------------
Ran 5 tests in 0.007s

FAILED (failures=3)

Tests on Python 2.7 succeeded.

CRITICAL:batinfo.battery:Can not read file current_now message

Power cable is unpluged...

In [6]: b.stat
Out[6]: [{"status": "Discharging", "capacity": 29, "name": "BAT0", "uevent": "POWER_SUPPLY_NAME=BAT0\nPOWER_SUPPLY_STATUS=Discharging\nPOWER_SUPPLY_PRESENT=1\nPOWER_SUPPLY_TECHNOLOGY=Unknown\nPOWER_SUPPLY_CYCLE_COUNT=0\nPOWER_SUPPLY_VOLTAGE_MIN_DESIGN=7500000\nPOWER_SUPPLY_VOLTAGE_NOW=7461000\nPOWER_SUPPLY_CURRENT_NOW=1109000\nPOWER_SUPPLY_CHARGE_FULL_DESIGN=7470000\nPOWER_SUPPLY_CHARGE_FULL=7328000\nPOWER_SUPPLY_CHARGE_NOW=2155000\nPOWER_SUPPLY_CAPACITY=29\nPOWER_SUPPLY_MODEL_NAME=Dell\nPOWER_SUPPLY_MANUFACTURER=SANYO\nPOWER_SUPPLY_SERIAL_NUMBER=152", "alarm": 0, "charge_full": 7328000, "voltage_now": 7461000, "serial_number": 152, "cycle_count": 0, "current_now": 1109000, "charge_now": 2155000, "voltage_min_design": 7500000, "path": "/sys/class/power_supply/BAT0", "technology": "Unknown", "manufacturer": "SANYO", "type": "Battery", "model_name": "Dell", "present": 1, "charge_full_design": 7470000}]

Plug the power cable...

In [7]: b.stat
CRITICAL:batinfo.battery:Can not read file current_now
Out[7]: [{"status": "Charging", "capacity": 29, "name": "BAT0", "uevent": "POWER_SUPPLY_NAME=BAT0\nPOWER_SUPPLY_STATUS=Charging\nPOWER_SUPPLY_PRESENT=1\nPOWER_SUPPLY_TECHNOLOGY=Unknown\nPOWER_SUPPLY_CYCLE_COUNT=0\nPOWER_SUPPLY_VOLTAGE_MIN_DESIGN=7500000\nPOWER_SUPPLY_VOLTAGE_NOW=7625000\nPOWER_SUPPLY_CHARGE_FULL_DESIGN=7470000\nPOWER_SUPPLY_CHARGE_FULL=7328000\nPOWER_SUPPLY_CHARGE_NOW=2148000\nPOWER_SUPPLY_CAPACITY=29\nPOWER_SUPPLY_MODEL_NAME=Dell\nPOWER_SUPPLY_MANUFACTURER=SANYO\nPOWER_SUPPLY_SERIAL_NUMBER=152", "alarm": 0, "charge_full": 7328000, "voltage_now": 7625000, "serial_number": 152, "cycle_count": 0, "current_now": "", "charge_now": 2148000, "voltage_min_design": 7500000, "path": "/sys/class/power_supply/BAT0", "technology": "Unknown", "manufacturer": "SANYO", "type": "Battery", "model_name": "Dell", "present": 1, "charge_full_design": 7470000}]

Include tests in tarball

It would be nice if the tests are shipped. Can you please add them to the tarball/archive? Thanks.

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.