Closed ghost closed 7 years ago
Thanks for the suggestion, will test and integrate.
Made a little more progress with the reverse engineering of the proto as well. Setting a value of 0x00 after the bulb/object ID will cause the ID to be interpreted by the network as a group ID, with group 0 being reserved as the broadcast group. Setting the value to 0x80 (10000000_2) as you are in your Haskell implementation causes the ID to be interpreted as an individual device/bulb ID.
Problem: The command string built to is incorrect for a single network, one Pin, with more than one bulb.
Fix: When there is more that one bulb in a network the Application will identify each bulb in the App as "Light Bulb 1", "Light Bulb 2", etc.
The light_set_cmd generated byte string must include a byte which identifies the bulb 0x01, 0x02 etc followed by a delim byte 0x80, after the command bytes 0x73, 0x11 and before level red, green, blue bytes.
The current "def light_set_cmd(level, red, green, blue):" Given: light_set_cmd (200, 255, 255, 255) Creates: "000073110000e4ffffff"
Modify the method to take the bulb number for the network: def light_set_cmd(bulb_no, level, red, green, blue):" Given: light_set_cmd (1, 200, 255, 255, 255) Creates: "000073110180e4ffffff"
The packet may be directly sent to the target bulbs address.
The following Haskell routine builds a correct light_set_cmd byte string.