Ci-dessous, les différences entre deux révisions de la page.
serialkiller-plugins-x10 [2014/02/09 22:45] badele created |
serialkiller-plugins-x10 [2015/08/12 22:29] (Version actuelle) |
||
---|---|---|---|
Ligne 20: | Ligne 20: | ||
make | make | ||
make install | make install | ||
+ | </code> | ||
+ | |||
+ | <code python> | ||
+ | #!/usr/bin/env python | ||
+ | # -*- coding: utf-8 -*- | ||
+ | |||
+ | import os | ||
+ | import time | ||
+ | |||
+ | from skplugins import addValuePlugin, addEventPlugin, addValue, addEvent | ||
+ | from skplugins.protocol.x10 import x10 | ||
+ | |||
+ | server = '192.168.1.1' | ||
+ | while True: | ||
+ | |||
+ | # X10 sensors | ||
+ | plugin = x10(mochad='192.168.1.2') | ||
+ | addValue(server, 'livingroom:shuttersroad:state', 'boolean', int(plugin.results['result']['A5'])*255) | ||
+ | addValue(server, 'livingroom:shutterskitchen:state', 'boolean', int(plugin.results['result']['A6'])*255) | ||
+ | addValue(server, 'livingroom:lamp:state', 'boolean', int(plugin.results['result']['A2'])*255) | ||
+ | addValue(server, 'lucasroom:lamp:state', 'boolean', int(plugin.results['result']['A3'])*255) | ||
+ | |||
+ | #Sleep | ||
+ | time.sleep(5) | ||
</code> | </code> |