sasu-drooz / Domoticz-Rfplayer

Domoticz python Plugin for Ziblue RfPlayer Rfp1000
GNU General Public License v3.0
12 stars 16 forks source link

Télécommande 4 canaux infotype 2 #21

Closed ogulf closed 7 years ago

ogulf commented 7 years ago

Encore moi, mais pour un test de télécommande de porte de garage, 4 boutons (ce n'est pas celle-là, mais elle y ressemble) :

==> https://www.automatismes.net/3119-home_default/telecommande-portail-v2-phoenix.jpg

Les 4 boutons sont bien reçus par le RFPlayer, en 433MHz, avec 4 id différents. Mais le couple (protocole - infotype) n'est pas cohérent. Je reçois du "BLYSS" avec l'infotype "Visionic", cf l'une des 4 traces ci-dessous :

Bouton H.G : [code]2017-06-24 10:35:30.770 (RFPlayer) Received 325 bytes of data:. 2017-06-24 10:35:30.770 (RFPlayer) 5a 49 41 33 33 7b 20 22 66 72 61 6d 65 22 20 3a 7b 22 68 65 ZIA33{."frame".:{"he 2017-06-24 10:35:30.770 (RFPlayer) 61 64 65 72 22 3a 20 7b 22 66 72 61 6d 65 54 79 70 65 22 3a ader":.{"frameType": 2017-06-24 10:35:30.770 (RFPlayer) 20 22 30 22 2c 20 22 63 6c 75 73 74 65 72 22 3a 20 22 30 22 ."0",."cluster":."0" 2017-06-24 10:35:30.770 (RFPlayer) 2c 20 22 64 61 74 61 46 6c 61 67 22 3a 20 22 30 22 2c 20 22 ,."dataFlag":."0",." 2017-06-24 10:35:30.770 (RFPlayer) 72 66 4c 65 76 65 6c 22 3a 20 22 2d 37 32 22 2c 20 22 66 6c rfLevel":."-72",."fl 2017-06-24 10:35:30.770 (RFPlayer) 6f 6f 72 4e 6f 69 73 65 22 3a 20 22 2d 31 30 34 22 2c 20 22 oorNoise":."-104",." 2017-06-24 10:35:30.770 (RFPlayer) 72 66 51 75 61 6c 69 74 79 22 3a 20 22 38 22 2c 20 22 70 72 rfQuality":."8",."pr 2017-06-24 10:35:30.770 (RFPlayer) 6f 74 6f 63 6f 6c 22 3a 20 22 33 22 2c 20 22 70 72 6f 74 6f otocol":."3",."proto 2017-06-24 10:35:30.770 (RFPlayer) 63 6f 6c 4d 65 61 6e 69 6e 67 22 3a 20 22 42 4c 59 53 53 22 colMeaning":."BLYSS" 2017-06-24 10:35:30.770 (RFPlayer) 2c 20 22 69 6e 66 6f 54 79 70 65 22 3a 20 22 32 22 2c 20 22 ,."infoType":."2",." 2017-06-24 10:35:30.770 (RFPlayer) 66 72 65 71 75 65 6e 63 79 22 3a 20 22 34 33 33 39 32 30 22 frequency":."433920" 2017-06-24 10:35:30.770 (RFPlayer) 7d 2c 22 69 6e 66 6f 73 22 3a 20 7b 22 73 75 62 54 79 70 65 },"infos":.{"subType 2017-06-24 10:35:30.770 (RFPlayer) 22 3a 20 22 30 22 2c 20 22 73 75 62 54 79 70 65 4d 65 61 6e ":."0",."subTypeMean 2017-06-24 10:35:30.771 (RFPlayer) 69 6e 67 22 3a 20 22 44 65 74 65 63 74 6f 72 2f 53 65 6e 73 ing":."Detector/Sens 2017-06-24 10:35:30.771 (RFPlayer) 6f 72 22 2c 20 22 69 64 22 3a 20 22 32 35 36 32 39 32 33 32 or",."id":."25629232 2017-06-24 10:35:30.771 (RFPlayer) 38 22 2c 20 22 71 75 61 6c 69 66 69 65 72 22 3a 20 22 30 22 8",."qualifier":."0" 2017-06-24 10:35:30.771 (RFPlayer) 7d 7d 7d 0a 0d .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. }}}.. 2017-06-24 10:35:30.771 (RFPlayer) Calling message handler 'onMessage'. 2017-06-24 10:35:30.771 (RFPlayer) Last Message was 631.569633 seconds ago, Message clear 2017-06-24 10:35:30.771 (RFPlayer) ZIA33{ "frame" :{"header": {"frameType": "0", "cluster": "0", "dataFlag": "0", "rfLevel": "-72", "floorNoise": "-104", "rfQuality": "8", "protocol": "3", "protocolMeaning": "BLYSS", "infoType": "2", "frequency": "433920"},"infos": {"subType": "0", "subTypeMeaning": "Detector/Sensor", "id": "256292328", "qualifier": "0"}}} 2017-06-24 10:35:30.772 (RFPlayer) infoType : 2 2017-06-24 10:35:30.772 (RFPlayer) Error while decoding or reading JSON 2017-06-24 10:35:30.772 (RFPlayer) Debug : Error Decoding/Reading { "frame" :{"header": {"frameType": "0", "cluster": "0", "dataFlag": "0", "rfLevel": "-72", "floorNoise": "-104", "rfQuality": "8", "protocol": "3", "protocolMeaning": "BLYSS", "infoType": "2", "frequency": "433920"},"infos": {"subType": "0", "subTypeMeaning": "Detector/Sensor", "id": "256292328", "qualifier": "0"}}}[/code]

Bouton H.D : idem avec autre ID 256292324

Bouton B.G : idem avec autre ID 256292322

Bouton B.D : idem avec autre ID 256292321

On y voit bien 4 id différents, sur protocole Blyss, mais le script Python ne s'appuie que sur l'InfoType, qui est 2 et correspond à une trame "Visionic". Le "parse" de la trame doit planter à l'instruction id_lsb = DecData.

            if infoType == "2":
                    protocol = DecData['frame']['header']['protocol']
                    frequency = DecData['frame']['header']['frequency']
                    SubType = DecData['frame']['infos']['subType']

[b][color=#FF0000] id_lsb = DecData['frame']['infos']['id_lsb'][/color][/b] id_msb = DecData['frame']['infos']['id_msb'] qualifier = list(bin(DecData['frame']['infos']['qualifier'])[2:]) Domoticz.Debug("id_lsb : " + id_lsb + " id_msb : " + id_msb + " subType :" + SubType)

J'ai provisoirement forcé le script à passer dans le pavé "InfoType 1" (qui correspond à BLYSS) et autorisé la création de device ==> OK ! Je suis revenu en arrière sur le script.

Reste à savoir si "Protocole = Blyss" avec "InfoType = 2" est un problème de transco issu du RFPlayer ??

zaraki673 commented 7 years ago

Bonjour Olivier,

Problème coté Rfplayer, mais j ai mis un patch aujourd hui, ca devrait de ce fait fonctionner maitenant.

cordialement, ;)

ogulf commented 7 years ago

Super, merci !!

J'ai une erreur au chargement du plugin, cf ci-dessous la log dans Domoticz :

2017-07-11 19:07:12.799 Error: (RFplayer) failed to load 'plugin.py', Python Path used was '/home/domoticz/domoticz/plugins/rfplayer/:/usr/lib/python3.4/:/usr/lib/python3.4/plat-arm-linux-gnueabihf:/usr/lib/python3.4/lib-dynload'. 2017-07-11 19:07:12.799 Error: (RFPlayer) Module Import failed, exception: 'SyntaxError' 2017-07-11 19:07:12.799 Error: (RFPlayer) Import detail: File: /home/domoticz/domoticz/plugins/rfplayer/plugin.py, Line: 1836549696, offset: 461 2017-07-11 19:07:12.799 Error: (RFPlayer) Error Line ' if SubType == "0" and protocol == ""3 : # blyss '

L'erreur porte sur le test protocol == ""3

J'ai corrigé localement le script ^^ et le plugin se charge bien :)

Par contre, il y a toujours une erreur sur le parse du JSON... :-(

2017-07-11 19:12:25.972 (RFPlayer) Received 325 bytes of data:. 2017-07-11 19:12:25.972 (RFPlayer) 5a 49 41 33 33 7b 20 22 66 72 61 6d 65 22 20 3a 7b 22 68 65 ZIA33{."frame".:{"he 2017-07-11 19:12:25.972 (RFPlayer) 61 64 65 72 22 3a 20 7b 22 66 72 61 6d 65 54 79 70 65 22 3a ader":.{"frameType": 2017-07-11 19:12:25.972 (RFPlayer) 20 22 30 22 2c 20 22 63 6c 75 73 74 65 72 22 3a 20 22 30 22 ."0",."cluster":."0" 2017-07-11 19:12:25.972 (RFPlayer) 2c 20 22 64 61 74 61 46 6c 61 67 22 3a 20 22 30 22 2c 20 22 ,."dataFlag":."0",." 2017-07-11 19:12:25.972 (RFPlayer) 72 66 4c 65 76 65 6c 22 3a 20 22 2d 37 32 22 2c 20 22 66 6c rfLevel":."-72",."fl 2017-07-11 19:12:25.972 (RFPlayer) 6f 6f 72 4e 6f 69 73 65 22 3a 20 22 2d 31 30 35 22 2c 20 22 oorNoise":."-105",." 2017-07-11 19:12:25.972 (RFPlayer) 72 66 51 75 61 6c 69 74 79 22 3a 20 22 38 22 2c 20 22 70 72 rfQuality":."8",."pr 2017-07-11 19:12:25.972 (RFPlayer) 6f 74 6f 63 6f 6c 22 3a 20 22 33 22 2c 20 22 70 72 6f 74 6f otocol":."3",."proto 2017-07-11 19:12:25.972 (RFPlayer) 63 6f 6c 4d 65 61 6e 69 6e 67 22 3a 20 22 42 4c 59 53 53 22 colMeaning":."BLYSS" 2017-07-11 19:12:25.972 (RFPlayer) 2c 20 22 69 6e 66 6f 54 79 70 65 22 3a 20 22 32 22 2c 20 22 ,."infoType":."2",." 2017-07-11 19:12:25.972 (RFPlayer) 66 72 65 71 75 65 6e 63 79 22 3a 20 22 34 33 33 39 32 30 22 frequency":."433920" 2017-07-11 19:12:25.973 (RFPlayer) 7d 2c 22 69 6e 66 6f 73 22 3a 20 7b 22 73 75 62 54 79 70 65 },"infos":.{"subType 2017-07-11 19:12:25.973 (RFPlayer) 22 3a 20 22 30 22 2c 20 22 73 75 62 54 79 70 65 4d 65 61 6e ":."0",."subTypeMean 2017-07-11 19:12:25.973 (RFPlayer) 69 6e 67 22 3a 20 22 44 65 74 65 63 74 6f 72 2f 53 65 6e 73 ing":."Detector/Sens 2017-07-11 19:12:25.973 (RFPlayer) 6f 72 22 2c 20 22 69 64 22 3a 20 22 32 35 36 32 39 32 33 32 or",."id":."25629232 2017-07-11 19:12:25.973 (RFPlayer) 38 22 2c 20 22 71 75 61 6c 69 66 69 65 72 22 3a 20 22 30 22 8",."qualifier":."0" 2017-07-11 19:12:25.973 (RFPlayer) 7d 7d 7d 0a 0d .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. }}}.. 2017-07-11 19:12:25.973 (RFPlayer) Calling message handler 'onMessage'. 2017-07-11 19:12:25.973 (RFPlayer) Last Message was 2.956795 seconds ago, Message clear 2017-07-11 19:12:25.973 (RFPlayer) ZIA33{ "frame" :{"header": {"frameType": "0", "cluster": "0", "dataFlag": "0", "rfLevel": "-72", "floorNoise": "-105", "rfQuality": "8", "protocol": "3", "protocolMeaning": "BLYSS", "infoType": "2", "frequency": "433920"},"infos": {"subType": "0", "subTypeMeaning": "Detector/Sensor", "id": "256292328", "qualifier": "0"}}} 2017-07-11 19:12:25.974 (RFPlayer) infoType : 2 2017-07-11 19:12:25.974 (RFPlayer) Error while decoding or reading JSON 2017-07-11 19:12:25.974 (RFPlayer) Debug : Error Decoding/Reading { "frame" :{"header": {"frameType": "0", "cluster": "0", "dataFlag": "0", "rfLevel": "-72", "floorNoise": "-105", "rfQuality": "8", "protocol": "3", "protocolMeaning": "BLYSS", "infoType": "2", "frequency": "433920"},"infos": {"subType": "0", "subTypeMeaning": "Detector/Sensor", "id": "256292328", "qualifier": "0"}}}

J'ai le sentiment que ça vient de l'instruction ci-dessous (ligne 424 du dernier script disponible) mais je ne la comprends pas : qualifier = list(bin(DecData['frame']['infos']['qualifier'])[2:])

zaraki673 commented 7 years ago

arf merci je corrige ca de suite :(

2017-07-11 19:19 GMT+02:00 ogulf notifications@github.com:

J'ai une erreur au chargement du plugin, cf ci-dessous la log dans Domoticz :

2017-07-11 19:07:12.799 Error: (RFplayer) failed to load 'plugin.py', Python Path used was '/home/domoticz/domoticz/plugins/rfplayer/:/usr/lib/ python3.4/:/usr/lib/python3.4/plat-arm-linux-gnueabihf:/usr/ lib/python3.4/lib-dynload'. 2017-07-11 19:07:12.799 Error: (RFPlayer) Module Import failed, exception: 'SyntaxError' 2017-07-11 19:07:12.799 Error: (RFPlayer) Import detail: File: /home/domoticz/domoticz/plugins/rfplayer/plugin.py, Line: 1836549696, offset: 461 2017-07-11 19:07:12.799 Error: (RFPlayer) Error Line ' if SubType == "0" and protocol == ""3 : # blyss '

L'erreur porte sur le test protocol == ""3

J'ai corrigé localement le script ^^ et le plugin se charge bien :)

Par contre, il y a toujours une erreur sur le parse du JSON... :-(

2017-07-11 19:12:25.972 (RFPlayer) Received 325 bytes of data:. 2017-07-11 19:12:25.972 (RFPlayer) 5a 49 41 33 33 7b 20 22 66 72 61 6d 65 22 20 3a 7b 22 68 65 ZIA33{."frame".:{"he 2017-07-11 19:12:25.972 (RFPlayer) 61 64 65 72 22 3a 20 7b 22 66 72 61 6d 65 54 79 70 65 22 3a ader":.{"frameType": 2017-07-11 19:12:25.972 (RFPlayer) 20 22 30 22 2c 20 22 63 6c 75 73 74 65 72 22 3a 20 22 30 22 ."0",."cluster":."0" 2017-07-11 19:12:25.972 (RFPlayer) 2c 20 22 64 61 74 61 46 6c 61 67 22 3a 20 22 30 22 2c 20 22 ,."dataFlag":."0",." 2017-07-11 19:12:25.972 (RFPlayer) 72 66 4c 65 76 65 6c 22 3a 20 22 2d 37 32 22 2c 20 22 66 6c rfLevel":."-72",."fl 2017-07-11 19:12:25.972 (RFPlayer) 6f 6f 72 4e 6f 69 73 65 22 3a 20 22 2d 31 30 35 22 2c 20 22 oorNoise":."-105",." 2017-07-11 19:12:25.972 (RFPlayer) 72 66 51 75 61 6c 69 74 79 22 3a 20 22 38 22 2c 20 22 70 72 rfQuality":."8",."pr 2017-07-11 19:12:25.972 (RFPlayer) 6f 74 6f 63 6f 6c 22 3a 20 22 33 22 2c 20 22 70 72 6f 74 6f otocol":."3",."proto 2017-07-11 19:12:25.972 (RFPlayer) 63 6f 6c 4d 65 61 6e 69 6e 67 22 3a 20 22 42 4c 59 53 53 22 colMeaning":."BLYSS" 2017-07-11 19:12:25.972 (RFPlayer) 2c 20 22 69 6e 66 6f 54 79 70 65 22 3a 20 22 32 22 2c 20 22 ,."infoType":."2",." 2017-07-11 19:12:25.972 (RFPlayer) 66 72 65 71 75 65 6e 63 79 22 3a 20 22 34 33 33 39 32 30 22 frequency":."433920" 2017-07-11 19:12:25.973 (RFPlayer) 7d 2c 22 69 6e 66 6f 73 22 3a 20 7b 22 73 75 62 54 79 70 65 },"infos":.{"subType 2017-07-11 19:12:25.973 (RFPlayer) 22 3a 20 22 30 22 2c 20 22 73 75 62 54 79 70 65 4d 65 61 6e ":."0",."subTypeMean 2017-07-11 19:12:25.973 (RFPlayer) 69 6e 67 22 3a 20 22 44 65 74 65 63 74 6f 72 2f 53 65 6e 73 ing":."Detector/Sens 2017-07-11 19:12:25.973 (RFPlayer) 6f 72 22 2c 20 22 69 64 22 3a 20 22 32 35 36 32 39 32 33 32 or",."id":."25629232 2017-07-11 19:12:25.973 (RFPlayer) 38 22 2c 20 22 71 75 61 6c 69 66 69 65 72 22 3a 20 22 30 22 8",."qualifier":."0" 2017-07-11 19:12:25.973 (RFPlayer) 7d 7d 7d 0a 0d .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. }}}.. 2017-07-11 19:12:25.973 (RFPlayer) Calling message handler 'onMessage'. 2017-07-11 19:12:25.973 (RFPlayer) Last Message was 2.956795 seconds ago, Message clear 2017-07-11 19:12:25.973 (RFPlayer) ZIA33{ "frame" :{"header": {"frameType": "0", "cluster": "0", "dataFlag": "0", "rfLevel": "-72", "floorNoise": "-105", "rfQuality": "8", "protocol": "3", "protocolMeaning": "BLYSS", "infoType": "2", "frequency": "433920"},"infos": {"subType": "0", "subTypeMeaning": "Detector/Sensor", "id": "256292328", "qualifier": "0"}}} 2017-07-11 19:12:25.974 (RFPlayer) infoType : 2 2017-07-11 19:12:25.974 (RFPlayer) Error while decoding or reading JSON 2017-07-11 19:12:25.974 (RFPlayer) Debug : Error Decoding/Reading { "frame" :{"header": {"frameType": "0", "cluster": "0", "dataFlag": "0", "rfLevel": "-72", "floorNoise": "-105", "rfQuality": "8", "protocol": "3", "protocolMeaning": "BLYSS", "infoType": "2", "frequency": "433920"},"infos": {"subType": "0", "subTypeMeaning": "Detector/Sensor", "id": "256292328", "qualifier": "0"}}}

J'ai le sentiment que ça vient de l'instruction ci-dessous (ligne 424 du dernier script disponible) mais je ne la comprends pas : qualifier = list(bin(DecData['frame']['infos']['qualifier'])[2:])

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/sasu-drooz/Domoticz-Rfplayer/issues/21#issuecomment-314513210, or mute the thread https://github.com/notifications/unsubscribe-auth/AHGF7MLzygKd8KIjBTHvm233h0uaLdf6ks5sM664gaJpZM4OUc37 .

zaraki673 commented 7 years ago

voila https://github.com/sasu-drooz/Domoticz-Rfplayer/commit/af676fff13459d7406c74303d884abfc034200da

ca devrait etre bon ;)

ogulf commented 7 years ago

Une dernière petite coquille... La ligne 424 Domoticz.Debug("id_lsb : " + id_lsb + " id_msb : " + id_msb + " subType :" + SubType) doit être dans la condition "if protocol == "2" sinon on utilise des variables qui ne sont pas valorisées.

J'ai bien les 4 boutons dans Domoticz désormais !

zaraki673 commented 7 years ago

manque le changement d'état :(

zaraki673 commented 7 years ago

corrigé pour le changement d'etat: https://github.com/sasu-drooz/Domoticz-Rfplayer/commit/c03b946ab623f4714b834b389939b8126e69062c

ogulf commented 7 years ago

Arf.... :-(

2017-07-12 19:02:28.380 (RFPlayer) ZIA33{ "frame" :{"header": {"frameType": "0", "cluster": "0", "dataFlag": "0", "rfLevel": "-66", "floorNoise": "-106", "rfQuality": "10", "protocol": "3", "protocolMeaning": "BLYSS", "infoType": "2", "frequency": "433920"},"infos": {"subType": "0", "subTypeMeaning": "Detector/Sensor", "id": "256292321", "qualifier": "0"}}} 2017-07-12 19:02:28.380 (RFPlayer) infoType : 2 2017-07-12 19:02:28.380 (RFPlayer) id : 256292321 subType :0 2017-07-12 19:02:28.380 (RFPlayer) Options to find or set : {'id': '256292321', 'infoType': '2', 'subType': '0', 'protocol': '3'} 2017-07-12 19:02:28.380 (RFPlayer) Devices already exist. Unit=14 2017-07-12 19:02:28.380 (RFPlayer) Options find in DB: {'id': '256292321', 'infoType': '2', 'subType': '0', 'protocol': '3'} for devices unit 14 2017-07-12 19:02:28.380 (RFPlayer) Error while decoding or reading JSON 2017-07-12 19:02:28.380 (RFPlayer) Debug : Error Decoding/Reading { "frame" :{"header": {"frameType": "0", "cluster": "0", "dataFlag": "0", "rfLevel": "-66", "floorNoise": "-106", "rfQuality": "10", "protocol": "3", "protocolMeaning": "BLYSS", "infoType": "2", "frequency": "433920"},"infos": {"subType": "0", "subTypeMeaning": "Detector/Sensor", "id": "256292321", "qualifier": "0"}}}

zaraki673 commented 7 years ago

corrigé il me semble : https://github.com/sasu-drooz/Domoticz-Rfplayer/commit/09ce40e8e623cbe4866ab7906b257d0a935d66c0

ogulf commented 7 years ago

problème de format ?

2017-07-12 21:02:41.593 (RFPlayer) ZIA33{ "frame" :{"header": {"frameType": "0", "cluster": "0", "dataFlag": "0", "rfLevel": "-69", "floorNoise": "-105", "rfQuality": "9", "protocol": "3", "protocolMeaning": "BLYSS", "infoType": "2", "frequency": "433920"},"infos": {"subType": "0", "subTypeMeaning": "Detector/Sensor", "id": "256292322", "qualifier": "0"}}} 2017-07-12 21:02:41.594 (RFPlayer) infoType : 2 2017-07-12 21:02:41.594 (RFPlayer) id : 256292322 subType :0 2017-07-12 21:02:41.594 (RFPlayer) Options to find or set : {'infoType': '2', 'protocol': '3', 'subType': '0', 'id': '256292322'} 2017-07-12 21:02:41.594 (RFPlayer) Devices already exist. Unit=15 2017-07-12 21:02:41.594 (RFPlayer) Options find in DB: {'infoType': '2', 'protocol': '3', 'subType': '0', 'id': '256292322'} for devices unit 15 2017-07-12 21:02:41.594 Error: (CDevice_update) RFPlayer - 3 - 256292322: Failed to parse parameters: 'nValue', 'sValue', 'SignalLevel', 'BatteryLevel' or 'Options' expected. 2017-07-12 21:02:41.594 Error: (RFPlayer) 'CDevice_update' failed 'TypeError':'argument 2 must be str, not int'.

Il semblerait que l'état soit à gérer en 0 (off) ou 1 (on), et donc gérer le swap de "0" à "1" ou l'inverse ?

Testé avec succès !! Mais il faut bien forcer le type str(svalue) dans le second argument pour la maj du device....

zaraki673 commented 7 years ago

merci j'ajoute ta modif ;)

zaraki673 commented 7 years ago

je clos, si de nouveau problème on réouvre ;)