wiki:TipAndDoc/monitor

Version 10 (modified by mitty, 9 years ago) (diff)

--

lm-sensors

SystemTap

Watt Checker

  • 現在所持しているもの
    • TAP-TST5
    • TAP-TST10

TAP-TST10

  • Arch Linux 4.1.6-1-ARCH
  1. $ pacaur -S python2-pyusb-git
  2. $ sudo sh -c 'echo -n "0003:040B:2201.0004" > /sys/bus/hid/drivers/hid-generic/unbind '
  3. $ sudo sh -c 'echo -n "3-1:1.0" >/sys/bus/usb/drivers/usbhid/unbind'
    • echo > unbind はこちらだけで良いかも。
  4. $ vim taptst10ctl.py
    • taptst10ctl.py

      diff --git a/taptst10ctl.py b/taptst10ctl.py
      index 1207fef..f5e8724 100644
      a b watts = [] 
      8383kWhs = [] 
      8484outep.write('\x02\x18\x0a') 
      8585while True: 
      86     data = dev.read(ENDPOINT, 17, intf, 1000) 
       86    data = dev.read(ENDPOINT, 17, 1000) 
      8787    # dump raw data 
      8888    #print(" ".join("{:02x}".format(x) for x in data)) 
      8989 
  5. $ sudo python2 taptst10ctl.py
    No.,DateTime,Watt,kWh
    1,2015/09/23 10:30,4.5,0.00
    2,2015/09/23 10:40,41.5,0.00
    3,2015/09/23 10:50,41.3,0.01
    4,2015/09/23 11:00,40.3,0.02
    

bug?

  • github:nonakap/taptst10ctl は消費電力が増えるとオーバーフローするのか値がおかしくなる模様
  • 100W~ 程度の負荷下
    • $ sudo python2 taptst10ctl.py
      No.,DateTime,Watt,kWh
      1,2015/09/23 11:00,40.0,0.01
      2,2015/09/23 11:10,106.0,0.02
      3,2015/09/23 11:20,3251.0,2.56
      4,2015/09/23 11:30,3251.0,5.10
      5,2015/09/23 11:40,3251.0,7.64
      
    • 3251Wになってしまう
  • TAP-TST10 Watt Monitor USB Program (公式アプリ)

F-PLUG115

Linux

  • github:hasegaw/pyfplug
    • pyfplug2.py
      • .py

        old new  
        355355        self.sfile.flush() 
        356356 
        357357def test_fplug_dev(): 
        358     dev = FPlugDevice('/dev/rfcomm0', debug = True) 
         358    dev = FPlugDevice('/dev/rfcomm0', debug = False) 
        359359    # print "init:", dev.plug_init() 
        360360     
        361361 
    • $ sudo python2 pyfplug2.py
      on: 1
      off: 0
      set_datetime: True
      TMP: 25.0 degree C
      HUM: 33 %
      ILL: 84
      PWR: 21.4 W
      ACC: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 22]
      HIST PWR: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 22]
      HIST MISC: [(None, None, None), (None, None, None), (None, None, None), (None, None, None), (None, None, None), (None, None, None), (None, None, None), (None, None, None), (None, None, None), (None, None, None), (None, None, None), (None, None, None), (None, None, None), (None, None, None), (None, None, None), (None, None, None), (None, None, None), (None, None, None), (None, None, None), (None, None, None), (None, None, None), (None, None, None), (26.0, 33, 83), (26.0, 33, 82)]
      
    • $ sudo python2 fplugctl init
      • 履歴を初期化(ACC, HIST *が0に戻る)
  • 機能面ではpyfplug、応答性ではfplug_for_linuxがよさそう(Cで書かれているので予想通りではあるが…)
    • $ time for i in `seq 1 100`; do for opt in w i t h ; do sudo ./fpstatus -$opt /dev/rfcomm0 ; done; done
      real    2m43.929s
      user    0m0.407s
      sys     0m0.187s
      
    • $ time for i in `seq 1 100`; do for opt in t h i p ; do sudo python2 fplugctl get $opt ; done ; done
      real    4m57.676s
      user    0m3.840s
      sys     0m0.817s
      

Attachments (2)

Download all attachments as: .zip