# This file is part of Jeedom. # # Jeedom is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Jeedom is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Jeedom. If not, see . import logging import shared try: from jeedom.jeedom import * except ImportError: print("Error: importing module jeedom.jeedom") sys.exit(1) logging.debug("Load decoder packet type 0x02 : Receiver/Transmitter Message") subtype = { '0x00' : 'Erreur le récepteur ne s est pas verrouille', '0x01' : 'Reponse du Transmetteur' } def parse(message): logging.debug("Start decoding packet type 0x02") data = { 'packetlen' : jeedom_utils.dec2hex(message[0]), 'packettype' : jeedom_utils.dec2hex(message[1]), 'subtype' : jeedom_utils.dec2hex(message[2]), 'seqnbr' : jeedom_utils.dec2hex(message[3]), 'msg1' : jeedom_utils.dec2hex(message[4]) } if data['subtype'] in subtype: logging.debug("Subtype = "+subtype[data['subtype']]) logging.debug("Data : "+str(data)) if data['subtype'] == '0x00': logging.debug("Erreur le recepteur ne s'est pas verrouille") elif data['subtype'] == '0x01': subtype_00(data) shared.STATUS_PENDING = message return None def subtype_00(data): logging.debug("Reponse du Transmetteur = " + str(data['msg1'])) if data['msg1'] == '0x00': logging.debug("Message Transmis") elif data['msg1'] == '0x01': logging.debug("OK, mais delai de transmission > 3 sec apres donnees de reception (RF) mais envoyer quand meme") elif data['msg1'] == '0x02': logging.debug("NO OK, Le transmetteur n'est pas verrouille sur la bonne frequence ") elif data['msg1'] == '0x03': logging.debug("NO OK, il y a un ID null, non autorisee") return None