How To: Inexpensive ($10 US) WiFi RGB Bulb that works with Home Assistant

Is it just med or are there anyone else who find it hard to get a nice warm white color?
I find it cold or a weird, is there any trick?

Iā€™m currently prototyping similar concept for a switch that appears like a normal dimmer switch, but is smart.

Iā€™ve decided to go the ESP8266 route since a sonoff basic switch gives you the esp8266, 3.3v power supply and a relay for $5.
Also the sonoff basic is (I hope!) just small enough to fit in the box behind light switch.
I will use a rotary encoder for brightness and push button, and there are enough GPIOs exposed on the Sonoff serial header for the encoder, so no need to solder to awkward pcb pads or the minuscule legs on the esp.

Iā€™m lucky that I have live AND neutral at my switches, so power is not a problem.

Iā€™m being a bit lazy so, rather than coding from scratch (or forking and hacking other peoples code), I am using ESPEasy.

So far I have on/off from the rotary push and brightness control from the rotary being turned sent from the ESP via mqtt, with HA automation controlling a hue bulb.
Most of the set up time was deploying mosquitto, learning mqtt etc :slight_smile:
Actually configuring ESPeasy was, well, easy.

Next I need to configure ESPeasy rules for receiving topic to switch the relay for hard on/off, and interpreting button patterns for (e.g.) relay switch, self reboot etc.

Iā€™m interested to hear more about your solution with touch panelā€¦

I can confirm that these work!

I would say however that the box lists them as 7W but they are almost exactly the same brightness as my 5W onesā€¦ The are far superior in terms of build quality to the ones I got from Alibaba in comparison.

Another compatible bulb for the Wiki @stelgenhof :slight_smile:

The app mentioned for this one isnā€™t Tuya in the instructions manual, itā€™s called ā€œSmart Lifeā€ in the app store, Android and Play Storeā€¦ might help find more compatible bulbsā€¦

The SKU on the bottom of the box is: SKU688664-4KA30 PCK 0828ā€“8335ā€“11903 Z-S-03-21

ARILUX is printed on the Bulb Casing.

Not much else to report, will keep you all posted if thereā€™s any issues with them.

Cheers :slight_smile:

1 Like

@stelgenhof Noticed something really weird this evening while test two identical bulbsā€¦

When using a transition to turn a bulb on to a brightness, one was setting the RGB to 255, 0 255. While the other RGB value was staying as it was.

Both bulbs start off with RGB 255,136,13

The I run this script in Home Assistant:

  - service: light.turn_on
    data:
      entity_id:
      - light.big_lamp
      brightness: 30
      transition: 20
      
  - service: light.turn_on
    data:
      entity_id:
      - light.landing_light
      brightness: 30
      transition: 20 

Iā€™d expect both to do the same, but light.landing_light ends up with an RGB of 255,0,255 (Purple), light.biglamp stay at itā€™s original RGB value (as expected).

light.biglamp after script runs:


light.landing_light after script runs:
09

There are no other automation running, I have completley isolated the bulbs from the rest of Home Assistant with only the script controlling them and I get the same result each time.

I havenā€™t tried the latest version yet, but have you seen this before?

All I can think of is slighly different drivers in each bulb? Not sure where else to look?

Cheers :slight_smile:

Hmm, never seen this before to be honest. Different drivers might be the issue. You could check the MQTT message when this occurs, just to possibly rule out whether the wrong settings are being transmitted.

Is there a 9W bulb available anywhere? I can only find 5W or 7W.
I was able to flash the Sonoff B1 without soldering using the sonOTA method which spoofs the dns. Has anybody looked into that for the Ailight?

1 Like

Ended up just upgrading and itā€™s now solved the issue. Not convinced that it wasnā€™t my MQTT broker though. Will check it out if it happens again.

Iā€™m trying to get the Sonoff B1 bulb working with Home Assistant.

The Sonoff B1 is flashed with the Tasmota firmware.

Has anyone has any sucess in getting them working in HA?

I havenā€™t found any examples of how to make them work in HA.
So far I have the below:

light:
  platform: mqtt
  name: "Lounge lamp"
  state_topic: "stat/sonoff/POWER"
  state_value_template: "{{ value_json.state }}"
  command_topic: "cmnd/sonoff/POWER"
  rgb_state_topic: "stat/sonoff/COLOR/RESULT"
  rgb_command_topic: "cmnd/sonoff/COLOR"
  rgb_command_template: "{{ '#%02x%02x%02x%02x%02x' | format(red, green, blue, 00, 00)}}"
  brightness_state_topic: "stat/sonoff/RESULT"
  brightness_command_topic: "cmnd/sonoff/DIMMER"
  brightness_scale: 100    
  brightness_value_template: "{{ value_json.brightness }}"
  color_temp_state_topic: "stat/sonoff/RESULT"
  color_temp_command_topic: "cmnd/sonoff/CT"
  color_temp_value_template: "{{ value_json.color_temp }}"
  qos: 0
  payload_on: "ON"
  payload_off: "OFF"
  optimistic: false
  retain: true

Configuration sends on/off commands, dimmer commands.

Edit: Got Color Temp working, just working on appending ā€œ0000ā€ to the end of RGB now, B1 uses RRGGBBCCWW!

Edit Edit: Got it working I think!!
Next on the agenda is Effects (fade etc)!

Found some errors in the log, it seems to work and issues the MQTT command fine, but why the error?
Turning on the light generated the following error:

Traceback (most recent call last):
File ā€œ/usr/lib/python3.5/asyncio/events.pyā€, line 126, in _run
self._callback(*self._args)
File ā€œ/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/mqtt/init.pyā€, line 232, in async_mqtt_topic_subscriber
hass.async_run_job(msg_callback, dp_topic, payload, dp_qos)
File ā€œ/srv/homeassistant/lib/python3.5/site-packages/homeassistant/core.pyā€, line 247, in async_run_job
target(*args)
File ā€œ/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/light/mqtt.pyā€, line 268, in color_temp_received
self._color_temp = int(templatesCONF_COLOR_TEMP)
ValueError: invalid literal for int() with base 10: ā€˜{ā€œPOWERā€:ā€œONā€}ā€™

So I suspect this is to do with the status topic:
When the light is turned on the following MQTT Topics are sent:
cmnd/sonoff/POWER ON
stat/sonoff/RESULT {ā€œPOWERā€:ā€œONā€}
stat/sonoff/POWER ON

The first Topic is HA turning on the light, the last two are the Bulb returning itā€™s status.

Can anyone shed any light (pardon the pun) on why it seems unhappy with the Color Temp, looks like it wants an int and is getting a string?

Any Suggestions on how to fix the error???

Thanks.

For those who are using Homebridge, you can now manage AiLight using Appleā€™s Homekit without the need of HomeAssistant (and the required homebridge-homeassistant plugin).

Iā€™ve created a dedicated Homebridge Plugin for the AiLight firmware! Itā€™s still in itā€™s infancy but so far Iā€™ve been able to use Homekit and Siri without any issues :slight_smile:

Checkout all the details here: https://github.com/stelgenhof/homebridge-ailight

Note: You will need to have v0.5.0 of AiLight flashed to your light as the plugin uses the REST API component.

Happy to hear what you think!

Sacha

3 Likes

@stelgenhof Great news! Just ordered six bulbs for testing :slight_smile:

Must say that I love the concept of your firware, itā€™s to bad the bulbs are hard to find. Hope that other led-drivers will be added with time.

1 Like

@stelgenhof can I flash the complied bin file with arduino ide or esptool?

Absolutely. With the esptool you can can flash the released binary without any issue. Although I use PlatformIO all the time, the Arduino IDE should work as well.

Where did you buy the bulbs from?

Banggood have one type of Tuya bulbs, and some ebay seller.

https://m.ebay.com/itm/RGB-LED-Wireless-WIFI-Control-Smart-Light-Bulb-220V-7W-E27-/182309310094?txnId=1718014740008

Thanks for the link. It mentions 220V, does it work with 110V (universal voltage)?

Good question. The bulbs from Banggood does at least work with 110V.

It seems that the Banggood bulbs are 4W for the white Leds.

From their website:

Banggood Reply:

Dear customer,

Thank you for your review. We are so sorry for that. But 8W is the total wattage for four light colors(red, green, blue and white ).It is not mean the single color's wattage.

Is there any ESP8266 bulb which has 7W of white LEDs?

yesļ¼Œi done it successfullyļ¼Œis there any way to make the Effects with the HAļ¼Ÿ

Unfortunately AiLight doesnā€™t support any effects (yet).

what a pityļ¼ any plan to add thisļ¼Ÿ
is that possible to do it with the homeassistant Automatingļ¼Ÿ
set the light to transition to the new stateļ¼Œsomething like breathing lightļ¼Ÿ