winosaure / MilightAPI

PHP implementation of Milight v6 API
11 stars 1 forks source link

Not working with RGB + CCT led bulb #4

Open Julime opened 6 years ago

Julime commented 6 years ago

This is my current setup: https://www.amazon.de/mi-light-Fernbedienung-Farbwechsel-Leuchtmittel-Spotlights/dp/B075C5MB3W/ref=sr_1_10?ie=UTF8&qid=1511880326&sr=8-10&keywords=milight%2Bgu10&th=1

https://www.amazon.de/TIMER-Mi-Light-Produkte-original-MILIGHT%C2%AE/dp/B01MSR9JHP/ref=sr_1_9?ie=UTF8&qid=1513938515&sr=8-9&keywords=mi-light

cloned repo, set correct ip, run code:

imac:milight julime$ php api.php
/Users/julime/Documents/milight/vendor/winosaure/milight-api/src/v6/Milight.php:87:
string(22) "(\000\000\000\000��kH�j�\000R\000"
/Users/julime/Documents/milight/vendor/winosaure/milight-api/src/v6/Milight.php:87:
string(22) "(\000\000\000\000��kH�j�\000R\000"
/Users/julime/Documents/milight/vendor/winosaure/milight-api/src/v6/Milight.php:87:
string(22) "(\000\000\000\000��kH�j�\000R\000"
/Users/julime/Documents/milight/vendor/winosaure/milight-api/src/v6/Milight.php:87:
string(22) "(\000\000\000\000��kH�j�\000R\000"
/Users/julime/Documents/milight/vendor/winosaure/milight-api/src/v6/Milight.php:87:
string(22) "(\000\000\000\000��kH�j�\000R\000"
/Users/julime/Documents/milight/vendor/winosaure/milight-api/src/v6/Milight.php:87:
string(22) "(\000\000\000\000��kH�j�\000R\000"

The Windows desktop app actually works:

Start Wifi Bridge Session...
Send UDP commands to 10.23.254.249 port 5987
Sent: 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
listenEndPoint udp datagram received length is 22
Received: 28 00 00 00 11 00 02 F0 FE 6B 48 E1 6A 12 A2 1E 03 00 01 FB 01 00
LimitlessLEDWifiBridgeSessionID1 is FB (receivedBytes[19])
LimitlessLEDWifiBridgeSessionID2 is 01 (receivedBytes[20])
The incoming UDP Packet received was from listenEndPoint.Address IP 10.23.254.249 (send-to IP could have been a broadcast IP .255, so we don't know how many bridges might respond)
MAC Address is F0:FE:6B:48:E1:6A ( (receivedBytes[7]..receivedBytes[12])
Send Packet in this format [ 80 00 00 00 11(length in hex) (17 01)(WB1WB2) 00 SN 00 (31 00 00 08 04 01 00 00 00)(v6CommandString) 01(zone) 00 3F(chksum) ]
v6CommandString for this button is: 31 00 00 08 04 01 00 00 00 
Length is: 17 cmd[4] = cmd.Length - 5; set packet length (excluding 5 packet header bytes)
WB1 is: 251 cmd[5] = (byteWifiBridgeSessionID1)
WB2 is: 1 cmd[6] = (byteWifiBridgeSessionID2)
Sequence Number is 05 cmd[8] = SequenceNumber
Checksum is 3E For i = 10 To 20 {intChecksum += cmd[i]} byteChecksum = CByte(intChecksum & 0xFF); cmd[21] = byteChecksum; 
Sent: 80 00 00 00 11 FB 01 00 05 00 31 00 00 08 04 01 00 00 00 00 00 3E
Command SUCCESSFUL.
Received: 88 00 00 00 03 00 05 00
Command completed.
winosaure commented 6 years ago

I can see that your led bulb is RGB + CCT From limitelessled.com/dev we can see that there are different commands for different led bulb so far in my library I only implemented RGBWW, because I have only one bulb.. I will add more commands when I will have more bulbs. While waiting for this, feel free to create a new feature and make pull requests if you find any appropriate command.