I bricked my Christmas lights
whizzy.org
whizzy.org
> When we try and decrypt the on and off packets we get:
> 05 54 55 52 4E 01 00 00 00 00 00 00 00 00 00 00
> 05 54 55 52 4E 00 00 00 00 00 00 00 00 00 00 00
> 05 54 55 52 4E 01 00 00 00 00 00 00 00 00 00 00
> 05 54 55 52 4E 00 00 00 00 00 00 00 00 00 00 00
> 05 54 55 52 4E 01 00 00 00 00 00 00 00 00 00 00
> 05 54 55 52 4E 00 00 00 00 00 00 00 00 00 00 00
> Success! This is a lot more sensible. A fixed header, byte 5 switching between a 1 and a 0 for on and off, and a bunch of zeros.
I would guess that’s not a ‘fixed header’, but a length byte (“command is 5 bytes long”), a command (“TURN”) and an argument (zero or one), padded with zeroes to 16 bytes.
Anecdotally, earlier today I was trying to decipher Encarta data and came across the “Mind Maze” data and it’s mostly that - fixed 32-but header, question size, (answer size, answer, correct flag, something I haven’t figure out yet){4}. Then a separate file with an index value and an offset into the first file as well as a header I haven’t figured out yet.
That knowledge is good for short strings, but the canonical hexdump format is a the best way to look at packet and memory dumps.
And the reason for the 0x20 difference is that the Shift key on old teletypes turned the 0x20 bit on and off.
In the same way the Control key turned the 0x40 bit off. So Ctrl-A = 0x01 = 'A'/0x41 - 0x40.
Anyway, if you can't salvage it, standard WS281x LED strings can be hooked up to a Raspberry Pi and you could use my open source addressable LED controller :) https://github.com/mbevand/ledthemfight It comes with built-in effects. I made it very modular so for the DIY crowd, in 2 lines of Python, you can create simple custom LED effect modules. See a demo here: https://youtu.be/qpd2rILsnM4
https://www.aliexpress.com/item/1005005485885067.html
Anybody wanting to do anything with LED lighting owes it to themselves to look at WLED. Lots of built in effects, web gui, super cheap ESP32 (or ESP 8266!) as the controller, sound-reactive, etc etc etc. WLED is running my indoor Christmas lights right now and they look great.
http://www.normandled.com/upload/201808/WS2815%20LED%20Datas...
I've updated the code to shift right by 3 places and so go back to a 5 bit number.
That's a neat way of limiting the power usage.
I spent a bunch of time trying to reverse engineer the apps and the protocol, and it turns out both of these lights seem to use the same negotiation process but use different libraries to do it. I tried to mimic the Diffie-Hellman key exchange process they do on connection, and then kinda gave up. IIRC there was another step or 2 after that, one where it sent a random-looking number (another key? After sending the first key??) and I couldn’t figure out what it wanted there.
Your writeup makes me think I should just go try that hardcoded key and see if it works…
I can just swap the micro controller with something like an ESP8266 and run WLED.
I haven't worked on it at all recently (COVID project) but it's fun for experimenting. You can also flash ESP32s from the downloadable desktop app
OpenRGB ended up having to disable the particular module from running automatically on that hardware. (Although the vendor software would also trigger said bug, on occassion.)
Unfortunately, the usual way for triggering the in-system programming mode required sending a usb hid report, but affected devices wouldn't even enumerate anymore. (Assuming it was even firmware corruption and not some other undefined behaviour causing hardware damage)
"Don't worry I've added AES encryption"
(It's how pairing is done - the app blindly broadcasts packets to 255.255.255.255 and the target device (lightbulb, power outlet, et al) just sits in promiscuous mode. The packet contents are protected by WPA2 et al, but the packet lengths aren't, so the protocol sends a bajillion tiny packets with each packet's length set to the ASCII byte value of the next character in the setup handshake. I believe it sends it multiple times in a row. This is why pairing takes 2 minutes then always abruptly stops before the counter reaches zero.)
\o/
IoT pairing is a tricky problem because phone/laptop devices give a very limited API for communicating with a new WiFi device that isn't yet on your WiFi network.
I figured this out when I tried to debug why the pairing didn't work from my phone, but did from an old Samsung A2: the iot device only had a 2.4ghz module, my new phone was on 5ghz...
:/
I'd prefer an out-of-band option, like "physically connect the new device to the IoT hub's 'new device' port to configure it automatically before moving it to its permanent location", or "scan the QR code on the new device, which contains a public key that the IoT hub will use to broadcast the WiFi credentials over RF", but I understand that at least for mass-market residential products, that's unlikely because it generally involves more components on each device.
Luckily, it seems to completely forget anything that happened to it after a brief power loss.
Which is probably why most of the BLE controllers of the same brand simply stay at the default password of "0000". A power outage will eventually get you back to that. If you're really bored that'd probably make for some great BLE wardriving.
But I, too, ended up putting the results of my reverse engineering into a Home Assistant integration (https://github.com/kaechele/napoleon-efire) and documented the system and protocol (https://bonaparte.readthedocs.io/en/latest/index.html).
- Battery powered and outdoor / all weather compatible
- Easy to attach the battery box to surfaces using ties
- Ideally "mini" form factor ("T5") [1]
- Ideally RGB and programmable. I'd like to use them for
Christmas (red/green), Halloween (purple/orange), and
other seasons.
Does anyone know of anything that fits this bill? I've had trouble finding anything that fits the last criterion. Walmart and Home Depot will sell the first three.When I search for this, I just get noise.
[1] https://cdn.christmaslightsetc.com/images/CategoryDetail/788...
https://www.aliexpress.com/item/4000105913323.html
From what I've ready, they or similar 5V lights seem standard in outdoor Christmas lighting for shows.
For example, you can get 12v LED strips which are IP67 (waterproof inside a silicon tube) pretty easily [0] and which would probably give a much more impressive effect than a string of Christmas-style lights, due to having lots more LEDs to play with.
However, you'd need to do the leg-work of also buying and programming a micro-controller (something like an Arduino, ESP32, or ESP8266 [1]) and figuring out how to power them from your car battery. You could probably house all of the electronics inside the car and just run wires out of the boot, relying on the existing boot seal to keep everything waterproof.
[0] https://www.aliexpress.com/item/1005004289391906.html [1] https://www.aliexpress.com/item/1005005977505151.html
Here's an invite: https://discord.gg/eVhhh2Wh
Knowing what chip they have inside can give a clue if there is flash memory and if it might be easy to dump.
It did remind me of the analog Technology Connections video : https://www.youtube.com/watch?v=va1rzP2xIx4
That said, I suspect you're right and the order of operations was probably something like this, assuming the light controller uses a microprocessor:
1. Controller receives valid command to switch to light pattern 12.
2. Light pattern 12 is saved as user's preference (so it can be restored on power-on).
3. Controller attempts to find light pattern 12 and hits a bounds overflow in the pattern lookup table.
4. There's probably no error checking for this because this "can't happen"[0], so it tries to use the data it finds, which is garbage.
(The next steps depend on how the lookup table is formed, but for the sake of example, let's say the lookup table is an array of pointers to callback routines for each pattern.)
5. The controller remembers whatever garbage it found, treating it as a pointer.
6. The next time the controller wants to update the lights, it tries to call this garbage pointer (which is possibly just a null pointer).
7. Microprocessor tries to execute code there, but whatever it finds causes it instead to infinitely loop.
8. Dimming LEDs typically require a PWM signal, which they're no longer getting, so they go dark.
9. It's dead, Jim.
When you switch off and on again, the process restarts at step 3.
In other words, there may be a possibility for unbricking if you can factory reset, or find out how it stored your light pattern. (Though the latter will probably require at least opening it up and hoping you find a JTAG header, and a lot of patience and Zen. Don't do things willy-nilly!)
In any case, that's my best guess as to what happened here, based purely on the story and without any knowledge of the architecture or home integration ecosystem. If you attempt to fix it, good luck!
Your comment prompted me to search for “Govee LAN” and found HomeAssistant LAN integration. Time to dig deeper!
Ha! Love that.
This is why I like dumb things.
From the UK's Telegraph (which does have a older pre computer readership who would fully understand this )
https://www.telegraph.co.uk/content/dam/news/2023/12/05/TELE...
Christmas tree lights had different pattern modes etc. even before they were LED, for decades. I honestly think swapping button on the controller/power supply brick for a Bluetooth remote is a reasonable level of smart in this day and age. It's not like they wanted to connect to WiFi and be app-controlled via their servers or something.