pi@raspberrypi:~ $ python
Python 2.7.13 (default, Nov 24 2017, 17:33:09)
[GCC 6.3.0 20170516] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from ouimeaux.environment import Environment
>>> def on_switch(switch):
... print "Switch found!", switch.name
...
>>> def on_motion(motion):
... print "Motion found!", motion.name
...
>>> env = Environment(on_switch, on_motion)
>>> env.start()
>>> env.discover(seconds=3)
Switch found! WeMo
>>> env.list_switches()
['WeMo']
>>> switch = env.get_switch('WeMo')
>>> switch
<WeMo Insight "WeMo">
>>> print switch.get_state()
0
>>> switch.on()
>>> print switch.get_state()
1
>>> print switch.insight_params
{'onfor': 51, 'state': '8', 'ontotal': 16144, 'totalmw': 40961936, 'ontoday': 16499, 'todaymw': 40961936, 'lastchange': datetime.datetime(2018, 1, 13, 13, 4, 24), 'currentpower': 0}
>>> print switch.insight_params['currentpower']
0 (WeMoに何も差してない状態)
>>> print switch.insight_params['currentpower']
15915 (WeMoにノートPCのACアダプタを差している)