openhab / openhab-addons

Add-ons for openHAB
https://www.openhab.org/
Eclipse Public License 2.0
1.88k stars 3.59k forks source link

Wifi LED Binding Support for more devices #2296

Closed serhatozkara closed 6 years ago

serhatozkara commented 7 years ago

It would be great to add support for these cheap esp8266 based LED lamps: https://tr.aliexpress.com/item/AC85-240V-5W-7W-9W-RGBW-WIFI-LED-Bulb-Light-Colorful-Dimmable-LED-Light-Support-IOS/32785628736.html Commands consist of 9 bytes, first 3 bytes represent the mode and last byte value always is ef. preset modes always start with: 7e:05:03. RGB mode RGB value bytes are 5. 6. and 7. bytes (0 - 255) in hex. Dimming values are 00 - 64 in hex (100 values). Data is sent to bulb via UDP port 5000

I've added some sample packets in the attachment. rgb led light dump.txt

davidgraeff commented 7 years ago

If the leds do not support discovery, it is probably not worth it to support them. You can use the udp binding or exec binding with socat in the meantime.

serhatozkara commented 7 years ago

How can i tell if it supports discovery or not? Then I can give you more specific information. With UDP binding i only can turn it on and off. What do you mean by socat?

davidgraeff commented 7 years ago

socat is a command line tool that can be used to send packets over udp. Just another way instead of the udp binding.

Does the app of that company recognises the bulbs in the network on its own or do you need to configure them? The former would be an autodiscovery.

Is there a "bridge" necessary or do the bulbs speak wifi directly?

How are the bulbs configured to join your homenetwork?

serhatozkara commented 7 years ago

The device works solely on wifi and does not need a bridge. It's based on ESP8266. Pairing is done by connecting the access point FCxxx and launching the mobile app afterwards. Then the app asks which access point to connect the device and then entering the SSID and the password. After that device gets connected to your network and initial setup is complete. You dont need any more pairing after that. Application then lists all the lamps on the network that you're connected to, and you can then control each of them from the app. I can manually enter the IP from Wifi Led Binding and the device gets listed but i can't control it. Let me know if you need more details. This is the link for the app: https://itunes.apple.com/us/app/dreamcolor/id1026648253

serhatozkara commented 7 years ago

I can inspect the packets when app lists all the bulbs on the network and dump them if it's any help.

davidgraeff commented 7 years ago

This would be helpful yes

serhatozkara commented 7 years ago

So i figured it out. When app searches for all connected bulbs, it sends a UDP packet to port 5000 of 255.255.255.255 (broadcasthost) with "7e 07 09 ff ff ff ff ff ef" as data. And then lamps respond with UDP packet sent to 255.255.255.255 with their mac address:

Frame 15154: 51 bytes on wire (408 bits), 51 bytes captured (408 bits) on interface 0
Ethernet II, Src: Apple_12:23:fb (cc:c7:6c:12:23:fb), Dst: Broadcast (ff:ff:ff:ff:ff:ff)
Internet Protocol Version 4, Src: iPad.local (192.168.2.2), Dst: broadcasthost (255.255.255.255)
User Datagram Protocol, Src Port: x11 (6000), Dst Port: commplex-main (5000)
Source Port: x11 (6000)
Destination Port: commplex-main (5000)
<Source or Destination Port: x11 (6000)>
<Source or Destination Port: commplex-main (5000)>
Length: 17
Checksum: 0x9b22 [validation disabled]
    [Good Checksum: False]
    [Bad Checksum: False]
[Stream index: 253]
Data (9 bytes)
Data: 7e 07 09 ff ff ff ff ff ef
Text: ~\a\t\357\277\275\357\277\275\357\277\275\357\277\275\357\277\275\357\277\275
[Length: 9]

Frame 15157: 55 bytes on wire (440 bits), 55 bytes captured (440 bits) on interface 0
Ethernet II, Src: Espressi_88:3b:3e (5c:cf:7f:88:3b:3e), Dst: Broadcast (ff:ff:ff:ff:ff:ff)
Internet Protocol Version 4, Src: 192.168.2.6 (192.168.2.6), Dst: broadcasthost (255.255.255.255)
User Datagram Protocol, Src Port: commplex-main (5000), Dst Port: x11 (6000)
Source Port: commplex-main (5000)
Destination Port: x11 (6000)
<Source or Destination Port: commplex-main (5000)>
<Source or Destination Port: x11 (6000)>
Length: 21
Checksum: 0xc38e [validation disabled]
    [Good Checksum: False]
    [Bad Checksum: False]
[Stream index: 254]
Data (13 bytes)
Data: 35 43 43 46 37 46 38 38 33 42 33 45 00
Text: 5CCF7F883B3E
[Length: 13]
davidgraeff commented 7 years ago

Sounds good. The vendor is "Faican"? This is the untranslated link: https://www.aliexpress.com/item/AC85-240V-5W-7W-9W-RGBW-WIFI-LED-Bulb-Light-Colorful-Dimmable-LED-Light-Support-IOS/32785628736.html

serhatozkara commented 7 years ago

The vendor is feican. They have also led controllers & other led related stuff. Their official website is: http://www.feicanled.com let me know if i can help more :)

Hilbrand commented 7 years ago

Is anybody working on creating an addon for these leds bulbs? Otherwise I might be doing double work ;-)

The android app and on the box go by the name of DreamColor. Not sure if that's the product name or if it's just called RGBW LED Bulb. Just to figure out what a proper addon name would be.

serhatozkara commented 7 years ago

I think a proper name would be Feican as RGBW led is too generic :)

Hilbrand commented 7 years ago

As long as it's not in the official openHAB master the binding I've added the binding to the Eclipse marketplace