[31_PLAYBULB.pm] Modul für MiPow PLAYBULB Candle Bluetooth Lampen

Begonnen von CoolTux, 15 November 2016, 20:22:00

Vorheriges Thema - Nächstes Thema

jonah

Hej.

Ich bin ein absoluter fhem-Noob, habe aber immerhin mittlerweile die Trafri-Lampen eingebunden bekommen.
Mit Freude habe ich dann festgestellt, dass es für meine Playbulbs, die ein eher unbeachtetes Dasein fristen, dieses tolle Modul gibt.  Danke fürs Entwickeln! Ich habe in den letzten Tagen viel hier und verwandten Threads gelesen, bekomme aber einfach keine Verbindung von fhem zu den vier Playbulbs hin. Die Readings sagen stets: unreachable.
Model-Attribut ist gesetzt. Per gatttool kann ich mich verbinden, auch die auf dieser Seite (https://pdominique.wordpress.com/2015/01/02/hacking-playbulb-candles/) benannten Befehle funktionieren gut. Auch gatttool -b 12:5A:4B:10:AC:E6  --characteristics funktioniert.
Ich habe ein aktuelles fhem auf einem Raspberry Pi 2 mit per usb angeschlossenen Bluetooth 4 Dongle.

Über Hilfe würde ich mich sehr freuen. Danke schonmal!

CoolTux

Hallo,

Die Playbulbs dürfen auf keine andere Weise mit irgendwas verbunden sein. Keine App gar nichts.
Auf dem System wo FHEM drauf läuft darf auch keine Verbindung zu den Playbulbs bestehen und es darf kein Hintergrundprozess den Bluetoothstack benutzen.
Es gibt Probleme mit älteren Debian-Systemen. Woody zum Beispiel.


Mach mal verbose auf 5 und Versuch dann ein statusRequest. Log hier in Codetags einstellen.



Grüße
Du musst nicht wissen wie es geht! Du musst nur wissen wo es steht, wie es geht.
Support me to buy new test hardware for development: https://www.paypal.com/paypalme/MOldenburg
My FHEM Git: https://git.cooltux.net/FHEM/
Das TuxNet Wiki:
https://www.cooltux.net

jonah

Hej, danke für die prompte Antwort.
Ich bin auf dem aktuellen Stretch lite.
Mit verbose 5 kommt für Kerze2 (exemplarisch) das hier:


2017.10.22 16:15:17 4: (Sub PLAYBULB - Kerze2) - Call BlockingRun
2017.10.22 16:15:17 4: (Sub PLAYBULB_Run - Kerze2) - Running nonBlocking
2017.10.22 16:15:27 1: Timeout for PLAYBULB_BlockingRun reached, terminated process 15582
2017.10.22 16:15:27 4: (Kerze2) - The BlockingCall Process terminated unexpectedly. Timedout
grep: Schreibfehler: Datenübergabe unterbrochen (broken pipe)


Bezüglich timeout hatte ich auch gesucht, hatte Antwort 221 in diesem Thread gefunden und dann aber festgestellt, dass im Source Code die vorgeschlagene Vergrößerung auf 10 schon angepasst ist.

CoolTux

Du musst nicht wissen wie es geht! Du musst nur wissen wo es steht, wie es geht.
Support me to buy new test hardware for development: https://www.paypal.com/paypalme/MOldenburg
My FHEM Git: https://git.cooltux.net/FHEM/
Das TuxNet Wiki:
https://www.cooltux.net

jonah


PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"
NAME="Raspbian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

CoolTux

ok das passt.

Und Du hast nur einen BT4 Dongle oder ist da noch was internes? schreibst Du auf das richtige hci device?
Du musst nicht wissen wie es geht! Du musst nur wissen wo es steht, wie es geht.
Support me to buy new test hardware for development: https://www.paypal.com/paypalme/MOldenburg
My FHEM Git: https://git.cooltux.net/FHEM/
Das TuxNet Wiki:
https://www.cooltux.net

CoolTux

Du musst nicht wissen wie es geht! Du musst nur wissen wo es steht, wie es geht.
Support me to buy new test hardware for development: https://www.paypal.com/paypalme/MOldenburg
My FHEM Git: https://git.cooltux.net/FHEM/
Das TuxNet Wiki:
https://www.cooltux.net

jonah


Internals:
   BTMAC      AC:E6:4B:07:A4:BE
   DEF        AC:E6:4B:07:A4:BE
   NAME       Kerze2
   NR         24
   STATE      unreachable
   TYPE       PLAYBULB
   VERSION    1.2.8
   READINGS:
     2017-10-22 16:25:17   state           unreachable
   helper:
     color      on
     effect     Candle
     onoff      0
     rgb        ffac30
     sat        0
     speed      120
     statusRequest
Attributes:
   devStateIcon unreachable:light_question
   model      BTL300_v5
   room       Kerzen
   verbose    5
   webCmd     rgb:rgb FF0000:rgb 00FF00:rgb 0000FF:rgb FFFFFF:rgb F7FF00:rgb 00FFFF:rgb F700FF:effect


Ja, ich habe nur den dongle. Woher weiß ich, ob ich auf das richtige device schreibe? (Und ist damit der sendende Dongle gemeint oder die Bulb?)

CoolTux

Zitat von: jonah am 22 Oktober 2017, 17:02:40

Internals:
   BTMAC      AC:E6:4B:07:A4:BE
   DEF        AC:E6:4B:07:A4:BE
   NAME       Kerze2
   NR         24
   STATE      unreachable
   TYPE       PLAYBULB
   VERSION    1.2.8
   READINGS:
     2017-10-22 16:25:17   state           unreachable
   helper:
     color      on
     effect     Candle
     onoff      0
     rgb        ffac30
     sat        0
     speed      120
     statusRequest
Attributes:
   devStateIcon unreachable:light_question
   model      BTL300_v5
   room       Kerzen
   verbose    5
   webCmd     rgb:rgb FF0000:rgb 00FF00:rgb 0000FF:rgb FFFFFF:rgb F7FF00:rgb 00FFFF:rgb F700FF:effect


Ja, ich habe nur den dongle. Woher weiß ich, ob ich auf das richtige device schreibe? (Und ist damit der sendende Dongle gemeint oder die Bulb?)

Der Dongle ist damit gemeint. Die Mac ist korrekt sagst?

Mach mal bitte nur einen statusRequest und Log hier anhängen
Du musst nicht wissen wie es geht! Du musst nur wissen wo es steht, wie es geht.
Support me to buy new test hardware for development: https://www.paypal.com/paypalme/MOldenburg
My FHEM Git: https://git.cooltux.net/FHEM/
Das TuxNet Wiki:
https://www.cooltux.net

jonah

ich hab eben noch mal per ssh im Terminal sudo bluetoothctl ausgeführt, die MAC-Adresse der Bulb ist richtig:


pi@fhem:~ $ sudo bluetoothctl
[NEW] Controller 00:1A:7D:DA:71:0B fhem [default]
[NEW] Device AC:E6:4B:07:A4:BE PLAYBULB CANDLE


statusRequest von Kerze2 ergibt:


2017.10.22 17:44:43 4: (Sub PLAYBULB - Kerze2) - Call BlockingRun
2017.10.22 17:44:43 4: (Sub PLAYBULB_Run - Kerze2) - Running nonBlocking

CoolTux

Zitat von: jonah am 22 Oktober 2017, 17:45:58
ich hab eben noch mal per ssh im Terminal sudo bluetoothctl ausgeführt, die MAC-Adresse der Bulb ist richtig:


pi@fhem:~ $ sudo bluetoothctl
[NEW] Controller 00:1A:7D:DA:71:0B fhem [default]
[NEW] Device AC:E6:4B:07:A4:BE PLAYBULB CANDLE


statusRequest von Kerze2 ergibt:


2017.10.22 17:44:43 4: (Sub PLAYBULB - Kerze2) - Call BlockingRun
2017.10.22 17:44:43 4: (Sub PLAYBULB_Run - Kerze2) - Running nonBlocking


Sorry aber das kann doch nicht die ganze Ausgabe sein. Da muss doch viel mehr stehen?
Du musst nicht wissen wie es geht! Du musst nur wissen wo es steht, wie es geht.
Support me to buy new test hardware for development: https://www.paypal.com/paypalme/MOldenburg
My FHEM Git: https://git.cooltux.net/FHEM/
Das TuxNet Wiki:
https://www.cooltux.net

jonah

Ich will nicht ausschließen, dass ich den statusRequest falsch aufrufe (wie gesagt: ich bin der letzte noob). Kerze2 ist auf verbose 5 gesetzt, dann wähle ich in der DeviceOverview im Dropdownmenü neben set statusRequest und drücke auf set. Anschließend gehe ich links auf Logfile. Das, was dort erscheint, stelle ich hier rein. Gerade nochmal gemacht:

2017.10.22 18:42:48 4: (Sub PLAYBULB - Kerze2) - Call BlockingRun
2017.10.22 18:42:48 4: (Sub PLAYBULB_Run - Kerze2) - Running nonBlocking


Mache ich irgendetwas falsch?

CoolTux

Und das modell ist korrekt eingestellt? Mit richtiger Version?

Wenn ja, schalte Mal die Lampe aus und wieder an, also am Schalter und dann mach ein statusRequest
Du musst nicht wissen wie es geht! Du musst nur wissen wo es steht, wie es geht.
Support me to buy new test hardware for development: https://www.paypal.com/paypalme/MOldenburg
My FHEM Git: https://git.cooltux.net/FHEM/
Das TuxNet Wiki:
https://www.cooltux.net

jonah

Erledigt, das Ergebnis ist das gleiche.
Es handelt sich um Candles, in der App habe ich bei einer der vieren die Version BTL300_v5 ermittelt. Ich habe es auch mit BTL300_v6 probiert - kein Erfolg.

jonah

Ich habe jetzt nochmal verbose 5 global gesetzt, da spuckt das Logfile nach einem statusRequest ein bisschen mehr aus, was anscheinend mit Kerze2 zu tun hat:


2017.10.22 19:35:43 5: Starting notify loop for global, 1 event(s), first is ATTR global verbose 5
2017.10.22 19:35:43 5: createNotifyHash
2017.10.22 19:35:43 5: End notify loop for global
2017.10.22 19:35:43 4: WEB_192.168.178.67_56510 GET /fhem?fw_id=185; BUFLEN:0
2017.10.22 19:35:43 4: WEB: /fhem?fw_id=185 / RL:1225 / text/html; charset=UTF-8 / Content-Encoding: gzip
/
2017.10.22 19:35:44 4: WEB_192.168.178.67_56510 GET /fhem?XHR=1&inform=type=status;filter=;since=1508693742;fmt=JSON&fw_id=185×tamp=1508693745944; BUFLEN:0
2017.10.22 19:35:47 4: Connection closed for WEB_192.168.178.67_56510: EOF
2017.10.22 19:35:47 4: Connection accepted from WEB_192.168.178.67_56517
2017.10.22 19:35:47 4: WEB_192.168.178.67_56517 GET /fhem?room=Kerzen; BUFLEN:0
2017.10.22 19:35:48 4: WEB: /fhem?room=Kerzen / RL:3875 / text/html; charset=UTF-8 / Content-Encoding: gzip
/
2017.10.22 19:35:48 4: WEB_192.168.178.67_56517 GET /fhem?XHR=1&inform=type=status;filter=room=Kerzen;since=1508693746;fmt=JSON&fw_id=189×tamp=1508693750691; BUFLEN:0
2017.10.22 19:35:49 4: Connection closed for WEB_192.168.178.67_56517: EOF
2017.10.22 19:35:49 4: Connection accepted from WEB_192.168.178.67_56521
2017.10.22 19:35:49 4: WEB_192.168.178.67_56521 GET /fhem?detail=Kerze2; BUFLEN:0
2017.10.22 19:35:50 4: WEB: /fhem?detail=Kerze2 / RL:5135 / text/html; charset=UTF-8 / Content-Encoding: gzip
/
2017.10.22 19:35:50 4: WEB_192.168.178.67_56521 GET /fhem?cmd=%7BReadingsVal(%22Kerze2%22%2C%22sat%22%2C%22%22)%7D&XHR=1&fwcsrf=csrf_448637865731307; BUFLEN:0
2017.10.22 19:35:50 5: Cmd: >{ReadingsVal("Kerze2","sat","")}<
2017.10.22 19:35:50 4: WEB: /fhem?cmd=%7BReadingsVal(%22Kerze2%22%2C%22sat%22%2C%22%22)%7D&XHR=1&fwcsrf=csrf_448637865731307 / RL:21 / text/plain; charset=UTF-8 / Content-Encoding: gzip
/
2017.10.22 19:35:50 4: Connection accepted from WEB_192.168.178.67_56522
2017.10.22 19:35:50 4: Connection accepted from WEB_192.168.178.67_56523
2017.10.22 19:35:50 4: WEB_192.168.178.67_56522 GET /fhem?cmd=%7BAttrVal(%22Kerze2%22%2C%22room%22%2C%22%22)%7D&XHR=1&fwcsrf=csrf_448637865731307; BUFLEN:0
2017.10.22 19:35:50 5: Cmd: >{AttrVal("Kerze2","room","")}<
2017.10.22 19:35:50 4: WEB: /fhem?cmd=%7BAttrVal(%22Kerze2%22%2C%22room%22%2C%22%22)%7D&XHR=1&fwcsrf=csrf_448637865731307 / RL:27 / text/plain; charset=UTF-8 / Content-Encoding: gzip
/
2017.10.22 19:35:50 4: WEB_192.168.178.67_56523 GET /fhem?XHR=1&inform=type=status;filter=Kerze2;since=1508693748;fmt=JSON&fw_id=190×tamp=1508693752350; BUFLEN:0
2017.10.22 19:35:54 4: WEB_192.168.178.67_56521 GET /fhem?cmd=%7BAttrVal(%22Kerze2%22%2C%22userReadings%22%2C%22%22)%7D&XHR=1&fwcsrf=csrf_448637865731307; BUFLEN:0
2017.10.22 19:35:54 5: Cmd: >{AttrVal("Kerze2","userReadings","")}<
2017.10.22 19:35:54 4: WEB: /fhem?cmd=%7BAttrVal(%22Kerze2%22%2C%22userReadings%22%2C%22%22)%7D&XHR=1&fwcsrf=csrf_448637865731307 / RL:21 / text/plain; charset=UTF-8 / Content-Encoding: gzip
/
2017.10.22 19:35:57 4: WEB_192.168.178.67_56521 GET /fhem?cmd=%7BReadingsVal(%22Kerze2%22%2C%22statusRequest%22%2C%22%22)%7D&XHR=1&fwcsrf=csrf_448637865731307; BUFLEN:0
2017.10.22 19:35:57 5: Cmd: >{ReadingsVal("Kerze2","statusRequest","")}<
2017.10.22 19:35:57 4: WEB: /fhem?cmd=%7BReadingsVal(%22Kerze2%22%2C%22statusRequest%22%2C%22%22)%7D&XHR=1&fwcsrf=csrf_448637865731307 / RL:21 / text/plain; charset=UTF-8 / Content-Encoding: gzip
/
2017.10.22 19:35:58 4: Connection closed for WEB_192.168.178.67_56523: EOF
2017.10.22 19:35:59 4: WEB_192.168.178.67_56521 POST /fhem&detail=Kerze2&dev.setKerze2=Kerze2&fwcsrf=csrf_448637865731307&cmd.setKerze2=set&arg.setKerze2=statusRequest&val.setKerze2=; BUFLEN:0
2017.10.22 19:35:59 5: Cmd: >set Kerze2 statusRequest<
2017.10.22 19:35:59 4: BlockingCall (PLAYBULB_BlockingRun): created child (21852), uses telnetForBlockingFn_1508675306 to connect back
2017.10.22 19:35:59 4: (Sub PLAYBULB - Kerze2) - Call BlockingRun
2017.10.22 19:35:59 5: Starting notify loop for Kerze2, 1 event(s), first is statusRequest
2017.10.22 19:35:59 5: createNotifyHash
2017.10.22 19:35:59 5: End notify loop for Kerze2
2017.10.22 19:35:59 4: Connection accepted from telnetForBlockingFn_1508675306_127.0.0.1_35376
2017.10.22 19:35:59 5: Cmd: >{BlockingRegisterTelnet($cl,35)}<
2017.10.22 19:35:59 4: (Sub PLAYBULB_Run - Kerze2) - Running nonBlocking
2017.10.22 19:35:59 4: WEB_192.168.178.67_56521 GET /fhem?detail=Kerze2&fw_id=; BUFLEN:0
2017.10.22 19:35:59 4: WEB: /fhem?detail=Kerze2&fw_id= / RL:5135 / text/html; charset=UTF-8 / Content-Encoding: gzip
/
2017.10.22 19:36:00 4: WEB_192.168.178.67_56521 GET /fhem?cmd=%7BReadingsVal(%22Kerze2%22%2C%22sat%22%2C%22%22)%7D&XHR=1&fwcsrf=csrf_448637865731307; BUFLEN:0
2017.10.22 19:36:00 5: Cmd: >{ReadingsVal("Kerze2","sat","")}<
2017.10.22 19:36:00 4: WEB: /fhem?cmd=%7BReadingsVal(%22Kerze2%22%2C%22sat%22%2C%22%22)%7D&XHR=1&fwcsrf=csrf_448637865731307 / RL:21 / text/plain; charset=UTF-8 / Content-Encoding: gzip
/
2017.10.22 19:36:00 4: WEB_192.168.178.67_56522 GET /fhem?cmd=%7BAttrVal(%22Kerze2%22%2C%22room%22%2C%22%22)%7D&XHR=1&fwcsrf=csrf_448637865731307; BUFLEN:0
2017.10.22 19:36:00 5: Cmd: >{AttrVal("Kerze2","room","")}<
2017.10.22 19:36:00 4: WEB: /fhem?cmd=%7BAttrVal(%22Kerze2%22%2C%22room%22%2C%22%22)%7D&XHR=1&fwcsrf=csrf_448637865731307 / RL:27 / text/plain; charset=UTF-8 / Content-Encoding: gzip
/
2017.10.22 19:36:00 4: Connection accepted from WEB_192.168.178.67_56535
2017.10.22 19:36:00 4: WEB_192.168.178.67_56535 GET /fhem?XHR=1&inform=type=status;filter=Kerze2;since=1508693758;fmt=JSON&fw_id=190×tamp=1508693762059; BUFLEN:0
2017.10.22 19:36:01 4: Connection closed for WEB_192.168.178.67_56535: EOF
2017.10.22 19:36:01 4: WEB_192.168.178.67_56521 GET /fhem/FileLog_logWrapper?dev=Logfile&type=text&file=fhem-2017-10.log; BUFLEN:0


Hilft das?