Regular viewers will know I had a thing about Athom a little while ago. When my handy Tuya-convert rig became redundant and it was no longer possible to convert smart bulbs from various suppliers to run TASMOTA (and hence be locally controllable without signing up for someone elses CLOUD), Athom stepped in and started supplying ESP8266-based smart bulbs with Tasmota pre-baked into them.
At the time, Athom sent me a couple of samples, an E27 7W RGBW bulb and a larger 15W bulb – same configuration. The 7W bulb was never that good as, when turned to OFF simply went a very DIM RED – and 7W is a bit naff anyway for a lamp with R, G, B, warm white and cool white LEDS – you can imagine the power of each colour – not much. Quite a few of the RGB lamps out there are low power like that – better as decorations than actual lighting.
I never did get to the bottom of that 7W light – but the 15W light is WONDERFUL – whites are BRIGHT, colours are very usable. I have a setup in my office comprising several RGBW lamps all controlled by MQTT from Node-RED and of course also by Alexa – all running in sync.. including the Athom 15W – but one (not an Athom) has recently developed a tiny flicker.
SO, you can imagine that I was pleasantly surprised Wednesday morning when a package of two bulbs arrived in the post – trademark ATHOM bulbs – I’ll simply show the bulbs next to my normal size adult male hand to give you a feel for what these devices look like. What we have here is a round E27 15w lamp and a flat E27 12w lamp.
As you can see in the photos – not small – and that’s a GOOD thing, hopefully. No paperwork came with the bulbs other than tiny leaflet inside which DEFINITELY did not come with my original bulbs – there’s no mention of Tasmota, instead, THIS:
Shocked? Me too. Once I looked at the Athom website, everything became clear. Well, I have no issue with ESPHOME but I have no intention of using Home Assistant so the first thing I needed to do was figure out how I could control these lights from Node-Red so let’s take a look (I’m not kidding – I started with no info other than the above and I had no idea they were supporting ESPHOME).
So, plugged a light into the mains, told my phone to go looking for it’s access point…. I just happen right now to be testing one of my AQARA smart switches with an E27 socket as the load. I just turned that on and the big round light came on, sequencing colours for several seconds then going to full white – and WOAH, BRIGHT. Did I have to work more quickly or would it continue to run it’s own access point until told otherwise? YES – it kept going. My phone was now seeing an access point called “athom-15w-r…light-ce5008” – that’s all I could see on the phone until I got the web page up.
I hooked the phone to that access point (select WiFi access points available to the phone) and took a chance that the address to view would be as usual which, for example, using Tasmota, would be 192.168.4.1 – sure enough – but this is NOT Tasmota – in hindsight it IS ESPHOME (had I looked on their website I’d have spotted that) . Good job I’ve done nothing but spout about ESPHOME recently.
Still using my phone, I filled in the details of my nearest WiFi access point (in the form over on the left here) and that was it, the bulb disappeared as an access point and appeared on my network.
What next? I do wish they’d given an option to change the bulb name at that point but thankfully there’s nothing else on my network that starts with “athom-15w-r” and thinking about it the title on the left shows the full name…
Sure enough there was a device called “athom-15w-rgbct-light-ce5008” on my network. The obvious logical next step (as a non-Home-Assistant user) was to check if the ESPHOME web page was running on that lamp.
Yes indeed. Kind of handy, the ability to turn the light on and off from the web page and also view its on-time but I need more and at this point, as something of an ESPHOME novice, I was until last night still a little in the dark as to how to control the colours etc without resorting to Home Assistant.
First things first: the toggle works (I should point out that my Aqara smart switch wasn’t too keen on having a smart bulb attached and occasionally turned itself off – so that had to go – I plugged the lamp directly into a wall lamp socket). I noted “no client connected to API” in red in the code below.. That’s ESPHOME griping because there is no Home Assistant. Next I needed to figure out how to recreate an ESPHOME JSON file for this lamp.
What I’ve done with every ESPHOME file I’ve created up to date (not done any RGB lamps) is to comment out the Home Assistant API and add in an MQTT section. At this point I qwasn’t entirely sure if we were talking about an ESP8266 or ESP32…
WELL, it looks like I din’t have to worry – this page has the setup. I won’t include the code here as I hate people doing that to me – see the ESPHOME link above if you’re interested. I did a wireless FLASH of the light from that starting point. I could from there add in MQTT and that then allowed me to control the light. The link above also clarifies which chip is being used in these lamps. In the page above I’ll have to assume that where they say device_name: “athom-rgbct-light” I put in the name I already discovered.
So – substituting the name I had for my light for “device name” in the ESPHOME project I began the process of creating a new project and flashing it to the lamp. EVERYTHING worked including the flashing process – the light turned itself off and back on again – but now the web page wasn’t showing…. wish I’d made a note of the IP address. I checked the new ESPHOME project – yup, sure enough – the light was OFFLINE.
The lamp later re-appeared on my phone – the reason it failed was because when I copied the code from the above ESPHOME link, I left in the default access point
wifi:
ap: {} # This spawns an AP with the device name and mac address with no password.
So first time, the internal access point re-appeared on my network… second time – nothing. I’d failed to notice something else they’d sneaked into the ESPHOME section – so now I had a device called athom-15w-rgbct-light-ce508-ce508 on my system – thank heavens for “Advanced IP Scanner”.
esphome:
name: "${device_name}"
name_add_mac_suffix: true
platform: ESP8266
board: esp8285
project:
name: "${project_name}"
version: "${project_version}"
I changed the name of the project to match what was appearing on my network, ran INSTALL in the ESPHOME DASH and….
My added MQTT section works and I was stunned to discover, having never set up one of these lamps in ESPHOME – that all MQTT needed was the basic setup as the LIGHT section in the YAML page already knows about MQTT if present – all I had to do now is figure out how to rename an ESPHOME project – that name was now WAY too long. And of course, renaming is documented in the ESPHOME info here. I do wish the esphome guys would stop assuming we all use the .local suffix for devices on the lan. I use .lan and back in the UK my router uses another suffix.
So now I had a lamp with 5 output ports defined for colours, white and CT – I just need to figure out what messages to send via MQTT in order to fully control said light. I went onto DISCORD chat and created a thread in the ESPHOME section called #Athom Lights without Home Assistant. Suffice it to say I spent hours talking to @jesserockz in that thread and finally it all came together.
I now have the ability to select colour OR warm/cold white along with brilliance and I added in an effect I simply call rainbow to the mix AND improved on the original Athom code by adding in a line to the ESPHOME section of the YAML file to ensure that the lamp retains it’s last state after a power outage. Anyway for what it is worth, here’s the complete yaml file as it stands right now and below that a couple of sample MQTT packages to control the light.
substitutions:
device_name: "athomesphome1"
friendly_name: "Athom RGBCT Light"
project_name: "athom.rgbct-light"
project_version: "1.0"
esphome:
name: "${device_name}"
platform: ESP8266
board: esp8285
esp8266_restore_from_flash : true
project:
name: "${project_name}"
version: "${project_version}"
#api:
ota:
logger:
web_server:
port: 80
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# use_address: 192.168.1.122
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Fallback Hotspot"
password: "utUaxWX0apij"
mqtt:
broker: !secret mqtt_broker
username: !secret mqtt_user
password: !secret mqtt_password
id: mqtt_client
captive_portal:
binary_sensor:
- platform: status
name: "${friendly_name} Status"
sensor:
- platform: uptime
name: "${friendly_name} Uptime Sensor"
switch:
- platform: restart
id: restart_switch
name: "${friendly_name} Restart"
- platform: template
name: "Cold test Light"
optimistic: true
turn_on_action:
- light.turn_on:
id: mylight
color_temperature: 153 mireds
turn_off_action:
- light.turn_off:
id: mylight
- platform: template
name: "Warm test light"
optimistic: true
turn_on_action:
- light.turn_on:
id: mylight
color_temperature: 500 mireds
turn_off_action:
- light.turn_off:
id: mylight
- platform: template
name: "Blue test light"
optimistic: true
turn_on_action:
- light.turn_on:
id: mylight
red: 0%
green: 0%
blue: 100%
turn_off_action:
- light.turn_off:
id: mylight
- platform: template
name: "Red test light"
optimistic: true
turn_on_action:
- light.turn_on:
id: mylight
red: 100%
green: 0%
blue: 0%
turn_off_action:
- light.turn_off:
id: mylight
- platform: template
name: "Green test light"
optimistic: true
turn_on_action:
- light.turn_on:
id: mylight
red: 0%
green: 100%
blue: 0%
turn_off_action:
- light.turn_off:
id: mylight
output:
- platform: esp8266_pwm
id: red_output
pin: GPIO4
- platform: esp8266_pwm
id: green_output
pin: GPIO12
- platform: esp8266_pwm
id: blue_output
pin: GPIO14
- platform: esp8266_pwm
id: white_output
pin: GPIO5
- platform: esp8266_pwm
id: ct_output
inverted: true
pin: GPIO13
light:
- platform: rgbct
restore_mode: RESTORE_DEFAULT_OFF
name: "${friendly_name}"
red: red_output
green: green_output
blue: blue_output
white_brightness: white_output
color_temperature: ct_output
cold_white_color_temperature: 153 mireds
warm_white_color_temperature: 500 mireds
color_interlock: true
id: mylight
effects:
- pulse:
name: "Fast Pulse"
transition_length: 0.5s
update_interval: 0.5s
- lambda:
name: "rainbow"
update_interval: 3s
lambda: |-
static int state = 0;
auto call = id(mylight).turn_on();
call.set_transition_length(3000);
if (state == 0) {
call.set_rgb(1.0, 0.0, 0.0);
} else if (state == 1) {
call.set_rgb(1.0, 1.0, 0.0);
} else if (state == 2) {
call.set_rgb(0.0, 1.0, 0.0);
} else if (state == 3) {
call.set_rgb(0.0, 1.0, 1.0);
} else if (state == 4) {
call.set_rgb(0.0, 0.0, 1.0);
} else {
call.set_rgb(1.0, 0.0, 1.0);
}
call.perform();
state += 1;
if (state >5)
state = 0;
text_sensor:
- platform: wifi_info
ip_address:
name: "${friendly_name} IP Address"
disabled_by_default: true
And now the sample codes from Node-Red (firing a simple inject at the MQTT node)..
Where do I get these from please?
Hi Ben
Athom sent them (no vested interests and no guarantee I was going to be positive about them). But if I recall correctly, Amazon specifically refer to them as ATHOM lights.