MiLight Wifi iBox2 Controller unter FHEM ansteuern

Begonnen von TJJochen, 07 Dezember 2016, 14:13:20

Vorheriges Thema - Nächstes Thema

tklein

#105
Hallo,

ich versuche gerade verzweifelt das Python-Script ans laufen zu bringen:

pi@pi:~/milight/pythonMilight/domoticz/scripts $ python milight-home.py ON 07 03
[DEBUG - Wed Feb  7 17:54:01 2018] executing MiLight script... got the following arguments passed in: ON - 07 - 03
Traceback (most recent call last):
  File "milight-home.py", line 106, in <module>
    log("executing MiLight script... got the following arguments passed in: " + ' - '.join(sys.argv[1:]))
  File "milight-home.py", line 37, in log
    logfile = open(LOGFILE, "a+")
IOError: [Errno 2] No such file or directory: '/home/pi/domoticz/scripts/milight-home.log'
pi@pi:~/milight/pythonMilight/domoticz/scripts $ ls -la
insgesamt 28
drwxr-xr-x 2 pi pi 4096 Feb  7 17:53 .
drwxr-xr-x 3 pi pi 4096 Feb  7 17:52 ..
-rwxrwxrwx 1 pi pi  157 Feb  7 17:53 .gitignore
-rwxrwxrwx 1 pi pi 6470 Feb  7 17:53 milight-home.py
-rwxrwxrwx 1 pi pi  459 Feb  7 17:53 milight-home-trigger.sh
-rwxrwxrwx 1 pi pi 2307 Feb  7 17:53 README.md
pi@pi:~/milight/pythonMilight/domoticz/scripts $ ^C


Kann mir jemand einen Schubs in die richtige Richtung geben? Rechte habe ich mittlerweile alle vergeben. Die IP-Adress habe ich ebenfalls aktualisiert.
Die Verzeichnisstruktur von Giesela hatte ich auch schon probiert domoticz/scripts --> domoticz-scripts

Grüße
Thomas
FHEM auf Pi 3, Echo (Plus, Dot und Connect), CUL868/433, HM Komponenten, Broadlink, Enigma (VU DUO2), Alexa/Homebridge, Sonoffs (POW, RF, Basic), Wemos D1 (IR, DHT, BH1750, OLED, BMP180), IT/Steckdosen, Fritzbox mit SIP, Wifilight, MQTT, Pilight, Xiaomi Flower Sensor, Spotify, Dooya, Shelly, Conbee2

tklein

#106
Habe den Pfad zur Logdatei angepasst. Allerdings klappt es immer noch nicht:
pi@pi:~/milight/pythonMilight/domoticz/scripts $ python milight-home.py ON 07 03
[DEBUG - Wed Feb  7 19:06:05 2018] executing MiLight script... got the following arguments passed in: ON - 07 - 03
[DEBUG - Wed Feb  7 19:06:05 2018] starting... sending message 20 00 00 00 16 02 62 3A D5 ED A3 01 AE 08 2D 46 61 41 A7 F6 DC AF D3 E6 00 00 1E
Traceback (most recent call last):
  File "milight-home.py", line 113, in <module>
    wSOCK.bind(('', UDP_PORT_RECEIVE))
NameError: name 'wSOCK' is not defined

Muss ich noch einen Port angeben/anpassen? Ist das die PortID, die ich in der GUI von der ibox angeben kann?

UDP_PORT = 8899 # UDP port on which we will communicate with the iBox
UDP_PORT_RECEIVE = 55054 # UDP port on which we will listen for responses


Wo/Wie finde ich den Receiveport? Oder ist das ein Defaultwert?

Sind die restlichen Einstellungen okay? (siehe screen)

So sieht die Logdatei aus:
[DEBUG - Wed Feb  7 19:05:42 2018] executing MiLight script... got the following arguments passed in: ON - 07 - 00
[DEBUG - Wed Feb  7 19:05:42 2018] starting... sending message 20 00 00 00 16 02 62 3A D5 ED A3 01 AE 08 2D 46 61 41 A7 F6 DC AF D3 E6 00 00 1E
[DEBUG - Wed Feb  7 19:06:05 2018] executing MiLight script... got the following arguments passed in: ON - 07 - 03
[DEBUG - Wed Feb  7 19:06:05 2018] starting... sending message 20 00 00 00 16 02 62 3A D5 ED A3 01 AE 08 2D 46 61 41 A7 F6 DC AF D3 E6 00 00 1E
[DEBUG - Wed Feb  7 19:11:17 2018] executing MiLight script... got the following arguments passed in: ON - 07 - 03
[DEBUG - Wed Feb  7 19:11:17 2018] starting... sending message 20 00 00 00 16 02 62 3A D5 ED A3 01 AE 08 2D 46 61 41 A7 F6 DC AF D3 E6 00 00 1E
[DEBUG - Wed Feb  7 20:11:27 2018] executing MiLight script... got the following arguments passed in: ON - 07 - 03
[DEBUG - Wed Feb  7 20:11:27 2018] starting... sending message 20 00 00 00 16 02 62 3A D5 ED A3 01 AE 08 2D 46 61 41 A7 F6 DC AF D3 E6 00 00 1E
[DEBUG - Wed Feb  7 20:11:58 2018] executing MiLight script... got the following arguments passed in: ON - 07 - 02
[DEBUG - Wed Feb  7 20:11:58 2018] starting... sending message 20 00 00 00 16 02 62 3A D5 ED A3 01 AE 08 2D 46 61 41 A7 F6 DC AF D3 E6 00 00 1E
[DEBUG - Wed Feb  7 20:16:57 2018] executing MiLight script... got the following arguments passed in: ON - 07 - 02
[DEBUG - Wed Feb  7 20:16:57 2018] starting... sending message 20 00 00 00 16 02 62 3A D5 ED A3 01 AE 08 2D 46 61 41 A7 F6 DC AF D3 E6 00 00 1E

FHEM auf Pi 3, Echo (Plus, Dot und Connect), CUL868/433, HM Komponenten, Broadlink, Enigma (VU DUO2), Alexa/Homebridge, Sonoffs (POW, RF, Basic), Wemos D1 (IR, DHT, BH1750, OLED, BMP180), IT/Steckdosen, Fritzbox mit SIP, Wifilight, MQTT, Pilight, Xiaomi Flower Sensor, Spotify, Dooya, Shelly, Conbee2

tklein

Hallo zusammen,

ich bin jetzt ein bißchen weiter gekommmen. :-)
Allerdings klappt das mit dem Skript immer noch nicht.


pi@pi:~/milight/pythonMilight/domoticz/scripts $ python milight-home.py ON 00 00
[DEBUG - Sat Feb 10 14:40:12 2018] executing MiLight script... got the following arguments passed in: ON - 00 - 00
[DEBUG - Sat Feb 10 14:40:12 2018] starting... sending message 20 00 00 00 16 02 62 3A D5 ED A3 01 AE 08 2D 46 61 41 A7 F6 DC AF D3 E6 00 00 1E
[DEBUG - Sat Feb 10 14:40:12 2018] received message: 28000000110002f0fe6b72c1d6540769540001410000
[DEBUG - Sat Feb 10 14:40:12 2018] received message: found iBoxID1 41 and iBoxID2 00
[DEBUG - Sat Feb 10 14:40:12 2018] sending the following message: 80 00 00 00 11 41 00 00 00 00 31 00 00 00 03 03 00 00 00 00 00 37
[DEBUG - Sat Feb 10 14:40:12 2018] sending attempt #0
[DEBUG - Sat Feb 10 14:40:12 2018] sending attempt #0: sent!
[DEBUG - Sat Feb 10 14:40:12 2018] sending attempt #1
[DEBUG - Sat Feb 10 14:40:12 2018] sending attempt #1: sent!
[DEBUG - Sat Feb 10 14:40:12 2018] sending attempt #2
[DEBUG - Sat Feb 10 14:40:12 2018] sending attempt #2: sent!
[DEBUG - Sat Feb 10 14:40:12 2018] sending attempt #3
[DEBUG - Sat Feb 10 14:40:12 2018] sending attempt #3: sent!
[DEBUG - Sat Feb 10 14:40:12 2018] sending attempt #4
[DEBUG - Sat Feb 10 14:40:12 2018] sending attempt #4: sent!
[DEBUG - Sat Feb 10 14:40:12 2018] messages are sent!


Aber es passiert nichts.
Ist es normal, dass ein erneuter Aufruf

..
[DEBUG - Sat Feb 10 14:40:14 2018] received message: found iBoxID1 47 and iBoxID2 00
...

liefert? Die iBoxID1 verändert sich und die iBoxID2 00 bleibt gleich.

@ Bitschubser & Gisela: Habt ihr da eine Idee?

Können eigentlich nur die LED-Birnen oder auch RGBWW-Controller gesteuert werden?

Grüße
Thomas
FHEM auf Pi 3, Echo (Plus, Dot und Connect), CUL868/433, HM Komponenten, Broadlink, Enigma (VU DUO2), Alexa/Homebridge, Sonoffs (POW, RF, Basic), Wemos D1 (IR, DHT, BH1750, OLED, BMP180), IT/Steckdosen, Fritzbox mit SIP, Wifilight, MQTT, Pilight, Xiaomi Flower Sensor, Spotify, Dooya, Shelly, Conbee2

Snocksman

#108
Hallo zusammen,

ich habe ein anderes Script auf Github mal geforked und ein bisschen erweitert... Das Script ist hier zu finden: https://github.com/Snocksman/domoticz-and-FHEM-scripts

Farbe, Helligkeit, Saturation und Farbtemperatur sind durch Slider wählbar...

Und hier ein Beispiel, wie ich das ganze in FHEM eingebunden habe:

FUT036 Dual-White LED-Controller (Bei diesem Controller kann leider keine Helligkeit per Slider gesetzt werden, sondern nur per Dim-Up, oder Dim-Down angesteuert werden; das liegt aber am Controller selbst.):

define Milight_Kueche dummy
attr Milight_Kueche alexaName Küchenlicht
attr Milight_Kueche devStateIcon on:on@yellow dim-up:dimup@yellow dim-down:dimdown@yellow night-light:day_night@yellow
attr Milight_Kueche genericDeviceType switch
attr Milight_Kueche room Alexa,Küche
attr Milight_Kueche setList on off
attr Milight_Kueche webCmd on:off:dim-up:dim-down:night-light

define Milight_Kueche_ON notify Milight_Kueche:on "/opt/fhem/scripts/milight-home.py 1 1 ON"
define Milight_Kueche_OFF notify Milight_Kueche:off "/opt/fhem/scripts/milight-home.py 1 1 OFF"
define Milight_Kueche_DIMUP notify Milight_Kueche:dim-up "/opt/fhem/scripts/milight-home.py 1 1 DIMUP"
define Milight_Kueche_DIMDOWN notify Milight_Kueche:dim-down "/opt/fhem/scripts/milight-home.py 1 1 DIMDOWN"
define Milight_Kueche_NIGHT notify Milight_Kueche:night-light "/opt/fhem/scripts/milight-home.py 1 1 NIGHT"


FUT015 RGB+CCT Bulb:

define Milight.Zone1 dummy
attr Milight.Zone1 devStateIcon on:on@yellow white:on@white
attr Milight.Zone1 readingList disco Zone Type hue sat bri ct
attr Milight.Zone1 room Kinderzimmer
attr Milight.Zone1 setList on off Zone Type disco:slider,0,1,10 hsv:colorpicker,HSV,hue,0,1,255,sat,0,1,100,bri,0,1,100 ct:colorpicker,CT,0,1,100
attr Milight.Zone1 userReadings hsv {ReadingsVal($name,'hue','0').','.ReadingsVal($name,'sat','100').','.ReadingsVal($name,'bri','100')}
attr Milight.Zone1 webCmd on:off:white:hsv:ct

define Milight.Zone1_ON notify Milight.Zone1:on "/opt/fhem/scripts/milight-home.py 8 1 ON"
define Milight.Zone1_OFF notify Milight.Zone1:off "/opt/fhem/scripts/milight-home.py 8 1 OFF"
define Milight.Zone1_WHITE notify Milight.Zone1:white "/opt/fhem/scripts/milight-home.py 8 1 WHITE"

define di_Milight.Zone1_HUE DOIF ([Milight.Zone1:hue] < 256) ("/opt/fhem/scripts/milight-home.py [$DEVICE:Type] [$DEVICE:Zone] HUE [$DEVICE:hue]";;)
attr di_Milight.Zone1_HUE checkReadingEvent 1
attr di_Milight.Zone1_HUE do always

define di_Milight.Zone1_SAT DOIF ([Milight.Zone1:sat] < 101) ("/opt/fhem/scripts/milight-home.py [$DEVICE:Type] [$DEVICE:Zone] SATUR [$DEVICE:sat]";;)
attr di_Milight.Zone1_SAT checkReadingEvent 1
attr di_Milight.Zone1_SAT do always

define di_Milight.Zone1_BRI DOIF ([Milight.Zone1:bri] < 101) ("/opt/fhem/scripts/milight-home.py [$DEVICE:Type] [$DEVICE:Zone] BRIGHT [$DEVICE:bri]";;)
attr di_Milight.Zone1_BRI checkReadingEvent 1
attr di_Milight.Zone1_BRI do always

define di_Milight.Zone1_CT DOIF ([Milight.Zone1:ct] < 101) ("/opt/fhem/scripts/milight-home.py [$DEVICE:Type] [$DEVICE:Zone] TEMP [$DEVICE:ct]";;)
attr di_Milight.Zone1_CT checkReadingEvent 1
attr di_Milight.Zone1_CT do always

define di_Milight.Zone1_DISCO DOIF ([Milight.Zone1:disco] > 0) ("/opt/fhem/scripts/milight-home.py [$DEVICE:Type] [$DEVICE:Zone] DISCO[$DEVICE:disco]";;) DOELSE ("/opt/fhem/scripts/milight-home.py [$DEVICE:Type] [$DEVICE:Zone] WHITE")


Wenn jemand gerne noch weitere Funktionen/Controller in das Script integriert hätte, schaue ich gerne was ich tun kann... Und nun viel Spaß damit !!!

Homalix99

Hallo,

werden durch das o. g. python script auch Milight RGBW Controller unterstützt und wenn ja, welche device number hat so ein controller?

VG

Alex
- RPI 4 fhem in Docker, 2 x Arduino Uno, HM-GW, HM-Dev. (Fensterkontakte, HK-Thermostate, div. Aktoren), JeeLink,
- GPIOs, HM-LAN, ESPs (MQTT2)
-Überwachung Fenster/Türen/Licht, HK-Thermostatregelung, Rollosteuerung, Überw. Betriebstemperaturen Heizung, Erfassung Gas/Wasser, PV-Anl., Wetter (WS1600)

Snocksman

Die alten RGBW-Controller (FUT038) haben die Device-ID 7, die 2017er RGBWW Controller (FUT039) haben die Device ID 8.

Homalix99

Danke für die Info, Ich kann die RGB-Stripes mit ControllerID 8 ansprechen.
Allerdings nicht zwischen den RGB-Controllern unterscheiden, beide fühlen sich angesprochen, hängen aber in unterschiedlichen Zonen.
Aufbau: WiFi-GW ist mit beiden RGBW Controllern gekoppelt.
1. Controller in Zone 1
2. Controller in Zone 2
mit ./milight-home.py 8 0 ON werden beide LED Stripes angesprochen
bei ./milight-home.py 8 1 ON oder
bei ./milight-home.py 8 2 ON
passiert nichts.
Woran kann das liegen?

VG

Alex
- RPI 4 fhem in Docker, 2 x Arduino Uno, HM-GW, HM-Dev. (Fensterkontakte, HK-Thermostate, div. Aktoren), JeeLink,
- GPIOs, HM-LAN, ESPs (MQTT2)
-Überwachung Fenster/Türen/Licht, HK-Thermostatregelung, Rollosteuerung, Überw. Betriebstemperaturen Heizung, Erfassung Gas/Wasser, PV-Anl., Wetter (WS1600)

Snocksman

Das Verhalten ist etwas merkwürdig... Ich spreche tatsächlich auch zwei Stripe-Controller über 8 1 bzw.8 2 an und das funktioniert Problemlos. Welchen Controller hast du denn im Einsatz (FUT0??) ?

Homalix99

- RPI 4 fhem in Docker, 2 x Arduino Uno, HM-GW, HM-Dev. (Fensterkontakte, HK-Thermostate, div. Aktoren), JeeLink,
- GPIOs, HM-LAN, ESPs (MQTT2)
-Überwachung Fenster/Türen/Licht, HK-Thermostatregelung, Rollosteuerung, Überw. Betriebstemperaturen Heizung, Erfassung Gas/Wasser, PV-Anl., Wetter (WS1600)

Snocksman

Für den FUT038 sollte eigentlich 7 1 ON bzw 7 2 ON richtig sein... Teste mal bitte, sonst muss ich mir das mal anschauen.

Homalix99

Hallo,

also mit 7 als Controller ID  geht nichts, aber 8 funktioniert bei mir.
Kann jetzt zwischen den beiden Controllern unterscheiden 8 1 ... und 8 2 ..
Funktioniert soweit, bin soweit sehr zufrieden.
Danke nochmals für den Support.

Gruß

Alex
- RPI 4 fhem in Docker, 2 x Arduino Uno, HM-GW, HM-Dev. (Fensterkontakte, HK-Thermostate, div. Aktoren), JeeLink,
- GPIOs, HM-LAN, ESPs (MQTT2)
-Überwachung Fenster/Türen/Licht, HK-Thermostatregelung, Rollosteuerung, Überw. Betriebstemperaturen Heizung, Erfassung Gas/Wasser, PV-Anl., Wetter (WS1600)

trafficlight

könnte mir jemand bei den python script weiter helfen?

log:
sh: 1: /opt/fhem/scripts/milight-home.py: not found

die file ist an diesem ort abgelegt und berechtigung voll also 777

Snocksman

Das hat halt nichts mit dem Python Script selber zu tun, sondern er kann den Ordner oder die Datei nicht finden... Wer ist denn Owner von dem Ordner / von der Datei ? Mach mal ein ls -l

Homalix99

Hallo Trafficlight,
das script hat im Ordner folgende Berechtigungen:

-rwxr-xr-x 1 fhem dialout 23589 Mar 23 20:31 milight-home.py

Den Aufruf in Fhem habe ich z. B. folgendermaßen gemacht:

my $cmd = "/opt/fhem/scripts/milight/milight-home.py 8 2 ON";
my $ret = qx($cmd); # LED Controller einschalten


VG

Alex
- RPI 4 fhem in Docker, 2 x Arduino Uno, HM-GW, HM-Dev. (Fensterkontakte, HK-Thermostate, div. Aktoren), JeeLink,
- GPIOs, HM-LAN, ESPs (MQTT2)
-Überwachung Fenster/Türen/Licht, HK-Thermostatregelung, Rollosteuerung, Überw. Betriebstemperaturen Heizung, Erfassung Gas/Wasser, PV-Anl., Wetter (WS1600)

tiwi

Zitat von: trafficlight am 11 April 2018, 13:31:37
könnte mir jemand bei den python script weiter helfen?

log:
sh: 1: /opt/fhem/scripts/milight-home.py: not found

die file ist an diesem ort abgelegt und berechtigung voll also 777

Du wirst wohl denselben Fehler, wie ich auch gemacht haben und die milight-home.py mit einem Windows Editor auf die korrekte IP der Bridge angepasst haben.
Dann funktioniert aufgrund der Umkodierung die Datei nicht mehr. Kopieren die .py Datei unbearbeitet direkt in den Ordner /opt/fhem/scripts, setze dann den Eigentümer mit sudo chown -R fhem.dialout /opt/fhem/scripts und anschließend mit chmod 755 die Berechtigungen und dann über sudo nano /opt/fhem/scripts/milight-home.py die IP. Dann sollte es laufen. Gruß

hat mich gerade auch mal ne halbe Stunde gekostet :-D