AI Thinker RGBW Bulb

Hi folks,

Stumped once again.

So I purchased 4 of these bulbs:

http://www.ebay.ca/itm/Led-RGB-E27-Smart-Dimmable-Light-Bulb-Amazon-Alexa-WIFI-Remote-Control-Lamps/253032530951?ssPageName=STRK%3AMEBIDX%3AIT&_trksid=p2057872.m2749.l2649

And followed the following WIKI to upload a firmware compatible with HA:

All sorts of problems doing that with compiling the build code. Issue raised with the maker.

So I decided to give one a try instead:

Far better success, everything uploads, supports MQTT discovery, HA sees the bulb, but doesn’t interact. It seems as if MQTT isn’t communicating correctly with the command/state topics.

Now, I’m not very familiar with MQTT coding and how it all works, but I wanted to try it without MQTT discovery, and have full control over the command and state topics within HA using the MQTT Json Light component.

Question, is, the current code looks like this:

///////////////////////////////////////////////////////////////////////////
//   MQTT
///////////////////////////////////////////////////////////////////////////
#define MQTT_USERNAME     ""
#define MQTT_PASSWORD     ""
#define MQTT_SERVER       ""
#define MQTT_SERVER_PORT  1883

// enable Home Assistant MQTT Discovery feature
#define MQTT_HOME_ASSISTANT_SUPPORT

#if defined(MQTT_HOME_ASSISTANT_SUPPORT)
// template: <discovery prefix>/light/<chip ID>/config, status, state or set
#define MQTT_CONFIG_TOPIC_TEMPLATE            "%s/light/%s/config"
#define MQTT_HOME_ASSISTANT_DISCOVERY_PREFIX  "homeassistant"
#endif

#define MQTT_STATE_TOPIC_TEMPLATE   "%s/rgbw/state"
#define MQTT_COMMAND_TOPIC_TEMPLATE "%s/rgbw/set"
#define MQTT_STATUS_TOPIC_TEMPLATE  "%s/rgbw/status" // MQTT connection: alive/dead

#define MQTT_STATE_ON_PAYLOAD   "ON"
#define MQTT_STATE_OFF_PAYLOAD  "OFF"

#define MQTT_CONNECTION_TIMEOUT 5000

How exactly would I change it so I can manually use my own command/state topics. I understand commenting out the HA discovery line, but the rest is beyond me.

I’d troubleshoot, but for those who may have these bulbs… you have to solder 5 very tiny wires to the bulbs, using a FTDI adapter to flash the firmware, unsolder then plug in to test. I’ve already ruined 2 bulbs from constant soldering! :frowning:

Any help would be much appreicated!

at first glance you need to set the MQTT_SERVER address to your HA IP Address or wherever your MQTT Broker is. If youve set authentication for your Broker then you also need to add MQTT username/password.

The way MQTT works is with publishing and subscribing to topics. Im not sure what theyre doing with the %s variable, but I would set each light to a specific topic, like light1/rgbw/state light2/rgbw/state etc… to start with

1 Like

Thanks @cbienlein. Yes got the first part sorted with configuring my MQTT details.

They’ve used a template for the mqtt topics, as home assistant discovery is enabled.

I’m not sure if changing:

#define MQTT_STATE_TOPIC_TEMPLATE “%s/rgbw/state”

to:

#define MQTT_STATE_TOPIC_TEMPLATE “rgblight/rgbw1/state”

Would work, as it’s a “template”

I use MyMQTT on my phone for MQTT troubleshooting. If youre not sure whats going on behind the scenes, just install that and subscribe to all channels by using # as your topic. This way you can actually see whats being transmitted on different channels.

I think you should be able to ditch the %s and define something like specific but im not 100% sure. worst case you have to reload the config again