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

Begonnen von CoolTux, 20 Oktober 2016, 22:06:57

Vorheriges Thema - Nächstes Thema

CoolTux

Hallo Leute,

So lange eine Modulfamilie zum betreiben der PLAYBULB noch in Arbeit ist, könnt Ihr mit diesem Modul Eure Kerzen mit FHEM steuern
Voraussetzung ist die Installation von bluez mit gatttool.

Ab sofort gibt es das Modul über github

aktuelle Version: 0.8.1
Changelog:

  • Weitere Playbulb als Model hinzugefügt. Besseres Händling nach einem define oder neustart
  • a Attribute gelöscht. Bitte vor neustart auch löschen
  • erkennen der Char Values Anhand der Modelbezeichnung welche als Attribut model gesetzt werden muß
  • neuer set Befehl statusRequest
  • besseres Fehlerhändling. Bei nicht erreichen der Bulb wird der Status auf unreachable gesetzt

Anlegen eines Devices mit

define NAME PlayBulbCandle BTMAC

Danach schauen ob das Attribut model korrekt gesetzt ist wenn nicht ändern.

Viel Spaß mit Euren Kerzen

DOWNLOAD



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

fxstc

Perfekt.
Nachdem ihr mich mit dem Thema Playbulb angefixt hattet, war das genau das was ich gesucht hatte. ;D

Nur Eins kapier ich noch nicht.
Wie bekomme ich den Effekt "Candle" ohne Farben hin ?
Also auf der Orginialfernbedienung "Effekte" - "Candle" und dann Color auf "off".
Wenn ich rgb auf 000000 stelle dann geht die Kerze aus, bei FFFFFF sieht das irgendwie grünlich aus.


CoolTux

In dem Du die Sättigung auf 255 stellst. Dann hasste weiß.
Ich habe nun eine nicht blockierende Version am laufen, Stelle ich heute Abend hier ein. Ist nur eine etwas andere 99_myUtils.


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

CoolTux

So ich habe das ganze um eine nicht Blockierende Version erweitert.



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

richberry22


CoolTux

Ich habe die myUtils erneuert. Im Grunde ist der gesamte Code fertig für ein Modul. Sollte ich tatsächlich die Zeit finden werde ich überlegen ob ich ein vorübergehendes Modul bereit stelle bis das richtige soweit ist.
Ein paar Logiken fehlen aber noch im Code.



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

rhya

Heyo!

Habe hier euren Thread verfolgt und mir die Lampen bei Amazon mal angeschaut. Da steht oft was von 3 Wochen Batterielaufzeit und schlechtem Bluetooth Empfang. Könnt ihr das bestätigen oder entkräften ?


CoolTux

Batterielaufzeit kann ich noch nicht sagen. Bisher eine Woche mit ganz viel Abfragen. Also viele Verbindungen.

Empfang ist bei mir soweit ok. Hin und wieder klemmt was aber das liegt nicht am Empfang. Er kommt wohl mit den einem oder anderen Steuerbefeh manchmal ins Rudern.
Muss aber auch sagen das meine Wohnung eher ein Loft mit dünnen Regibswänden ist.
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

Ich habe den gesamten ersten Thread bearbeitet und eine vorläufige Version von einem Modul für die Candle Teile eingestellt.
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

waschbaerbauch

#9
Ich sage mal Respekt ihr beiden Tüftler ;)

Funktioniert schon fast zu gut für den ersten Wurf! :D

Was mir auf die Schnelle aufgefallen ist:
- Wenn man im FHEM Frontend die Lampe zum On/Off nutzt, dann schaltet er immer mit der Farbe rot ein

Zusätzlich kommt im Log sowas (vielleicht hilft die Info ja):
2016.10.28 18:24:07 1: PERL WARNING: Use of uninitialized value in sprintf at ./FHEM/31_PlayBulbCandle.pm line 166.
2016.10.28 18:24:07 1: PERL WARNING: Use of uninitialized value in sprintf at ./FHEM/31_PlayBulbCandle.pm line 168.
2016.10.28 18:24:07 1: PERL WARNING: Use of uninitialized value $effect in string eq at ./FHEM/31_PlayBulbCandle.pm line 247.
2016.10.28 18:24:07 1: PERL WARNING: Use of uninitialized value $stateOnoff in numeric eq (==) at ./FHEM/31_PlayBulbCandle.pm line 249.
2016.10.28 18:24:08 1: PERL WARNING: Illegal hexadecimal digit ' ' ignored at ./FHEM/31_PlayBulbCandle.pm line 291.
2016.10.28 18:24:08 3: (Sub PlayBulbCandle_Done - PBC.01) - Abschluss!
2016.10.28 18:24:27 1: PERL WARNING: Illegal hexadecimal digit ' ' ignored at ./FHEM/31_PlayBulbCandle.pm line 291.
2016.10.28 18:24:27 3: (Sub PlayBulbCandle_Done - PBC.01) - Abschluss!
2016.10.28 18:24:29 1: PERL WARNING: Use of uninitialized value $arg in numeric ne (!=) at ./FHEM/31_PlayBulbCandle.pm line 125.
2016.10.28 18:24:30 1: PERL WARNING: Illegal hexadecimal digit ' ' ignored at ./FHEM/31_PlayBulbCandle.pm line 291.
2016.10.28 18:24:30 3: (Sub PlayBulbCandle_Done - PBC.01) - Abschluss!
2016.10.28 18:24:33 1: PERL WARNING: Illegal hexadecimal digit ' ' ignored at ./FHEM/31_PlayBulbCandle.pm line 291.
2016.10.28 18:24:33 3: (Sub PlayBulbCandle_Done - PBC.01) - Abschluss!
2016.10.28 18:24:41 1: PERL WARNING: Illegal hexadecimal digit ' ' ignored at ./FHEM/31_PlayBulbCandle.pm line 291.
2016.10.28 18:24:41 3: (Sub PlayBulbCandle_Done - PBC.01) - Abschluss!
2016.10.28 18:24:43 1: PERL WARNING: Illegal hexadecimal digit ' ' ignored at ./FHEM/31_PlayBulbCandle.pm line 291.
2016.10.28 18:24:43 3: (Sub PlayBulbCandle_Done - PBC.01) - Abschluss!
2016.10.28 18:26:24 1: PERL WARNING: Use of uninitialized value $arg in numeric ne (!=) at ./FHEM/31_PlayBulbCandle.pm line 130.
2016.10.28 18:26:24 1: PERL WARNING: Use of uninitialized value $effect in string eq at ./FHEM/31_PlayBulbCandle.pm line 247.
2016.10.28 18:26:24 1: PERL WARNING: Illegal hexadecimal digit ' ' ignored at ./FHEM/31_PlayBulbCandle.pm line 291.
2016.10.28 18:26:24 3: (Sub PlayBulbCandle_Done - PBC.02) - Abschluss!
2016.10.28 18:26:34 1: PERL WARNING: Use of uninitialized value $effect in string eq at ./FHEM/31_PlayBulbCandle.pm line 247.
2016.10.28 18:26:35 1: PERL WARNING: Illegal hexadecimal digit ' ' ignored at ./FHEM/31_PlayBulbCandle.pm line 291.
2016.10.28 18:26:35 3: (Sub PlayBulbCandle_Done - PBC.03) - Abschluss!
2016.10.28 18:26:42 1: PERL WARNING: Use of uninitialized value $effect in string eq at ./FHEM/31_PlayBulbCandle.pm line 247.
2016.10.28 18:26:43 1: PERL WARNING: Illegal hexadecimal digit ' ' ignored at ./FHEM/31_PlayBulbCandle.pm line 291.
2016.10.28 18:26:43 3: (Sub PlayBulbCandle_Done - PBC.04) - Abschluss!
2016.10.28 18:26:58 1: PERL WARNING: Use of uninitialized value $effect in string eq at ./FHEM/31_PlayBulbCandle.pm line 247.
2016.10.28 18:26:59 1: PERL WARNING: Illegal hexadecimal digit ' ' ignored at ./FHEM/31_PlayBulbCandle.pm line 291.
2016.10.28 18:26:59 3: (Sub PlayBulbCandle_Done - PBC.05) - Abschluss!
2016.10.28 18:27:08 1: PERL WARNING: Illegal hexadecimal digit ' ' ignored at ./FHEM/31_PlayBulbCandle.pm line 291.
2016.10.28 18:27:08 3: (Sub PlayBulbCandle_Done - PBC.01) - Abschluss!
2016.10.28 18:27:18 1: PERL WARNING: Illegal hexadecimal digit ' ' ignored at ./FHEM/31_PlayBulbCandle.pm line 291.
2016.10.28 18:27:18 3: (Sub PlayBulbCandle_Done - PBC.02) - Abschluss!
2016.10.28 18:27:20 1: PERL WARNING: Illegal hexadecimal digit ' ' ignored at ./FHEM/31_PlayBulbCandle.pm line 291.
2016.10.28 18:27:20 3: (Sub PlayBulbCandle_Done - PBC.02) - Abschluss!
2016.10.28 18:30:44 1: PERL WARNING: Illegal hexadecimal digit ' ' ignored at ./FHEM/31_PlayBulbCandle.pm line 291.
2016.10.28 18:30:44 3: (Sub PlayBulbCandle_Done - PBC.02) - Abschluss!
2016.10.28 18:30:47 1: Timeout for PlayBulbCandle_Run reached, terminated process 11890
2016.10.28 18:30:47 3: (PBC.05) - The BlockingCall Process terminated unexpectedly. Timedout

(Sub PlayBulbCandle_Run) - gatttool noch aktiv, wait 0.5s for new check

(Sub PlayBulbCandle_Run) - gatttool noch aktiv, wait 0.5s for new check

(Sub PlayBulbCandle_Run) - gatttool noch aktiv, wait 0.5s for new check

(Sub PlayBulbCandle_Run) - gatttool noch aktiv, wait 0.5s for new check

(Sub PlayBulbCandle_Run) - gatttool noch aktiv, wait 0.5s for new check

(Sub PlayBulbCandle_Run) - gatttool noch aktiv, wait 0.5s for new check

(Sub PlayBulbCandle_Run) - gatttool noch aktiv, wait 0.5s for new check

(Sub PlayBulbCandle_Run) - gatttool noch aktiv, wait 0.5s for new check

(Sub PlayBulbCandle_Run) - gatttool noch aktiv, wait 0.5s for new check

(Sub PlayBulbCandle_Run) - gatttool noch aktiv, wait 0.5s for new check

(Sub PlayBulbCandle_Run) - gatttool noch aktiv, wait 0.5s for new check

(Sub PlayBulbCandle_Run) - gatttool noch aktiv, wait 0.5s for new check

(Sub PlayBulbCandle_Run) - gatttool noch aktiv, wait 0.5s for new check

(Sub PlayBulbCandle_Run) - gatttool noch aktiv, wait 0.5s for new check

(Sub PlayBulbCandle_Run) - gatttool noch aktiv, wait 0.5s for new check

(Sub PlayBulbCandle_Run) - gatttool noch aktiv, wait 0.5s for new check
2016.10.28 18:30:48 1: PERL WARNING: Illegal hexadecimal digit ' ' ignored at ./FHEM/31_PlayBulbCandle.pm line 291.
2016.10.28 18:30:48 3: (Sub PlayBulbCandle_Done - PBC.05) - Abschluss!
2016.10.28 18:31:00 1: Timeout for PlayBulbCandle_Run reached, terminated process 11979
2016.10.28 18:31:00 3: (PBC.05) - The BlockingCall Process terminated unexpectedly. Timedout
Characteristic value/descriptor read failed: A timeout occured
2016.10.28 18:32:32 1: PERL WARNING: Illegal hexadecimal digit ' ' ignored at ./FHEM/31_PlayBulbCandle.pm line 291.
2016.10.28 18:32:32 3: (Sub PlayBulbCandle_Done - PBC.05) - Abschluss!
2016.10.28 18:48:34 1: PERL WARNING: Illegal hexadecimal digit ' ' ignored at ./FHEM/31_PlayBulbCandle.pm line 291.
2016.10.28 18:48:34 3: (Sub PlayBulbCandle_Done - PBC.05) - Abschluss!
2016.10.28 18:48:45 1: PERL WARNING: Illegal hexadecimal digit ' ' ignored at ./FHEM/31_PlayBulbCandle.pm line 291.
2016.10.28 18:48:45 3: (Sub PlayBulbCandle_Done - PBC.05) - Abschluss!
2016.10.28 18:48:47 1: PERL WARNING: Illegal hexadecimal digit ' ' ignored at ./FHEM/31_PlayBulbCandle.pm line 291.
2016.10.28 18:48:47 3: (Sub PlayBulbCandle_Done - PBC.05) - Abschluss!
2016.10.28 18:49:03 1: Timeout for PlayBulbCandle_Run reached, terminated process 12145
2016.10.28 18:49:03 3: (PBC.05) - The BlockingCall Process terminated unexpectedly. Timedout

(Sub PlayBulbCandle_Run) - gatttool noch aktiv, wait 0.5s for new check

(Sub PlayBulbCandle_Run) - gatttool noch aktiv, wait 0.5s for new check

(Sub PlayBulbCandle_Run) - gatttool noch aktiv, wait 0.5s for new check

(Sub PlayBulbCandle_Run) - gatttool noch aktiv, wait 0.5s for new check

(Sub PlayBulbCandle_Run) - gatttool noch aktiv, wait 0.5s for new check <- das dann 1200 Einträge in kurzer Zeit in Folge


jump to the top

CoolTux

Das ist nicht das wirkliche Modul so wie es mal sein wird. Das war nur einfach meine myUtils als Modul. Das richtige Modul ist noch in Tests, vorallem wegen dem Framework welches später das IO darstellen wird. Das dauert aber noch etwas.
Dieses Modul ist nur schnell zusammengeschrieben damit einige hier ihre Lampen schalten können. Daher habe ich auch nicht viel Feinheit drin und deswegen geht das Licht immer mit rot an.
Liegt daran weil ich es mit 00000000 ausschalte, also Color 000000.

Die illigal hexadezimal Meldungen sind ok, der Rest kommt wenn keine Verbindung zur Bulb aufgebaut werden kann.



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

waschbaerbauch

Das war auch keine Beschwerde ;)

Das es die temporäre Lösung ist, das hatte ich verstanden - läuft trotzdem erstaunlich gut!

PS: Das mit der Verbindung kann schon sein. Die USB Dongle hängen im EG im Wohnzimmer und die PBs stehen vor mir auf dem Dachboden :D :D

CoolTux

Gibt es denn hin und wieder Probleme beim Schalten?
Was noch stört ist das hin und wieder die Effekte nur kurz anlaufen und dann weg sind.
Das konnte ich noch nicht recht lösen.
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

waschbaerbauch

Eins der wenigen Probleme ist meiner 3,5 Jahre alten Tochter zu erklären das es laut RGB Hex rosa ist und ihr nicht rosa genug :D
Also Darstellung zu Colorpicker  ::)

Sollte ich jemals den für sie passenden Code finden, dann notier ich ihn mir .. .oO( wobei das bei Frauen, egal in welchem Alter, eh sinnlos ist )

Das mit dem Effekt hatte ich ja schon mal im anderen Thread gepostet, das ist hier auch so - manchmal - warum auch immer ...
Grad hatte ich eine PBC die nicht wollte wie ich, einmal den Schiebeschalter aus und wieder ein, dann hat sie wieder gespurt ^^

herrmannj

Zitat von: CoolTux am 28 Oktober 2016, 19:21:12
Gibt es denn hin und wieder Probleme beim Schalten?
Was noch stört ist das hin und wieder die Effekte nur kurz anlaufen und dann weg sind.
Das konnte ich noch nicht recht lösen.
kenn ich - kaputt gespielt. Am Schalter aus und wieder an, mehr hab ich auch nicht