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

Wow! Looks very cool using my AiLight firmware :). So I guess it did work if you used the same MQTT topic for all the lights.

1 Like

Yes thank you @stelgenhof it’s amazing firmware. Have linked to your git in the YouTube video, hope you don’t mind.

Yeah set the MQTT topics the same. The change instantly and pertly in sync! Really pleased.

I’ve got another x3 ceiling cluster to do now but need to remove the dimmer switch as it’ll try and dim at the switch.

Got x2 outside wall lights to do and x3 lamps.

Decided to control them all using Xiaomi switches for now, waiting on the gateway to arrive. It won’t send dim commands to the bulb through HomeAssistant.

When a wall switch comes along that can send dimming to HASS and doesn’t require Neutral I’ll probably replace them.

Also, the colour change works perfectly using homebridge-HomeAssistant into Apple HomeKit on iOS. You have to have the white_value set to 0 though as Apple HomeKit won’t do the the white value.

Happy to hear you like it. Personally I think it needs some more work :slight_smile: More changes are coming

1 Like

I look forward to it! Happy to provide feedback for different uses.

One thing I have already done is set an automation when the bulbs come on they are set to white.

I plan to only use colours for notifications (blue for rain coming, flashing red for alarm, purple for cold temperature, green to confirm alarm disarmed etc)

I’ve created a colour loop script for fun and exposed it to alexa for voice activation

Wish they were available for GU10 bulbs for my kitchen. Wonder if they could be built.

1 Like

I found a workaround for getting the colours to display correctly when using HomeKit… As HomeKit doesn’t control white_value and I like my white_value set to max when I’m using the bulb in a normal white colour.

I use this automation to set my light default to white when they turn on:

- alias: White - Hallway Lights
  trigger:
    - platform: state
      entity_id: light.hallway_lights
      to: 'on'
  action:
    service: light.turn_on
    entity_id: light.hallway_lights
    data:
      rgb_color: [255, 136, 13]
      white_value: 255

I then use this automation which triggers when the colour is changed to anything other than the default [255, 136, 13] which sets the white_value to 0 so that you get “proper colours”:

- alias: Hallway - Colour Set White Value
  trigger:
    platform: template
    value_template: "{% if is_state_attr('light.hallway_lights', 'rgb_color', [255, 136, 13]) %}false{% else %}true{% endif %}"
  condition:
    condition: state
    entity_id: light.hallway_lights
    state: 'on'
  action:
    service: light.turn_on
    entity_id: light.hallway_lights
    data:
      white_value: 0

It’s not perfect and needs tweaking but it’s working quite well so far.

Only issue I have is if I set the light on to a colour from an off state, it will sometimes change to the default colour. I might be able to get around this by setting the default colour when the light turns OFF via a MQTT pub?

Also controlling the colours via Alexa now!

Have posted a project:

1 Like

Nice to hear you found a workaround. I stopped using HomeKit as it is changing the white levels back to 100%. Even if you have set it to a different level. Hopefully Apple will change that soon, because I like to use Siri for controlling the AiLights :slight_smile:

Wow! Awesome work. I assume you have an Amazon Echo / Dot? I would like to use/test Alexa as well but unfortunately the Echo/Dot are not being sold in Japan. Guess I have to go the Raspberry Pi/Alexa way.

1 Like

For me HomeKit wasn’t changing the white levels at all which is why I set to automation to change the white_value to 0

Yes I have a Dot and an Echo, yeah I believe there is a way of putting it on a Pi!

1 Like

I have 4 x 220V bulbs and they work fine on 110V. Ordered them in error and was surprised that they worked.

Yes using a lower voltage on a higher designed voltage can work. Very likely the power output is less than compared to when using 230V

How do you run the Xiaomi Yeelights on 110V?? Are you using the RGB ones as well?

I mean, yes tehy turn on - but I can’t configure WiFi? I bought a 220V converter and then they show up and I can configure WiFi. But without the converter I have no luck :frowning:
Plus: Yes they are not as bright and seem to flicker a little bit with 110V / 50Hz.

Mine seem to work fine. I find that on 110V they are very bright even a little to bright at the lowest setting. I am using the RGBW models.

@stelgenhof do you know of any way to get the state of the light after home assistant restarts?

Thanks!

Do you mean the state of the light within home assistant? BTW, do you use the MQTT Discovery option?

You could also try Alexa using Reverb app for a quick test.

1 Like

@stelgenhof yes in Home Assistant, If a bulb is on and I restart Home Assistant it shows the bulb is off.

No, I’m not using discovery:

  - platform: mqtt_json
    name: 'Big Lamp'
    state_topic: 'AiLight-biglamp'
    command_topic: 'AiLight-biglamp/set'
    color_temp: true
    brightness: true
    rgb: true
    white_value: true
    effect: false
    optimistic: false

@stelgenhof Also noticed this evening…

I have a lamp that turns on via an Automation at Sunset with a transition of 900 (15mins) to 254.

The automation works perfectly, as does the transition.

However, I noticed the brightness in Home Assistant shows as 0.

Should I use discovery to fix this?

That seems to be similar issue with this

Maybe you could apply the same fix?

In your config.h file there is a parameter this: MQTT_RETAIN. By default it is set to false, which explains what you are experiencing. Try setting it to true and then recompile the AiLight firmware.

1 Like