i read how everybody is pissed off at the cheap magichome devices not working correctly in homeassistant. eg: slow to respond, status is incorrectly polled etc
i’ve aquired a magichome to create some night-pee-light to fit under the bed that comes on at night when triggered by a xiaomi/aqara motion sensor and i had exactly the same problems.
those magichome devices run on ESP’s that are flashable with esphome.
the one i had had these connections.
all you have to do is solder some dupont wires to those solder pads, then connect them to your usb TTY serial programmer adapter.
the pin labeled 3.3v goes to the pin that carries 3.3v on the programmer
the pin labeled Ground goes to the Ground pin on the programmer
the pin labeled IO0 also goes to the Ground on the programmer
the pin labeled TX goes to the RX pin on the programmer
the pin labeled RX goes to the TX pin on the programmer
how the pins are wired depends on the programmer used.
you can either use a FTDI one which has pins protruding (that is why i recommended dupont wires)
or you can use another model which has a header.
before you connect anything make sure your USB serial adapter is set to 3.3v or you’ll blow things up.
the one with the pins looks like this:
(thank you frenck for the image, i also made your doorbell, i slightly modified it tho)
you can also use this example when you have a programmer with a header like this, pinout is the same:
then you’ll need to create a yaml file to flash to the magichome device.
Make sure you have ESPHOME installed on the device your using to flash the magichome controller, i used a raspberry for flashing.
i wrote this yaml code to create a simple binary monochromatic light (as my led is just a warm white strip), all you have to so is create a blank yaml file (name it something conventient) and then paste one of these codes in:
esphome: name: node_name platform: ESP8266 board: esp8285 wifi: ssid: "Your SSID Here" password: "Your Wifi Password" # Enable logging logger: # Enable Home Assistant API api: password: "Your API Password" ota: password: "Your OTA Password" # this is code for the RGBW version of magichome light: - platform: rgbw name: Nice Friendly Name red: pwm_r green: pwm_g blue: pwm_b white: pwm_w output: - platform: esp8266_pwm pin: GPIO12 frequency: 1000 Hz id: pwm_r - platform: esp8266_pwm pin: GPIO5 frequency: 1000 Hz id: pwm_g - platform: esp8266_pwm pin: GPIO13 frequency: 1000 Hz id: pwm_b - platform: esp8266_pwm pin: GPIO15 frequency: 1000 Hz id: pwm_w'
or use this code for the single color monochromatic version:
esphome: name: node_name platform: ESP8266 board: esp8285 wifi: ssid: "Your SSID Here" password: "Your Wifi Password" # Enable logging logger: # Enable Home Assistant API api: password: "Your API Password" ota: password: "Your OTA Password" # this is code for the monochromatic version of magichome light: - platform: monochromatic name: Nice Friendly Name output: pwm1 output: - platform: esp8266_pwm id: pwm1 pin: GPIO12 frequency: 1000 Hz
all you have to do next is make sure that the usb to serial adapter is wired to your magichome device, and then plug it into your raspberry.
then just run: esphome your-yaml-file.yaml run
it’ll compile the firmware then ask if you want to flash it, select the option for serial and it will write the code.
it might hang at logging, but once it’s flashed you can break the process off.
disconnect the device from usb, then from the programmer, connect your strip and power the thing up.
if you have the discovery component active in HA it will show right up in the notifications and you can set it up right away.
once you’ve confirmed everything is working you can just desolder the wires and put the thing back in it’s casing. all done! you now have a perfect functioning wifi LED strip without all the laggy shit and problems.
code above came from https://everythingsmarthome.co.uk
i just modified it to fit my needs.