Deta Grid Connect Smart Led Downlight

Why do this?

I have been using Grid Connect stuff for a couple of months now, as anyone from Australia or New Zeeland and probably several other countries around the world know, its always been a concern installing cheap Chinese crap (Sonoff) or even much better quality stuff out of Europe (Shelly) inside your walls.

If there is a fire, there is some doubt as to if the insurance company would payout. Particularly if its caused by an electrical fault. So I am in the process of replacing my 40 + Shelly devices with the Grid Connect stuff where appropriate.

Up until recently, this was pretty easy, and there may still be some old stock where you can use the technique described here. https://www.digiblur.com/2020/01/tuya-convert-23-update-flash-tuya.html But the latest generation of devices have been patched to overcome the exploit that was previously used to install Tasmota or other 3rd party firmware.

The DET900HA is the latest example of this; I purchased four of them at the same time from my local Bunnings and the first two I opened I was able to be converted easily, the other two, however, took a little more effort.

So first let me start with my assumptions.

I am assuming that the reader has a basic understanding of electronics. Ideally, they should have the basics in soldering down as well. If you have never soldered before here is a good tutorial that I have found that will teach you the basics. This is intended for a complete novice, if you know how to solder then feel free to move on. https://www.youtube.com/watch?v=Qps9woUGkvI

Having said that I also assume that you have a basic understanding of electrical safety and that you are computer literate and understand the principles of how to program a small microcomputer. This is a big topic; there are lots of tutorials online; they are all basically the same; here is a good example. https://www.youtube.com/watch?v=LwZltnda4v8 the process we are following is similar.

So having said that, let me also add an important disclaimer here. This process requires you to use a soldering iron and a disordering tool such as solder wick. Its not for everyone, you really need to know what you're doing. Please don't send me messages asking for help if you have either butchered the circuit board because of too much heat or some other catastrophe related to soldering. I have seen people try and use a plumbing soldering iron to do stuff like this. DON'T DO THAT!!!!

DANGER!!! DANGER!!! DANGER!!!

If you screw this process up, you can also brick the device (making it unrecoverable). Because you have taken the unit apart you won't be covered by any warranty. Likewise, if you succeed in updating the device, you also will void the warranty, so please consider carefully.

There is another alternative if you are using Home Assistant as your smart platform. That is to take advantage of the Tuya integration. Now whilst this is a possibility it's far from perfect, the API used is not very fast, in fact... its !@#$ing slow!! so it doesn't update correctly, Tuya wants people to pay for there API, this is clearly not what any Home Assistant developer would be willing to do out of the goodness of there heart.

So now I have set the groundwork, and hopefully, you understand what you need in terms of background, we should be good to go.


DET900HA


For this tutorial I am explicitly talking about the DET900HA (as pictured above in the page banner), this is the smaller of the two Deta Smart Led Downlights. It has a 70 mm bore size for in your ceiling and is a 7-watt device.

The DET902HA is slightly bigger and has a power rating of 10 watts, this procedure may well work for that device as well, but I have not tried it.

DET900HA

The first step we need to do is to disassemble the controller; this is simple enough, you just remove the four screws holding the blue strain reliefs in place then disconnect the mains power cable (make sure it's not plugged in). You can also detach the LED if you wish, but this isn't required to complete the procedure.

You need to be able to see the back of the circuit board. As shown in the picture above. Now comes the fun part. If you look at the front of the circuit board, you will see a device mounted that is sticking out from the board. On the front of the device is printed "TYWE2L" this is the WIFI module.

TYWE2L Wifi Module

Fortunately for us, Tuya has published a full detailed datasheet on this device on the Tuya Website, for convenience you can reach it by following this Link. https://docs.tuya.com/en/iot/device-development/module/wifi-module/wifie2lmodule?id=K9605ud0gkjmh the datasheet describes in a lot of detail how this device works, but for our purposes, we are really only interested in the pins that will enable us to re-program it.


Hot stuff baby

This thing realy sucks!

solder wick.. this stuff is the stuff

But before we get to that, we need to remove the device. This is actually pretty easy provided you have the right tools; you need a soldering iron that is compatible with fine electronics, something similar the picture above, it should have a fine tip and the ability to control the temperature.

This one is available for Aus. Electronics direct for about $AU90.00 available Here

Because the solder used in most electronics produced in the 2000s is lead-free solder, you need more heat to get it to melt, but be careful. Too much heat can damage the tracks on the circuit board. Some folks like to use solder suckers. Personally, I hate them! But if that's your jam. Have at it. If you don't know what a solder sucker is its the picture of the silver looking gadget on the right-hand side of the soldering iron.

My preference is to use solder Wick if you have not used it before, it's pretty easy, you just put the wick on the solder joint and then put your iron onto the wick and watch it suck up the solder.

Ok, so once you have removed all the solder from the wifi module, you should be able to to slide the wifi module out of the board, you can see in the picture above that there is a slot in the main board with solder tabs on it that where you need to de-solder. Sorry, I could not take a photo of me doing that, I don't have enough hands.

Now that we have the wifi module free from the mainboard, we need to solder some wires to the back of the wifi module. If you recall earlier when I talked about the datasheet that Tuya was kind enough to provide. It shows a diagram and table of all the pins.

You can see them clearly labelled on the picture below.

We want to solder some small wires to the following points.

· TX

· RX

· 3v3

· GND

· RST

· IO0

I use the small Dupont jumpers that you use with Arduino, these are available online, or if you happen to live in a town with a Jaycar stockiest, you can get them there.

Now if your anything like me, your eyes are not as good as they used to be. So I have a magnifying glass with a small alligator clamp on it to make it easier to see. You do what works for you, bottom line you need to use your soldering iron to "tin" the pins where we will solder the wires, all this means is you need to put a little bit of solder on the pads so that the wire will stick to it.

The Dupont wiring cables I am using have a male connector on one end and a female on the other. I cut off the female side and then strip the wire back, make sure you tin the bare wire as well to make a better join. This is delicate work, and I emphasize again, to not use too much heat, you don't want to burn the insulation on the back of the board.

You can see from my picture that there are slight scotch marks next to each pin. I was using an iron set to 400 degrees celsius, which was probably a little too hot. You just want it hot enough to melt the solder. If your using lead-free solder like I am, 400 degrees is the lowest you can comfortably get.

Once you have all your wire tails solder on, it should look something like the picture.

The colour's of the wires don't matter, just so long as you know what they mean. In my case, I have the following

· TX – Blue.

· RX – Green.

· 3v3 – yellow.

· GND – grey.

· RST – orange.

· IO0 – Brown.

Now we need to connect our tails to our Programmer. I am using a USB to TTL UART RS232 Serial (PL2303) Converter Module like the one pictured

Using the female side of our jumper cables we just start connecting it up. But just to make things a little easier on your self, I am also using a small breadboard

This will enable you to connect the wifi module ground, reset and IO0 to the PL2303HX ground easily. It will help to get the module into the programming mode. You can see in the picture below how I am using the breadboard

To get the unit into programming mode, you need to hold the IO0 line low while the device boots. The easiest way to do that is to have the reset, and IO0 kept low when you power up the unit, then disconnect the reset line (in my case orange) then after about a second, disconnect the IO0 (in my case brown)

But before we get to that, we need to know what comport the PL2303 is using.


if you're on windows, you can find this out by going into the device manager (right-click on "this PC" then select "manage" then "device manager") look under Ports, and you should see something like the pic below.

I don't have a MAC or Linux, so for that your on your own!

Now open your preferred flashing tool. In my case Tasmotizer https://github.com/tasmota/tasmotizer , assuming that you are flashing with Tasmota, I don't use anything else except Tasmota because I know it well.

If you want to use a different firmware, just follow the process to install that firmware on any ESP8266 wifi module. It should still work.

The reason I like Tasmotizer is because you can send a configuration to the module once it is flashed. This is particularly useful in this case because we use a template but more on that later. First, we need to flash our firmware.

Another cool feature of Tasmotizer is you can flash the latest current firmware from within the tool.

If you look at the screenshot, you can see that I have selected "release 8.4.0" by default Tasmotizer will select the Tasmota.bin file. This is the correct one in our case, but if you are doing other stuff, you can select the drop-down and choose a different type of firmware if you need to.

You can choose if you want to backup the firmware or not. It's probably not a bad idea to do so in this case, if you find you want to reset the firmware back to the factory firmware, then you can. All you do is follow the same process I have described so far and use Tasmotizer to send the backup bin file by selecting "BIN file" and then browsing to the appropriate file location.

Once your happy and you have the wifi module in programming mode (as described above), then select the correct com port and hit "Tasmotize" once the load is completed Tasmotizer will tell you to reboot the module.

Now here we get to why I love Tasmotizer you can see next to the "Tasmotize" button there is a send config button. After you have rebooted your device, you can send a configuration to it. This saves you the hassle of powering it up, looking for its WIFI SSID and then configuring it. If you have never had to do that before, trust me, it can be a little cumbersome.

So here's what we do. Repower the unit but DON'T put it into programming mode. Then select the "send config" just a word to the wise. It's a good idea to check that you are still connected to the same com port, sometimes when you repower the PL2303, it will change com ports.

The screenshot below is what the send config screen looks like, as you can see, you can send the SSID of you desired WIFI network, you can set up your MQTT settings and other device details. But you can also do something very useful in our case; you can send a template as part of the configuration. (sorry about the image quality)

Now a word on templates, if you have never used them before, they are pretty neat. They enable you to extend the capabilities of what you can use Tasmota on, fortunately for us; somebody has already done a lot of the hard work for us. To get a template for this particular device go to https://templates.blakadder.com/index.html you can see there is a vast library of different configurations for all kinds of devices.

In our case we want a device that is sold in Australia, so select AU under the "Devices by electrical standard" section then scroll down to "Light" you will see the "Deta DET902HA 10W 940lm RGB+CCT Light" template about halfway down. Click on the text, and you will be presented with a small description of the product along with a black box with some JSON in it (see below).


This is the template we want. So copy that JSON text and then paste it into the configuration setup of Tasmotizer. If you mouse over the black box you will see the word "copy" appear; you can copy the template by pressing that copy text.

I always use this copy feature to make sure I am not copying unwanted invisible text. Once you have all your setting configured including your template, you press save, and this will be sent to the module, you should see a message similar to the one below once it's finished.

If you see something like "Configuration sent (-1)" the configuration hasn't been sent, most likely because you're still in bootloader mode or the com port has changed. Just reboot the device, check the com port and try again.

That's it for the firmware part. But if you want to make sure it's working, then power the unit back up and take a look in your router "connected devices" list and you should see something like "tasmota_CFCFCF-CFCF" this will be the device you're looking for. If you don't see it right away, reboot the device and then refresh your router connected devices page. It should show up.

Now you can open the internal web page, Just open a web browser and copy the IP address into the address bar and it should open the Tasmota page. That's it you're all done. The device now has Tasmota flashed on it and its working. Happy days…

Now all you need to do is remove all the jumper wires from the back of the module and solder the module back into the mainboard. Once your done what I like to do is give all the solder joints a clean with methylated spirits of contact cleaner (don't use WD40 unless its proper contact cleaner) just to remove any flux build-up.

Reassembles the controller, and from there you can add it to home assistant or whatever other home automation system you prefer.

Have fun.