Skip to content
Snippets Groups Projects
Commit 373e961d authored by jkerdreu's avatar jkerdreu
Browse files

Initial release of Edisio support


git-svn-id: https://redmine.imt-atlantique.fr/svn/xaal/code/Python/trunk@2100 b32b6428-25c9-4566-ad07-03861ab6144f
parent 285b5578
Branches
No related tags found
No related merge requests found
WARNING
=======
Right we only support Edisio wireless switches: https://www.edisio.com/wireless-switches-efcb/
Edisio doesn't provide docs, protocol example. We try to reverse eng the protocol.
Sample outputs
==============
AA = Address ?
BB = Button nb
CC = Looks like a checksum
EE = END of Data
AA AA AA BB CC EE EE EE
2018-09-27 15:37:49 i7 xaal.edisio[18674] DEBUG [16] 6c 76 63 00 74 bc b6 01 01 1f 01 00 03 64 0d 0a
2018-09-27 15:37:49 i7 xaal.edisio[18674] DEBUG [16] 6c 76 63 00 74 bc b6 01 01 1f 01 00 03 64 0d 0a
2018-09-27 15:37:49 i7 xaal.edisio[18674] DEBUG [16] 6c 76 63 00 74 bc b6 01 01 1f 01 00 03 64 0d 0a
2018-09-27 15:37:49 i7 xaal.edisio[18674] DEBUG [16] 6c 76 63 00 74 bc b6 01 01 1f 01 00 03 64 0d 0a
2018-09-27 15:37:54 i7 xaal.edisio[18674] DEBUG [16] 6c 76 63 00 74 bc b6 03 01 1f 01 00 03 64 0d 0a
2018-09-27 15:37:54 i7 xaal.edisio[18674] DEBUG [16] 6c 76 63 00 74 bc b6 03 01 1f 01 00 03 64 0d 0a
2018-09-27 15:37:54 i7 xaal.edisio[18674] DEBUG [16] 6c 76 63 00 74 bc b6 03 01 1f 01 00 03 64 0d 0a
2018-09-27 15:37:54 i7 xaal.edisio[18674] DEBUG [16] 6c 76 63 00 74 bc b6 03 01 1f 01 00 03 64 0d 0a
2018-09-27 15:38:00 i7 xaal.edisio[18674] DEBUG [16] 6c 76 63 06 73 74 2b 01 01 1d 01 00 03 64 0d 0a
2018-09-27 15:38:00 i7 xaal.edisio[18674] DEBUG [16] 6c 76 63 06 73 74 2b 01 01 1d 01 00 03 64 0d 0a
2018-09-27 15:38:00 i7 xaal.edisio[18674] DEBUG [16] 6c 76 63 06 73 74 2b 01 01 1d 01 00 03 64 0d 0a
2018-09-27 15:38:00 i7 xaal.edisio[18674] DEBUG [16] 6c 76 63 06 73 74 2b 01 01 1d 01 00 03 64 0d 0a
2018-09-27 15:38:09 i7 xaal.edisio[18674] DEBUG [16] 6c 76 63 06 73 74 2b 03 01 1b 01 00 03 64 0d 0a
2018-09-27 15:38:09 i7 xaal.edisio[18674] DEBUG [16] 6c 76 63 06 73 74 2b 03 01 1b 01 00 03 64 0d 0a
2018-09-27 15:38:09 i7 xaal.edisio[18674] DEBUG [16] 6c 76 63 06 73 74 2b 03 01 1b 01 00 03 64 0d 0a
2018-09-27 15:38:09 i7 xaal.edisio[18674] DEBUG [16] 6c 76 63 06 73 74 2b 03 01 1b 01 00 03 64 0d 0a
\ No newline at end of file
from setuptools import setup,find_packages
with open('README.rst') as f:
long_description = f.read()
VERSION = "0.1"
setup(
name='xaal.edisio',
version=VERSION,
license='GPL License',
author='Jerome Kerdreux',
author_email='Jerome.Kerdreux@imt-atlantique.fr',
#url='',
description=('xAAL gateway for Edisio devices' ),
long_description=long_description,
classifiers=[
'Programming Language :: Python',
'Topic :: Software Development :: Libraries :: Python Modules',
],
keywords=['xaal', 'edisio'],
platforms='any',
packages=find_packages(),
include_package_data=True,
install_requires=[
'xaal.lib',
'gevent',
'pyserial',
]
)
__path__ = __import__('pkgutil').extend_path(__path__, __name__)
from .gw import setup
\ No newline at end of file
from . import gw
from xaal.lib import helpers
helpers.run_package(gw.PACKAGE_NAME,gw.setup)
from gevent import monkey; monkey.patch_all()
import gevent
from xaal.lib import tools,Engine,Device
from xaal.schemas import devices
import platform
import logging
import serial
PACKAGE_NAME = "xaal.edisio"
logger = logging.getLogger(PACKAGE_NAME)
def hex_to_str(data):
r = ""
for k in data:
r = r + '%02x ' % k
return r
class GW(gevent.Greenlet):
def __init__(self,engine):
gevent.Greenlet.__init__(self)
self.engine = engine
self.config()
self.setup()
self.setup_gw()
def config(self):
cfg = tools.load_cfg(PACKAGE_NAME)
if not cfg:
cfg= tools.new_cfg(PACKAGE_NAME)
cfg['config']['port'] = '/dev/ttyUSB0'
cfg['devices'] = {}
logger.warn("Created an empty config file")
cfg.write()
self.cfg = cfg
def setup(self):
port = self.cfg['config'].get('port',None)
if not port:
logger.error('Please set Edisio serial port')
return
self.ser = serial.Serial(port,9600,timeout=0.1)
def setup_gw(self):
# last step build the GW device
addr = self.cfg['config'].get('addr',None)
gw = devices.gateway(addr)
gw.vendor_id = "IHSEV"
gw.product_id = "Edisio Gateway"
gw.version = 0.1
gw.info = "%s@%s" % (PACKAGE_NAME,platform.node())
#emb = gw.new_attribute('embedded',[])
#emb.value = [io.dev.address for io in self.in_out]
#self.engine.add_device(gw)
def _run(self):
while 1:
data = self.ser.read(16)
if data:
self.parse_data(data)
def parse_data(self,data):
logger.debug("[%s] %s" % (len(data),hex_to_str(data)))
def setup(engine):
GW.spawn(engine)
return True
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment