Intégration interrupteur Schneider Wiser volet roulant, problème connexions bluetooth

Bonjour,

Je suis en train d’essayer d’intégrer au plugin blea l’interrupteur Schneider Wiser pour volet roulants, je reprends la suite de quelques messages postés sur le sujet suivant.

Voici l’interrupteur

Je souhaite équiper toute la maison de ces modules et je pensais avant l’achat qu’ils étaient compatible avec jeedom au travers du plugin Odace SFSP, je me rendu compte que ce n’était pas le cas car même gamme différente donc je me suis lancé pour voir leur intégration via le plugin blea.

J’ai pas mal avancé et je suis presque à la fin d’intégration fonctionnelle mais j’ai encore des problèmes de connexions / déconnexions bluetooth sur mon intégration, je suis preneur de tout aide pour terminer.

Je suis sur une box JeedUP avec jeedom 4.1, j’utilise le bluetooth intégré
Pour résumé :

  • Sur ma box j’ai un problème de connexion lente et/ou qui échoue 1,2,3 fois puis un problème de déconnexion sauvage (par le thread du plugin)
  • Lors de mes devs et tests depuis un script python sur un raspbery avec clef bluetooth je n’observe pas ces problèmes de bluetooth.
  • Avant j’avais aussi des problèmes de « concurrent poll() invocation » après écriture sur registre gatt, j’ai résolu en mettant à jour la libraire bluepy sur la dernière version 1.3.0 (qui corrige des problèmes d’accès concurrents sur le write)

Le fichier de log complet
blea_local_forum.txt (78,3 Ko)

La partie problématique qui se connecte puis envoi la commande à l’interrupteur, ça fonctionne mais ça me semble instable, en plus d’autres fois la connexion met plusieurs dizaine de seconde voir minutes à se faire (sur 2, ou 3 ème tentative)
WiserShutter correspond à ma classe en pièce jointe

[2021-02-04 23:15:46.233][DEBUG] : Message read from socket: b'{"apikey":"fakekey","cmd":"action","device":{"id":"D0:CF:5E:0D:A7:D1"},"command":{"name":"wisershutter","action":"up","device":{"id":"D0:CF:5E:0D:A7:D1","delay":0,"needsrefresh":"0","name":"wisershutter"}}}'
[2021-02-04 23:15:46.234][DEBUG] : Client disconnected from [127.0.0.1:48366]
[2021-02-04 23:15:46.461][DEBUG] : SOCKET-READ------Message received in socket JEEDOM_SOCKET_MESSAGE
[2021-02-04 23:15:46.463][DEBUG] : SOCKET-READ------Received command from jeedom : action
[2021-02-04 23:15:46.463][DEBUG] : SOCKET-READ------Attempt an action on a device
[2021-02-04 23:15:46.466][DEBUG] : BeeWiSmartLite------manuf:  name:wisershutter data:
[2021-02-04 23:15:46.466][DEBUG] : SOCKET-READ------Action Thread Launched
[2021-02-04 23:15:46.469][DEBUG] : WiserShutter--isValid()=true : name=wisershutter manuf= data= mac=
[2021-02-04 23:15:46.470][DEBUG] : WiserShutter--action(): {'apikey': 'fakekey', 'cmd': 'action', 'device': {'id': 'D0:CF:5E:0D:A7:D1', 'localname': 'wisershutter'}, 'command': {'name': 'wisershutter', 'action': 'up', 'device': {'id': 'D0:CF:5E:0D:A7:D1', 'delay': 0, 'needsrefresh': '0', 'name': 'wisershutter'}}}
[2021-02-04 23:15:46.471][DEBUG] : WiserShutter--sendCommand() : up on D0:CF:5E:0D:A7:D1
[2021-02-04 23:15:46.472][DEBUG] : UTILS------Creating a new connection for D0:CF:5E:0D:A7:D1
[2021-02-04 23:15:46.473][DEBUG] : CONNECTOR------Connecting : D0:CF:5E:0D:A7:D1 with bluetooth 0
[2021-02-04 23:15:47.035][DEBUG] : CONNECTOR------Failed to connect to peripheral D0:CF:5E:0D:A7:D1, addr type: public attempt 1
[2021-02-04 23:15:48.640][DEBUG] : CONNECTOR------Connected... D0:CF:5E:0D:A7:D1
[2021-02-04 23:15:48.641][DEBUG] : WiserShutter--sendCommand() : UP
[2021-02-04 23:15:48.642][DEBUG] : CONNECTOR------Writing Characteristic... D0:CF:5E:0D:A7:D1
[2021-02-04 23:15:48.708][DEBUG] : No name in data but i know it is : wisershutter
[2021-02-04 23:15:48.710][DEBUG] : BeeWiSmartLite------manuf: b602010020000b0200ff00090600000000000000000000000000 name:wisershutter data:
[2021-02-04 23:15:48.712][DEBUG] : WiserShutter--isValid()=true : name=wisershutter manuf=b602010020000b0200ff00090600000000000000000000000000 data= mac=d0:cf:5e:0d:a7:d1
[2021-02-04 23:15:48.713][DEBUG] : SCANNER------This is a wisershutter device d0:cf:5e:0d:a7:d1
[2021-02-04 23:15:48.714][DEBUG] : WiserShutter--parse() : name=wisershutter manuf=b602010020000b0200ff00090600000000000000000000000000 data= mac=d0:cf:5e:0d:a7:d1
[2021-02-04 23:15:48.714][DEBUG] : WiserShutter--parse() : operation=00 position=ff
[2021-02-04 23:15:48.715][DEBUG] : WiserShutter--parse() : {'status': 'closed', 'label': 'Fermé', 'position': 100, 'present': 1, 'id': 'd0:cf:5e:0d:a7:d1'}
[2021-02-04 23:15:48.715][DEBUG] : {'status': 'closed', 'label': 'Fermé', 'position': 100, 'present': 1, 'id': 'D0:CF:5E:0D:A7:D1', 'type': 'wisershutter', 'name': 'wisershutter', 'rssi': -81, 'source': 'local'}
[2021-02-04 23:15:48.763][DEBUG] : Send to jeedom : {'devices': {'D0:CF:5E:0D:A7:D1': {'status': 'closed', 'label': 'Fermé', 'position': 100, 'present': 1, 'id': 'D0:CF:5E:0D:A7:D1', 'type': 'wisershutter', 'name': 'wisershutter', 'rssi': -81, 'source': 'local'}}}
[2021-02-04 23:15:48.771][DEBUG] : Starting new HTTP connection (1): 127.0.0.1:80
[2021-02-04 23:15:48.801][DEBUG] : http://127.0.0.1:80 "POST /plugins/blea/core/php/jeeBlea.php?apikey=fakekey HTTP/1.1" 200 0
[2021-02-04 23:15:48.926][DEBUG] : HEARTBEAT------This antenna should not keep a connection with this device, disconnecting D0:CF:5E:0D:A7:D1
[2021-02-04 23:15:48.927][DEBUG] : CONNECTOR------Disconnecting... D0:CF:5E:0D:A7:D1
[2021-02-04 23:15:48.932][DEBUG] : CONNECTOR------'NoneType' object has no attribute 'poll' attempt 1
[2021-02-04 23:15:48.933][DEBUG] : Device disconnected
[2021-02-04 23:15:48.934][DEBUG] : CONNECTOR------Disconnected...D0:CF:5E:0D:A7:D1
[2021-02-04 23:15:48.934][DEBUG] : CONNECTOR------Retry connection D0:CF:5E:0D:A7:D1
[2021-02-04 23:15:48.935][DEBUG] : HEARTBEAT------Removed from keep connection list D0:CF:5E:0D:A7:D1
[2021-02-04 23:15:48.936][DEBUG] : CONNECTOR------Connecting : D0:CF:5E:0D:A7:D1 with bluetooth 0
[2021-02-04 23:15:48.964][DEBUG] : CONNECTOR------Connected... D0:CF:5E:0D:A7:D1
[2021-02-04 23:15:49.230][DEBUG] : No name in data but i know it is : wisershutter
[2021-02-04 23:15:49.232][DEBUG] : BeeWiSmartLite------manuf: b602010020000b0201ff00090400000000000000000000000000 name:wisershutter data:
[2021-02-04 23:15:49.234][DEBUG] : WiserShutter--isValid()=true : name=wisershutter manuf=b602010020000b0201ff00090400000000000000000000000000 data= mac=d0:cf:5e:0d:a7:d1
[2021-02-04 23:15:49.234][DEBUG] : SCANNER------This is a wisershutter device d0:cf:5e:0d:a7:d1
[2021-02-04 23:15:49.234][DEBUG] : WiserShutter--parse() : name=wisershutter manuf=b602010020000b0201ff00090400000000000000000000000000 data= mac=d0:cf:5e:0d:a7:d1
[2021-02-04 23:15:49.235][DEBUG] : WiserShutter--parse() : operation=01 position=ff
[2021-02-04 23:15:49.235][DEBUG] : WiserShutter--parse() : {'status': 'opening', 'label': 'Ouverture', 'position': 100, 'present': 1, 'id': 'd0:cf:5e:0d:a7:d1'}
[2021-02-04 23:15:49.236][DEBUG] : {'status': 'opening', 'label': 'Ouverture', 'position': 100, 'present': 1, 'id': 'D0:CF:5E:0D:A7:D1', 'type': 'wisershutter', 'name': 'wisershutter', 'rssi': -81, 'source': 'local'}
[2021-02-04 23:15:49.375][DEBUG] : CONNECTOR------Characteristic written... D0:CF:5E:0D:A7:D1
[2021-02-04 23:15:49.378][DEBUG] : {'rsp': ['wr']}
[2021-02-04 23:15:49.379][DEBUG] : WiserShutter--sendCommand() : action writed: True
[2021-02-04 23:15:49.508][DEBUG] : Send to jeedom : {'devices': {'D0:CF:5E:0D:A7:D1': {'status': 'opening', 'label': 'Ouverture', 'position': 100, 'present': 1, 'id': 'D0:CF:5E:0D:A7:D1', 'type': 'wisershutter', 'name': 'wisershutter', 'rssi': -81, 'source': 'local'}}}
[2021-02-04 23:15:49.516][DEBUG] : Starting new HTTP connection (1): 127.0.0.1:80
[2021-02-04 23:15:49.584][DEBUG] : http://127.0.0.1:80 "POST /plugins/blea/core/php/jeeBlea.php?apikey=fakekey HTTP/1.1" 200 0
[2021-02-04 23:15:50.295][DEBUG] : No name in data but i know it is : wisershutter
[2021-02-04 23:15:50.297][DEBUG] : BeeWiSmartLite------manuf: b602010020000b0201f900090400000000000000000000000000 name:wisershutter data:
[2021-02-04 23:15:50.298][DEBUG] : WiserShutter--isValid()=true : name=wisershutter manuf=b602010020000b0201f900090400000000000000000000000000 data= mac=d0:cf:5e:0d:a7:d1
[2021-02-04 23:15:50.298][DEBUG] : SCANNER------This is a wisershutter device d0:cf:5e:0d:a7:d1
[2021-02-04 23:15:50.299][DEBUG] : WiserShutter--parse() : name=wisershutter manuf=b602010020000b0201f900090400000000000000000000000000 data= mac=d0:cf:5e:0d:a7:d1
[2021-02-04 23:15:50.299][DEBUG] : WiserShutter--parse() : operation=01 position=f9
[2021-02-04 23:15:50.299][DEBUG] : WiserShutter--parse() : {'status': 'opening', 'label': 'Ouverture', 'position': 97, 'present': 1, 'id': 'd0:cf:5e:0d:a7:d1'}

La classe python en question, je n’utilise plus la partie notification depuis que j’ai décodé les trames advertisées qui contiennent aussi les infos qui m’intéresse.
wisershutter.txt (9,9 Ko)

La config json si besoin
wisershutter_json.txt (3,2 Ko)

J’ai une autre question sur comment gérer un paramétrage de l’interrupteur, en effet on doit régler le temps de course pour pouvoir gérer correctement le % d’ouverture / fermeture.
Est ce qu’il y a moyen d’avoir une config spécifique sur un device dans le plugin ?
J’ai ajouté une action + info avec un widget heureminute pour le gérer pour l’instant mais ça me semble inadapté.

widget

Dans l’idéal il me faudrait une fenêtre de config comme en enocean, est ce possible via blea ?

Personne dans les parages pour une relecture de code ? @arnog23 tu semblais partant pour m’aider sur l’autre topic.

J’ai fait une mise à jour du code, voici la dernière version
wisershutter.txt (8,5 Ko)
wisershutter_json.txt (3,8 Ko)

J’ai toujours des soucis de connexion qui des fois ne fonctionne pas malgré 3 tentatives, exemple :

[2021-02-21 18:57:03.784][DEBUG] : UTILS------Creating a new connection for D0:CF:5E:55:00:B3
[2021-02-21 18:57:03.785][DEBUG] : CONNECTOR------Connecting : D0:CF:5E:55:00:B3 with bluetooth 0
[2021-02-21 18:57:03.912][DEBUG] : CONNECTOR------Failed to connect to peripheral D0:CF:5E:55:00:B3, addr type: public attempt 1
[2021-02-21 18:57:04.936][DEBUG] : CONNECTOR------Failed to connect to peripheral D0:CF:5E:55:00:B3, addr type: public attempt 2
[2021-02-21 18:57:05.383][DEBUG] : Send to jeedom :  {'heartbeat': 1, 'source': 'local', 'version': '2.9'}
[2021-02-21 18:57:05.393][DEBUG] : Starting new HTTP connection (1): 127.0.0.1:80
[2021-02-21 18:57:05.417][DEBUG] : http://127.0.0.1:80 "POST /plugins/blea/core/php/jeeBlea.php?apikey=key HTTP/1.1" 200 0
[2021-02-21 18:57:05.963][DEBUG] : CONNECTOR------Failed to connect to peripheral D0:CF:5E:55:00:B3, addr type: public attempt 3
[2021-02-21 18:57:05.963][DEBUG] : CONNECTOR------Issue connecting to : D0:CF:5E:55:00:B3 with bluetooth 0 the device is busy or too far
[2021-02-21 18:57:05.964][DEBUG] : CONNECTOR------Connecting : D0:CF:5E:55:00:B3 with bluetooth 0
[2021-02-21 18:57:05.982][DEBUG] : CONNECTOR------Failed to connect to peripheral D0:CF:5E:55:00:B3, addr type: public attempt 1
[2021-02-21 18:57:07.010][DEBUG] : CONNECTOR------Failed to connect to peripheral D0:CF:5E:55:00:B3, addr type: public attempt 2
[2021-02-21 18:57:08.037][DEBUG] : CONNECTOR------Failed to connect to peripheral D0:CF:5E:55:00:B3, addr type: public attempt 3
[2021-02-21 18:57:08.037][DEBUG] : CONNECTOR------Issue connecting to : D0:CF:5E:55:00:B3 with bluetooth 0 the device is busy or too far
[2021-02-21 18:57:08.037][ERROR] : WiserShutter--sendCommand() : Failed to initConnection for D0:CF:5E:55:00:B3
[2021-02-21 18:57:08.180][DEBUG] : No name in data but i know it is : wisershutter
[2021-02-21 18:57:08.182][DEBUG] : BeeWiSmartLite------manuf: b602010020000b00000000090600000000000000000000000000 name:wisershutter data:

D’autre fois la connexion est ok, ça commence l’action puis je me fais déconnecter en plein milieu par l’autre thread heartbeat, comment faire pour ne pas déconnecter alors ma commande est en cours d’envoi ?


[2021-02-21 18:59:03.401][DEBUG] : WiserShutter--isValid()=true : name=wisershutter manuf= data= mac=
[2021-02-21 18:59:03.401][DEBUG] : WiserShutter--action(): {'apikey': 'key', 'cmd': 'action', 'device': {'id': 'D0:CF:5E:55:03:18', 'localname': 'wisershutter'}, 'command': {'name': 'wisershutter', 'action': 'down', 'device': {'id': 'D0:CF:5E:55:03:18', 'delay': 0, 'needsrefresh': '0', 'name': 'wisershutter'}}}
[2021-02-21 18:59:03.402][INFO] : WiserShutter--sendCommand() : down on D0:CF:5E:55:03:18
[2021-02-21 18:59:03.402][DEBUG] : WiserShutter--initConnection() for D0:CF:5E:55:03:18
[2021-02-21 18:59:03.403][DEBUG] : UTILS------Creating a new connection for D0:CF:5E:55:03:18
[2021-02-21 18:59:03.403][DEBUG] : CONNECTOR------Connecting : D0:CF:5E:55:03:18 with bluetooth 0
[2021-02-21 18:59:03.404][DEBUG] : SOCKET-READ------Action Thread Launched
[2021-02-21 18:59:03.692][DEBUG] : CONNECTOR------Connected... D0:CF:5E:55:03:18
[2021-02-21 18:59:03.694][DEBUG] : CONNECTOR------Reading Characteristic...D0:CF:5E:55:03:18
[2021-02-21 18:59:03.828][DEBUG] : No name in data but i know it is : wisershutter
[2021-02-21 18:59:03.829][DEBUG] : BeeWiSmartLite------manuf: b602010020000b00000000090600000000000000000000000000 name:wisershutter data:
[2021-02-21 18:59:03.829][DEBUG] : WiserShutter--isValid()=true : name=wisershutter manuf=b602010020000b00000000090600000000000000000000000000 data= mac=d0:cf:5e:55:03:18
[2021-02-21 18:59:03.830][DEBUG] : SCANNER------This is a wisershutter device d0:cf:5e:55:03:18
[2021-02-21 18:59:03.830][DEBUG] : WiserShutter--parse() : name=wisershutter manuf=b602010020000b00000000090600000000000000000000000000 data= mac=d0:cf:5e:55:03:18
[2021-02-21 18:59:03.830][DEBUG] : WiserShutter--parse() : operation=00 position=00
[2021-02-21 18:59:03.830][DEBUG] : WiserShutter--parse() : {'status': 'opened', 'label': 'Ouvert', 'position': 0, 'present': 1, 'id': 'd0:cf:5e:55:03:18'}
[2021-02-21 18:59:03.830][DEBUG] : {'status': 'opened', 'label': 'Ouvert', 'position': 0, 'present': 1, 'id': 'D0:CF:5E:55:03:18', 'type': 'wisershutter', 'name': 'wisershutter', 'rssi': -63, 'source': 'local'}
[2021-02-21 18:59:03.838][DEBUG] : CONNECTOR------Characteristic Readen .... D0:CF:5E:55:03:18
[2021-02-21 18:59:03.838][DEBUG] : CONNECTOR------Reading Characteristic...D0:CF:5E:55:03:18
[2021-02-21 18:59:03.933][DEBUG] : CONNECTOR------Characteristic Readen .... D0:CF:5E:55:03:18
[2021-02-21 18:59:03.933][INFO] : WiserShutter--readStatus() : read name=Schneider_5E550318 and paired=True
[2021-02-21 18:59:03.933][DEBUG] : WiserShutter--initConnection(): success Schneider_5E550318 for D0:CF:5E:55:03:18
[2021-02-21 18:59:03.934][DEBUG] : WiserShutter--sendCommand() : DOWN
[2021-02-21 18:59:03.934][DEBUG] : CONNECTOR------Writing Characteristic... D0:CF:5E:55:03:18
[2021-02-21 18:59:03.943][DEBUG] : Send to jeedom : {'devices': {'D0:CF:5E:55:03:18': {'status': 'opened', 'label': 'Ouvert', 'position': 0, 'present': 1, 'id': 'D0:CF:5E:55:03:18', 'type': 'wisershutter', 'name': 'wisershutter', 'rssi': -63, 'source': 'local'}}}
[2021-02-21 18:59:03.948][DEBUG] : Starting new HTTP connection (1): 127.0.0.1:80
[2021-02-21 18:59:03.979][DEBUG] : http://127.0.0.1:80 "POST /plugins/blea/core/php/jeeBlea.php?apikey=key HTTP/1.1" 200 0
[2021-02-21 18:59:04.547][DEBUG] : HEARTBEAT------This antenna should not keep a connection with this device, disconnecting D0:CF:5E:55:03:18
[2021-02-21 18:59:04.548][DEBUG] : CONNECTOR------Disconnecting... D0:CF:5E:55:03:18
[2021-02-21 18:59:04.553][DEBUG] : Device disconnected
[2021-02-21 18:59:04.554][DEBUG] : CONNECTOR------'NoneType' object has no attribute 'poll' attempt 1
[2021-02-21 18:59:04.554][DEBUG] : CONNECTOR------Retry connection D0:CF:5E:55:03:18
[2021-02-21 18:59:04.555][DEBUG] : CONNECTOR------Disconnected...D0:CF:5E:55:03:18
[2021-02-21 18:59:04.556][DEBUG] : CONNECTOR------Connecting : D0:CF:5E:55:03:18 with bluetooth 0
[2021-02-21 18:59:04.556][DEBUG] : HEARTBEAT------Removed from keep connection list D0:CF:5E:55:03:18
[2021-02-21 18:59:04.576][DEBUG] : CONNECTOR------Connected... D0:CF:5E:55:03:18
[2021-02-21 18:59:04.616][DEBUG] : CONNECTOR------Characteristic written... D0:CF:5E:55:03:18
[2021-02-21 18:59:04.617][DEBUG] : {'rsp': ['wr']}
[2021-02-21 18:59:04.618][INFO] : WiserShutter--sendCommand() : Action down writed: True
[2021-02-21 18:59:04.651][DEBUG] : No name in data but i know it is : wisershutter

J’ai l’impression que mon problème est matériel ou la stack bluetooth de ma box (JeedUP en 4.1.20) mais en dehors de mon code vu que ça marche la plupart du temps.

Salut.
A tout hasard @bighux, tu as réussi à régler tes temps de course avec jeedom depuis tes derniers posts ?

1 « J'aime »

Bonjour,

Oui j’ai réussi à mettre les temps de course, voir ma pull request si besoin de récupérer le code. Je n’ai pas réussi à stabiliser ma stack bluetooth donc ça fonctionne 90% du temps mais c’est peut être lié à ma box jeedom (jeedup).

Je n’ai plus trop de temps à chercher sans aide et Schneider a sorti une nouvelle gamme d’interrupteur en Zigbee donc je vais rester le seul à avoir interfacé mes interrupteurs via ce plugin.