# -*- coding: utf-8 -*- """Module allowing to command and control the Anel power plugs""" import anellib config = { #key: (IP adress, login, password) 1: ("192.168.0.11", "admin", "anel"), 2: ("192.168.0.13", "admin", "anel") } def parameters(): """Parameters specific to the command and control of the Anel power plugs""" return { "target":"power plug", "switch_path":"/ctrl.htm", "status_path":"/mobile.htm", "body":"x=10", "letter":"F", "config":config, "size":8 } def update_config(new_config): """Update the configuration""" global config config = new_config def switch(command, keys): """Switch on/off of the power plugs specified by the keys""" return anellib.switch(command, keys, parameters()) def status(key): """Return the status on/off of the power plugs specified by the keys""" return anellib.status(key, parameters()) def indexes(): """Return a list containing the index of each power strip""" return anellib.indexes(parameters()) def subindexes(): """Return a list containing the index of each power plug in a power strip""" return anellib.subindexes(parameters()) def switch_off_all(): """Switch off all power plugs""" return anellib.switch_off_all(parameters()) def check_control(): """Check that all power strips can be controlled""" anellib.check_control(parameters())