Beispiel #1
0
def main():
  fb.readConfig("/home/mathias/.fritzboxpyrc")
  fb.fritzglobals.DEBUG = 0 # set this to 1 to see verbose output (may include passwords!)
  fb.login() # initialize session
  fb.fritzglobals.DEBUG = 1
  devices = fb.getDevices() # get a list of all devices known by the box
  for devid in devices:
    print "checking device",devid
    powerconsumption = fb.getConsumption(devid)
    print "current consumption:",powerconsumption
    temp = fb.getTemperature(devid)
    print "current temperatur:",temp
    state = fb.getPowerState(devid)
    print "current state:",state
    print "sleeping a bit..."
    sleep(21*60)
    state = fb.getPowerState(devid)
    print "current state:",state
    powerconsumption = fb.getConsumption(devid)
    print "current consumption:",powerconsumption
    continue
    # be carefull here....
    fb.powerOff(devid)
    state = fb.getPowerState(devid)
    print "current state:",state
    fb.powerOn(devid)
    state = fb.getPowerState(devid)
    print "current state:",state
Beispiel #2
0
def main():
  fb.readConfig(CONFIG_PATH)
  fb.fritzglobals.DEBUG = 0 # set this to 1 to see verbose output (may include passwords!)
  fb.login() # initialize session
  devices = fb.getDevices() # get a list of all devices known by the box
  device = devices[0] # I have only one device
  devid = device[0] # id is always the first value
  powerconsumption = fb.getConsumption(devid)
  print "current consumption:",powerconsumption
  state = fb.getPowerState(devid)
  print "current state:",state
  fb.powerOff(devid)
  state = fb.getPowerState(devid)
  print "current state:",state
  fb.powerOn(devid)
  state = fb.getPowerState(devid)
  print "current state:",state

  updateRrrd(powerconsumption)