stelgenhof / ailight Goto Github PK
View Code? Open in Web Editor NEWAiLight is a custom firmware for the esp8266 based Ai-Thinker (or equivalent) RGBW WiFi light bulbs
License: MIT License
AiLight is a custom firmware for the esp8266 based Ai-Thinker (or equivalent) RGBW WiFi light bulbs
License: MIT License
I can't seem to find a page for using MQTT like the REST page. Ex. how to send/listen for a status request.
The UI in Chrome (58.0.3029.110 (64-bit)) generates the following error message:
[Violation] Added non-passive event listener to a scroll-blocking 'touchmove' event. Consider marking event handler as 'passive' to make the page more responsive.
As mentioned in this issue leongersen/noUiSlider#785,
Passive event listeners are a new feature in the DOM spec that enable developers to opt-in to better scroll performance by eliminating the need for scrolling to block on touch and wheel event listeners. Developers can annotate touch and wheel listeners with {passive: true} to indicate that they will never invoke preventDefault. This feature shipped in Chrome 51, Firefox 49 and landed in WebKit.
This doesn't happen every time but sometimes when I cycle power on the bulb, it goes back into the default AP state and I have to re-provision the bulb (connect to bulb AP, re-enter ssid, pw, etc). I have taken the .bin file from platformio and used "sudo esptool.py --port /dev/cu.usbserial -b 115200 write_flash 0x0 AiLight.bin" to flash it. Is there any reason not to do it this way?
Hi, it looks like there is no way to use a wifi network that has no password. I believe it is due to the validation in the "settings" template.
I am not sure if I can give a password-less network in the firmware, I will try.
When settings in the Web UI are saved, the user is directed to the Lights tab. After saving, the user should stay on Settings tab so that he/she can review the newly updated settings.
Hi there,
Occasionally my mqtt server will be unreachable for a period of time due to server restarts/upgrades etc. When this happens AiLight enters config mode (the wifi AP comes up), and it stays like this forever until I restart the AiLight manually for it to reconnect.
Is there a way to stop this behavior? I'd like it to just wait until the server is up.
The color temperature actually stays, but is reported wrong in the web UI (the red, green, blue sliders are in the correct position for the color temperature, but the color temperature slider is set back to it's default value of 244).
Just wanted to leave a note, the Mi-Light 9W bulb is NOT compatible. The exterior looks like the Sonoff B1, however it's using a STM 8S003F3P6 chip inside. I ordered it from Amazon (this bulb: https://www.amazon.com/gp/product/B077TGTLWQ/ref=oh_aui_detailpage_o03_s00?ie=UTF8&th=1 )
With curl 7.47.0, the REST API examples with method PATCH don't work. A Content-Type header is needed as well:
-H 'Content-Type: application/json'
Hey there - I've done a bit of searching using the link for compatible 9W bulbs on your wiki and it seems these bulbs have disapeared! Do you still have a good source for 9W bulbs that work for this firmware? Please and thank you!
BTW, wonderful job on this firmware - it's truly fantastic. :) 👍
Ideally, these bulbs would adjust the rgb led and the white led to accurately reproduce white color temperatures. For example, I use the Yeelight RGBW bulbs with homeassistant. When selecting a color temperature, the bulb changes it's leds to the correct colors. When I do this in homeassistant with the AI-Light firmware, if I have the White LED set to maximum, it's hard to see any change in the color temperature. There seems to be some literature around the internet explaining hot to get this effect correctly (for example, http://planetpixelemporium.com/tutorialpages/light.html)
I can provide support for this too, by testing or trying to develop something. Any thoughts?
Hi,
Turns out the zemismart downlights here have the same board in them as the AIthinker bulbs. I've had 100% success flashing them with this code.
First, gamma correction is awesome. Loving it.
On/Off state does not seem to be preserved across device reboots. Always switches to Off.
Thanks.
(Reported by Kai via separate conversation)
I erased the flash and written the ailight0.50.bin using esptool now in order to get more output. Everything seems fine but I still can't see an AP. I flashed at region 0x000000. Is this maybe the problem because I override the ESP Bootloader and the ailight.bin does not come with a bootloader? Here are the logs, it would be super kind if you could give me a hint what might be the prolem. I also tried building it myself on Windows using PlatformIO, but it gets confused with nodejs gulp because of Windows \ instead of / in PATH. Anyway here are the logs from esptool:
C:\Python27\Scripts>esptool.py.exe --port com3 erase_flash
esptool.py v2.2.1
Connecting....
Detecting chip type... ESP8266
Chip is ESP8266EX
Uploading stub...
Running stub...
Stub running...
Erasing flash (this may take a while)...
Chip erase completed successfully in 10.9s
Hard resetting...
C:\Python27\Scripts>esptool.py.exe --port com3 write_flash 0x000000 ai.bin
esptool.py v2.2.1
Connecting....
Detecting chip type... ESP8266
Chip is ESP8266EX
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 4MB
Flash params set to 0x0340
Compressed 360304 bytes to 259766...
Wrote 360304 bytes (259766 compressed) at 0x00000000 in 23.3 seconds (effective 123.7 kbit/s)...
Hash of data verified.
Leaving...
Hard resetting...
Flashing espurna using the following command worked fine:
esptool.exe -cd nodemcu -cb 116200 -cp COM3 -ca 0x000000 -cf espurna.bin
however the same command with ai-0.50.bin did work (did not start an WiFi AP to connect to)
So just wanted you to know maybe there is a bug or you could figure out why it did not work.
Thanks for your work on this. Have been testing on two bulbs for a few days now (with HomeAssistant). All working except I can't seem to get flash config working. Do you have an example config for this that I can test?
Thanks.
Hi,
If my wifi network can not be reached after a power outage, my bulbs fall back to access point mode.
Is it possible to let the bulb retry connecting to the wifi network (and mqtt server) every now and then?
Hello
First thank you very much for the development of the AiLight. It works great on my bulb and thanks to it I could develop an alarm clock which is controlled over a web application (with the Rest API). Thanks.
The upload over serial connection works without problem, but unfortanetely the OTA update doesn't work at all.
When I'm trying to do an ota update with visual studio code ('pio run --target upload -e prod-ota --upload-port 192.168.1.198'), I'm getting the following error while uploading:
21:02:14 [DEBUG]: Options: {'timeout': 10, 'esp_ip': '192.168.1.198', 'host_port': 45376, 'image': '.pioenvs\\prod-ota\\firmware.bin', 'host_ip': '0.0.0.0', 'auth': 'hinotori --port=8266', 'esp_port': 8266, 'spiffs': False, 'debug': True, 'progress': True} 21:02:14 [INFO]: Starting on 0.0.0.0:45376 21:02:14 [INFO]: Upload size: 397936 Sending invitation to 192.168.1.198 Authenticating...FAIL 21:02:14 [ERROR]: Authentication Failed
I didn't change the standard platformeio.ini and config.h so the port should be 8266 and the password should be hinotori as described in the error message. The webinterface of the bulb listen on 192.168.1.198, so the ip is correct.
The following things I've tried:
The upload over ota doesn't work for me in the 0.5 version and the actual 0.6 development version
the firewall of windows wasn't on while testing
In the platformeio.ini file I've tried to add an = after port in the upload flags, but it didn't work either
upload_flags = --auth=${common.ota_password} --port=${common.ota_port}
I've tried the other ota build (dev-ota) too, but unfortanetely without result.
I've tried to add the --port in upload_flags on a new line after --auth=, but then the compilation didn't work.
So now I don't know what I can try anymore, I'm very glad for any help.
thanks you very much.
Greetings
Cat Turbo
PS: in the attachement you find my config.h and my platformeio.ini file, but they are more or less the same as the original ones
platformeio and config.zip
Encountering an error when trying to compile. Configured the default values for wifi and mqtt in src/config.h. The compiler is complaining about variables not being declared.
I noticed that if I comment out the wifi configuration (default) then the build finishes ok.
Am using platformio installed with pip. Tested on Windows and Linux and it is the same. See my config below.
`******************************************************************************************************************************************************
If you like PlatformIO, please:
LibraryManager: Installing id=64
Downloading [####################################] 100%
Unpacking [####################################] 100%
LibraryManager: Installing id=346
Downloading [####################################] 100%
Unpacking [####################################] 100%
LibraryManager: Installing id=305 @ ^1.1.0
Downloading [####################################] 100%
Unpacking [####################################] 100%
LibraryManager: Installing id=1826 @ ^1.0.0
Downloading [####################################] 100%
Unpacking [####################################] 100%
LibraryManager: Installing my9291
git version 2.7.4
Cloning into '/home/russell/repos/AiLight/.piolibdeps/_tmp_installing-69RTfQ-package'...
remote: Counting objects: 20, done.
remote: Compressing objects: 100% (17/17), done.
remote: Total 20 (delta 0), reused 10 (delta 0), pack-reused 0
Unpacking objects: 100% (20/20), done.
Checking connectivity... done.
LibraryManager: Installing id=306
Downloading [####################################] 100%
Unpacking [####################################] 100%
PlatformManager: Installing espressif8266
Downloading [####################################] 100%
Unpacking [####################################] 100%
espressif8266 @ 1.6.0 has been successfully installed!
The platform 'espressif8266' has been successfully installed!
The rest of packages will be installed automatically depending on your build environment.
PackageManager: Installing toolchain-xtensa @ ~1.40802.0
Downloading [####################################] 100%
Unpacking [####################################] 100%
PackageManager: Installing tool-esptool @ ~1.409.0
Downloading [####################################] 100%
Unpacking [####################################] 100%
PackageManager: Installing framework-arduinoespressif8266 @ ~1.20400.0
Downloading [####################################] 100%
Unpacking [####################################] 100%
CorePackageManager: Installing tool-scons @ ~3.20501.2
Downloading [####################################] 100%
Unpacking [####################################] 100%
tool-scons @ 3.20501.2 has been successfully installed!
Verbose mode can be enabled via -v, --verbose
option
Converting main.ino
Collected 32 compatible libraries
Scanning dependencies...
Library Dependency Graph ( http://bit.ly/configure-pio-ldf )
|-- v5.13.1
|-- v0.8.2
| |-- v1.1.3
| | |-- v1.0
|-- v2.0.0 #fd9271c
|-- v1.1.3
| |-- v1.0
|-- v1.1.1
| |-- v1.1.3
| | |-- v1.0
| |-- v1.0
| |-- v1.0
| |-- v5.13.1
|--
| |-- v2.0.0 #fd9271c
|-- v1.0
|-- v1.0
| |-- v1.0
| |--
| | |-- v1.0
|--
| |-- v1.0
|-- v1.0
|-- v1.0
|-- v1.0
Compiling .pioenvs/dev/src/main.ino.cpp.o
Archiving .pioenvs/dev/libFrameworkArduinoVariant.a
Indexing .pioenvs/dev/libFrameworkArduinoVariant.a
Compiling .pioenvs/dev/FrameworkArduino/Esp.cpp.o
Compiling .pioenvs/dev/FrameworkArduino/FS.cpp.o
Compiling .pioenvs/dev/FrameworkArduino/FunctionalInterrupt.cpp.o
Compiling .pioenvs/dev/FrameworkArduino/HardwareSerial.cpp.o
Compiling .pioenvs/dev/FrameworkArduino/IPAddress.cpp.o
Compiling .pioenvs/dev/FrameworkArduino/MD5Builder.cpp.o
Compiling .pioenvs/dev/FrameworkArduino/Print.cpp.o
Compiling .pioenvs/dev/FrameworkArduino/Schedule.cpp.o
In file included from src/main.h:20:0,
from /home/russell/repos/AiLight/src/main.ino:13:
src/config.h:43:1: error: 'define' does not name a type
define WIFI_SSID "Asgard2"
^
In file included from lib/AiLight/AiLight.hpp:19:0,
from src/main.h:35,
from /home/russell/repos/AiLight/src/main.ino:13:
.piolibdeps/my9291/src/my9291.h:41:3: error: 'my9291_cmd_one_shot_t' does not name a type
} my9291_cmd_one_shot_t;
^
.piolibdeps/my9291/src/my9291.h:72:9: error: 'my9291_cmd_one_shot_t' does not name a type
my9291_cmd_one_shot_t one_shot:1;
^
Compiling .pioenvs/dev/FrameworkArduino/Stream.cpp.o
Compiling .pioenvs/dev/FrameworkArduino/StreamString.cpp.o
Compiling .pioenvs/dev/FrameworkArduino/Tone.cpp.o
Compiling .pioenvs/dev/FrameworkArduino/Updater.cpp.o
/home/russell/repos/AiLight/src/main.ino: In function 'void loadFactoryDefaults()':
/home/russell/repos/AiLight/src/main.ino:57:19: error: 'MQTT_PORT' was not declared in this scope
cfg.mqtt_port = MQTT_PORT;
^
/home/russell/repos/AiLight/src/main.ino:58:30: error: 'MQTT_SERVER' was not declared in this scope
os_strcpy(cfg.mqtt_server, MQTT_SERVER);
^
/home/russell/repos/AiLight/src/main.ino:76:28: error: 'WIFI_SSID' was not declared in this scope
os_strcpy(cfg.wifi_ssid, WIFI_SSID);
^
/home/russell/repos/AiLight/src/main.ino:77:27: error: 'WIFI_PSK' was not declared in this scope
os_strcpy(cfg.wifi_psk, WIFI_PSK);
^
Compiling .pioenvs/dev/FrameworkArduino/WMath.cpp.o
/home/russell/repos/AiLight/src/_web.ino: In function 'void wsProcessMessage(uint8_t, char*, size_t)':
/home/russell/repos/AiLight/src/_web.ino:188:34: error: 'MQTT_PORT' was not declared in this scope
: MQTT_PORT;
^
Compiling .pioenvs/dev/FrameworkArduino/WString.cpp.o
Compiling .pioenvs/dev/FrameworkArduino/abi.cpp.o
Compiling .pioenvs/dev/FrameworkArduino/base64.cpp.o
*** [.pioenvs/dev/src/main.ino.cpp.o] Error 1
============================================================= [ERROR] Took 33.12 seconds =============================================================
===================================================================== [SUMMARY] =====================================================================
Environment dev [ERROR]
Environment dev-ota [SKIP]
Environment prod [SKIP]
Environment prod-ota [SKIP]
============================================================= [ERROR] Took 33.12 seconds =============================================================`
`/**
Ai-Thinker RGBW Light Firmware - Configuration
This file is part of the Ai-Thinker RGBW Light Firmware.
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
Created by Sacha Telgenhof
Copyright (c) 2016 - 2018 Sacha Telgenhof
*/
/**
#define HOSTNAME "AiLight"
#define ADMIN_PASSWORD "hinotori"
/**
*/
#define OTA_PORT 8266
/**
/**
#define MQTT_PAYLOAD_ON "ON"
#define MQTT_PAYLOAD_OFF "OFF"
#define MQTT_STATUS_ONLINE "online"
#define MQTT_STATUS_OFFLINE "offline"
#define MQTT_HOMEASSISTANT_DISCOVERY_ENABLED false
#define MQTT_HOMEASSISTANT_DISCOVERY_PREFIX "homeassistant"
/**
`******************************************************************************************************************************************************
If you like PlatformIO, please:
LibraryManager: Installing id=64
Downloading [####################################] 100%
Unpacking [####################################] 100%
LibraryManager: Installing id=346
Downloading [####################################] 100%
Unpacking [####################################] 100%
LibraryManager: Installing id=305 @ ^1.1.0
Downloading [####################################] 100%
Unpacking [####################################] 100%
LibraryManager: Installing id=1826 @ ^1.0.0
Downloading [####################################] 100%
Unpacking [####################################] 100%
LibraryManager: Installing my9291
git version 2.7.4
Cloning into '/home/russell/repos/AiLight/.piolibdeps/_tmp_installing-69RTfQ-package'...
remote: Counting objects: 20, done.
remote: Compressing objects: 100% (17/17), done.
remote: Total 20 (delta 0), reused 10 (delta 0), pack-reused 0
Unpacking objects: 100% (20/20), done.
Checking connectivity... done.
LibraryManager: Installing id=306
Downloading [####################################] 100%
Unpacking [####################################] 100%
PlatformManager: Installing espressif8266
Downloading [####################################] 100%
Unpacking [####################################] 100%
espressif8266 @ 1.6.0 has been successfully installed!
The platform 'espressif8266' has been successfully installed!
The rest of packages will be installed automatically depending on your build environment.
PackageManager: Installing toolchain-xtensa @ ~1.40802.0
Downloading [####################################] 100%
Unpacking [####################################] 100%
PackageManager: Installing tool-esptool @ ~1.409.0
Downloading [####################################] 100%
Unpacking [####################################] 100%
PackageManager: Installing framework-arduinoespressif8266 @ ~1.20400.0
Downloading [####################################] 100%
Unpacking [####################################] 100%
CorePackageManager: Installing tool-scons @ ~3.20501.2
Downloading [####################################] 100%
Unpacking [####################################] 100%
tool-scons @ 3.20501.2 has been successfully installed!
Verbose mode can be enabled via -v, --verbose
option
Converting main.ino
Collected 32 compatible libraries
Scanning dependencies...
Library Dependency Graph ( http://bit.ly/configure-pio-ldf )
|-- v5.13.1
|-- v0.8.2
| |-- v1.1.3
| | |-- v1.0
|-- v2.0.0 #fd9271c
|-- v1.1.3
| |-- v1.0
|-- v1.1.1
| |-- v1.1.3
| | |-- v1.0
| |-- v1.0
| |-- v1.0
| |-- v5.13.1
|--
| |-- v2.0.0 #fd9271c
|-- v1.0
|-- v1.0
| |-- v1.0
| |--
| | |-- v1.0
|--
| |-- v1.0
|-- v1.0
|-- v1.0
|-- v1.0
Compiling .pioenvs/dev/src/main.ino.cpp.o
Archiving .pioenvs/dev/libFrameworkArduinoVariant.a
Indexing .pioenvs/dev/libFrameworkArduinoVariant.a
Compiling .pioenvs/dev/FrameworkArduino/Esp.cpp.o
Compiling .pioenvs/dev/FrameworkArduino/FS.cpp.o
Compiling .pioenvs/dev/FrameworkArduino/FunctionalInterrupt.cpp.o
Compiling .pioenvs/dev/FrameworkArduino/HardwareSerial.cpp.o
Compiling .pioenvs/dev/FrameworkArduino/IPAddress.cpp.o
Compiling .pioenvs/dev/FrameworkArduino/MD5Builder.cpp.o
Compiling .pioenvs/dev/FrameworkArduino/Print.cpp.o
Compiling .pioenvs/dev/FrameworkArduino/Schedule.cpp.o
In file included from src/main.h:20:0,
from /home/russell/repos/AiLight/src/main.ino:13:
src/config.h:43:1: error: 'define' does not name a type
define WIFI_SSID "Asgard2"
^
In file included from lib/AiLight/AiLight.hpp:19:0,
from src/main.h:35,
from /home/russell/repos/AiLight/src/main.ino:13:
.piolibdeps/my9291/src/my9291.h:41:3: error: 'my9291_cmd_one_shot_t' does not name a type
} my9291_cmd_one_shot_t;
^
.piolibdeps/my9291/src/my9291.h:72:9: error: 'my9291_cmd_one_shot_t' does not name a type
my9291_cmd_one_shot_t one_shot:1;
^
Compiling .pioenvs/dev/FrameworkArduino/Stream.cpp.o
Compiling .pioenvs/dev/FrameworkArduino/StreamString.cpp.o
Compiling .pioenvs/dev/FrameworkArduino/Tone.cpp.o
Compiling .pioenvs/dev/FrameworkArduino/Updater.cpp.o
/home/russell/repos/AiLight/src/main.ino: In function 'void loadFactoryDefaults()':
/home/russell/repos/AiLight/src/main.ino:57:19: error: 'MQTT_PORT' was not declared in this scope
cfg.mqtt_port = MQTT_PORT;
^
/home/russell/repos/AiLight/src/main.ino:58:30: error: 'MQTT_SERVER' was not declared in this scope
os_strcpy(cfg.mqtt_server, MQTT_SERVER);
^
/home/russell/repos/AiLight/src/main.ino:76:28: error: 'WIFI_SSID' was not declared in this scope
os_strcpy(cfg.wifi_ssid, WIFI_SSID);
^
/home/russell/repos/AiLight/src/main.ino:77:27: error: 'WIFI_PSK' was not declared in this scope
os_strcpy(cfg.wifi_psk, WIFI_PSK);
^
Compiling .pioenvs/dev/FrameworkArduino/WMath.cpp.o
/home/russell/repos/AiLight/src/_web.ino: In function 'void wsProcessMessage(uint8_t, char*, size_t)':
/home/russell/repos/AiLight/src/_web.ino:188:34: error: 'MQTT_PORT' was not declared in this scope
: MQTT_PORT;
^
Compiling .pioenvs/dev/FrameworkArduino/WString.cpp.o
Compiling .pioenvs/dev/FrameworkArduino/abi.cpp.o
Compiling .pioenvs/dev/FrameworkArduino/base64.cpp.o
*** [.pioenvs/dev/src/main.ino.cpp.o] Error 1
============================================================= [ERROR] Took 33.12 seconds =============================================================
===================================================================== [SUMMARY] =====================================================================
Environment dev [ERROR]
Environment dev-ota [SKIP]
Environment prod [SKIP]
Environment prod-ota [SKIP]
============================================================= [ERROR] Took 33.12 seconds =============================================================`
`/**
Ai-Thinker RGBW Light Firmware - Configuration
This file is part of the Ai-Thinker RGBW Light Firmware.
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
Created by Sacha Telgenhof
Copyright (c) 2016 - 2018 Sacha Telgenhof
*/
/**
#define HOSTNAME "AiLight"
#define ADMIN_PASSWORD "hinotori"
/**
*/
#define OTA_PORT 8266
/**
/**
#define MQTT_PAYLOAD_ON "ON"
#define MQTT_PAYLOAD_OFF "OFF"
#define MQTT_STATUS_ONLINE "online"
#define MQTT_STATUS_OFFLINE "offline"
#define MQTT_HOMEASSISTANT_DISCOVERY_ENABLED false
#define MQTT_HOMEASSISTANT_DISCOVERY_PREFIX "homeassistant"
/**
Unable to make a REST API call using NodeJS with the 'http' (or 'request') module. The REST API returns a 400 status code ("API-Key is missing") even though the appropriate "API-Key" header is sent.
The NodeJS http module converts HTTP header keys to lowercase causing the AiLight authentication to fail. HTTP headers are in fact case-insensitive. See: http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html section 4.2.
I've run into a problem with the web UI. After flashing a recent upgrade, I seem to have lost the ability to interact with the device via the web UI. None of the on-device parameters show up in the UI (settings or about pages). I've tried reflashing the device multiple times, but alas no luck. I've cleared the browser cache and tried multiple browsers (Firefox and Chrome). Even my Android Chrome is now broken. What is bizarre is that HA can still interact with the device via MQTT (turn on/off, set color, etc.).
This seemed to have started right around the 0.4.1 time frame, but I'm not positive about that. I have been tending to pull from the repo occasionally and rebuild/flash. I've not really changed anything in config.h or platformio.ini that I can think of (besides trying to keep them in sync with the example files).
I did at one point long ago build the webapp from scratch prior to it being prebuilt. I've made sure that src/html.gz.h is up to date and even deleted node_modules/ directory just in case.
Javascript Console:
[WEBSOCKET] Connected to ws://ailight-ac2ac1.local/ws
(index):1 WebSocket connection to 'ws://ailight-ac2ac1.local/ws' failed: Could not decode a text frame as UTF-8.
wsConnect @ (index):1
(anonymous) @ (index):1
(index):1 [WEBSOCKET] Error: [object Event]
(index):1 [WEBSOCKET] Connection closed
(index):1 CloseEvent {wasClean: false, code: 1006, reason: "", type: "close", target: WebSocket…}
(index):1
(index):1 [EVENTSOURCE] Connected to http://ailight-ac2ac1.local/events
Looks like commit [15ec068] (Support for Home Assistant's MQTT Discovery) broke ws for me.
(Based on forum discussion on https://community.home-assistant.io/t/how-to-inexpensive-10-us-wifi-rgb-bulb-that-works-with-home-assistant/14735/242)
Hi,
Although you have mentioned the LOHAS bulbs are incompatible due to them having an MY9231 controller, on a HA thread I noticed that somebody tested it out and that it could control the bulb, just that all the settings were resulting in different outputs than expected.
Are there any plans to add support for this type of bulb as it reaches greater lux (1380 on this one with very good colored lux capability as well, especially compared to majority of Ai-Thinker bulbs reaching only ~600 lux, assuming you can find a 9W for sale.
This is also an "untapped" market segment as there is currently no HA integration route for LOHAS bulbs besides potentially using HA Cloud component which is not as safe or free, so I believe this has great potential and don't think I would be only one interested in it.
If you do not have any plans on supporting it, could you provide some pointers on how to go about attempting this integration myself as I am new but very interested in the subject.
Thanks !
My light running AiLight 0.51-dev was working perfectly so of course like an idiot I changed some things.
I got a new wifi AP so I changed the ssid and password. That has worked out fine.
At the same time I thought I'd change the name of the bulb to something more descriptive, so I changed the following in the gui:
hostname: hallwaylight
state topic: hallwaylight
command topic: hallwaylight/set
status topic: hallwaylight/status
MQTT Discovery is on, Discovery prefix is homeassistant (both unchanged).
However the bulb never publishes a discovery message. I am watching the entire MQTT namespace via mosquitto_sub, and nothing in the homeassistant/ space, only the following:
mosquitto_sub -v -h xxxx -u xxxxx -P xxxxxxx -t '#' -v
hallwaylight {"state":"ON","brightness":255,"white_value":255,"color_temp":244,"color":{"r":0,"g":0,"b":0},"gamma":true}
hallwaylight/status online
Any ideas?
I have been using AiLight for a while now, in fact I bought one of the original wooden jigs from @stelgenhof.
Recently I wanted to upgrade to the latest code because of the changes since 0.84 of home assistant.
The laptop that I had when I first used AiLight had broken, and with it my install of platformio. Also my jig has a broken wire that will need a soldering iron. It was all looking to hard.
But no, I installed platformio cli on my headless NUC using pip. I cloned github of AiLight. I configured it and did a prod-ota install to the ip address of one of my bulbs. To my surprise it completed successfully, and I have now done them all. I say "surprise" not because I doubted the software, but because I doubted my ability to make it all work smoothly, and because I have never done an OTA update of any esp device previously. I had also never used platformio via the commandline.
So I am very impressed at the ease with which it updated, even for a non dev like me. Congratulations on the system as a whole.
I really like this firmware, but i do however miss the lack of effects. I think the rainbow effect is probably the most wanted one, at least for me. If you could look at a way to integrate this, that would be awesome.
https://github.com/xoseperez/my92xx/blob/master/examples/esp/esp8285_rainbow.cpp
It's all greek to me, so i don't know if the transition times in the effect are adjustable or what's what. If that could be done, it would be the icing on the cake. Cheers and thanks for awesome work on this firmware.
When using Home Assistant's MQTT auto discovery, the light is recognized, however not all features (like color temperature, color, etc.) are available. Only switching ON/OFF works and brightness can be set.
Code builds with a successful message, but getting this error when I try to upload:
before_build([".pioenvs\dev\src\main.ino.o"], ["src\main.ino.cpp"])
C:\Users\Philip\Documents\AILight\AiLight-master/node_modules/.bin/gulp
The system cannot find the path specified.
*** Error 1
Compiling .pioenvs\dev\src\main.ino.o
Linking .pioenvs\dev\firmware.elf
Checking program size
text data bss dec hex filenameE
rror: The program size (438723 bytes) is greater than maximum allowed (434160 bytes)4
28655 10068 32168 470891 72f6b .pioenvs\dev\firmware.elf*
** [.pioenvs\dev\firmware.elf] Explicit exit, status 1
Thanks for the help!
Head's up: Upgrading from recent test builds to current seems to cause saved setting corruption. Did the config_t structure change?
After upgrading, bulb boots but cannot control LEDs. Web UI doesn't show bulb info. (See attached.) Factory Reset does not clear settings.
I hacked together the example EEPROM clear example with the BasicOTA example to get an OTA-able sketch that would wipe saved settings. Uploaded that with Arduino IDE then used Pio to re-load AiLight. That was enough to wipe the old data and access WebUI to re-enter settings.
Same issue on two bulbs. Coming from same previous firmware.
I really like this project. I'm up and running and everything works as advertised.
I'm new to MQTT and my backend is Domoticz. Any plans to support Domoticz in a future release?
I really don't have the skills to implement this support myself.
Keep up the good work :)
/David
Hi,
I'm testing 0.6.0-dev, I'm using it with this script: https://community.home-assistant.io/t/finally-a-cheap-wireless-switch-that-dims-xiaomi-switch-gen1/27574
Which basically fires a dim command in a loop until a button press is released:
service: light.turn_on
entity_id: light.landing_light
data_template:
brightness: '{{states.light.landing_light.attributes.brightness - 10}}'
I've noticed that 0.6.0-dev freezes up for a couple of mins and then comes back, I can still access thr bulb via HTTP but can't issue any commands, I've downgraded the bulb to 0.5.1-dev and it seems to be working fine.
Sorry I can't provide any more details, I'll carry out doing some more testing. Let me know if there's anything else useful I can share.
Cheers!
Something like:
</tr>
<th>Colour</th>
<td><input class="" type="color" id="colour_lamp"></td>
</tr>
let colour_lamp = document.getElementById("colour_lamp");
colour_lamp.addEventListener("change", sendRGB2.bind(this), { passive: true});
colour_lamp.addEventListener("input", sendRGB2.bind(this), { passive: true});
function sendRGB2() {
let msg = {
'state': S_ON
};
msg[K_C] = {};
msg[K_C][K_R] = parseInt(colour_lamp.value.substring(1,3), 16);
msg[K_C][K_G] = parseInt(colour_lamp.value.substring(3,5), 16);
msg[K_C][K_B] = parseInt(colour_lamp.value.substring(5,7), 16);
websock.send(JSON.stringify(msg));
}
If the input event sends the message, perhaps an extra parameter should be sent as well so the
config isn't saved in that case (it would wear down the EEPROM much faster).
A drawback is that the lamp doesn't match the RGB colour of the screen. Some colour correction formula is needed to make this really good.
Can I ask if we can get the availability_topic working. So if the bulb is off it shows as unavailable in home assistant. hopefully if home assistant restart it will also show the current status of the lamp.
https://www.home-assistant.io/components/light.mqtt/#availability_topic
I have it working on my tasmota sonoff switches and it is very handy to see if one of them goes offline
Hi Stelgenhof cheers for this... in the UK I have four Expower 7W Smart WiFi Blub that I got off Amazon and they are working with HA now because of your firmware 👍
Happy Days...
https://www.amazon.co.uk/gp/product/B075Q9NHF2/ref=oh_aui_detailpage_o00_s00?ie=UTF8&psc=1
Hey, thanks again for your excellent work.
Another suggestion for an effect - how about some kind of flickering candle mode?
I understand the limitations of the Flash chip so perhaps effects could be chosen or enabled at compile time.
Thanks very much! :)
I got mine here and they work perfectly https://www.alibaba.com/product-detail/High-Standard-Colorful-Smartphone-Remote-Control_60576662953.html?spm=a2700.7724838.0.0.jahydM
Perhaps add it to your page of working bulbs?
AI-Light version: 0.4.1-dev
HA version: 0.86.2
As of HA 0.84, "mqtt_json" is no longer a valid platform:
home-assistant/core#18227
Since upgrading, I've been unable to use AILight via Home Assistant, and see tons of spam in my logs saying:
Since the error doesn't explicitly suggest AILight is the source of the error, I did a recursive grep for "mqtt_json" in my HA directory and found nothing. Looking through AILight code, however, I see this line, which suggests the platfprm is being set to mqtt_json for discovery purposes:
https://github.com/stelgenhof/AiLight/blob/80666ddca444b8eb529b02ea17770ff10ff5b5b3/src/light.ino
It's certainly possible that I'm misinterpreting things here, but it feels to me like AILight firmware isn't accommodating the new APi for mqtt lights.
Let me know if I can provide additional details.
Add a favicon to the HTML UI, so you can tell which tab the AiLight web GUI is on in a browser with lots of tabs open.
It would be great if AiLight supported homemade solutions too - since they are usually cheaper than an actual bulb, and are easily put together (say, a Wemos D1 Mini @ 2.5$ and an WS2812B LED ring for 3$).
The platform is technically already supported, but it isn't too configurable regarding the lights - I understand that the main goal is to support the official LED bulbs, but it would be awesome if there was a way to configure other, drop-in style controllers (e.g. the WS2811/12 NeoPixel LEDs), something similar to how Mongoose OS solved libraries (libraries can define their own settings, which is then used to generate the settings UI).
I understand that this is a huge thing, since there's no advanced features like interfaces (which would allow for an IoC-like selection of current LED provider), but it would be a welcome change nonetheless.
I accidentally broke a Qube light bulb while moving some boxes and started to look into what I can salvage from its components.
Any chance AiLight can be used (or parts of it) to flash the bulb? The original is dead as Qube took down their servers. Would be good to have a project to revive them
From what i can tell it has an ESP8266EX and a bluetooth chipset. Not sure if it has any fancy LED controller or not
Im attaching some pics of the PCB. I can attach more if needed
Thanks for the incredible firmware. Its been an integral part of an outdoor project of mine using 24 lights. After a recent snowstorm, part of the lights report gamma correction true, part of them report false. I believe this is a EEPROM problem due to the cold, nothing to do with AiLight itself.
The problem I'm running into however is that AiLight doesn't expose this variable to either REST or mqtt, making it difficult to return all of the lights the same state. I'm uncertain if this is a bug or simply unimplemented (and working as expected). I've attached a repro in case it helps.
Changes to MQTT topics made via web interface are not preserved across device reboots.
I have 4 of the same bulbs and I did the following to back up the OEM image.
sudo esptool.py --port /dev/cu.usbserial --baud 115200 read_flash 0x000000 0x100000 light1m.bin
sudo esptool.py --port /dev/cu.usbserial --baud 115200 read_flash 0x000000 0x400000 light4m.bin
I wasn't sure the size of the flash so I made both (esptool said it was 4m)
When I flashed either one back to the bulb it just goes into a boot loop. Fortunately, I was able to flash AiLight and it works fine but I'd like to get a working backup of the OEM firmware.
Hey, first thank you for the awesome project! I ordered 2 bulbs which should arrive shortly, but I have a concern or question, as I can't find it documented anywhere in the Wiki:
-What happens if I get a new router with a different SSID and password or what happens if I configure the lights in the AP mode for the first time and enter the wrong Wi-Fi credentials? My guess is I can't enter the lights in the AP mode for correction again until I have to re-flash the firmware, am I right? This could be solved or implemented using maybe a timeout which will check if there is no Wi-Fi Connection for like 24 hours while being powered on and then reset to factory defaults (just like the button in the web interface does)
Tanks in advance! 👍 maybe this could be seen as a feature and could be implemented in the compile-time as option.
Sacha, thanks for this project. Really useful.
I would like the option to have the bulb turn on upon power-on. Right now, it seems bulbs stay off until explicitly given a command to turn on (so you have to monitor the mqtt status topic for that bulb). If the bulbs defaults to turning on when powered, at some setting defined in the config maybe, then the bulb at least functions like a regular light bulb in the absence of a controller on the network.
Edit: I think this must be the behavior on the latest version? But just updated and the bulb turns on at the last setting. Thanks!
Successfully flashed two bulbs using wired connection. Bulbs are operating.
Trying to upload via OTA in Atom with pio run -t upload -e dev-ota --upload-port <IP>
but getting a failure for no response:
18:36:46 [INFO]: Starting on 0.0.0.0:38558
18:36:46 [INFO]: Upload size: 401424
18:36:46 [INFO]: Sending invitation to: 192.168.9.228
Authenticating...OK
18:36:46 [INFO]: Waiting for device...
18:36:56 [ERROR]: No response from device
*** [upload] Error 1
I'm having an interesting issue with the AiLight bulb. I am able to successfully upload firmware to the bulb according to PlatformIO but it does not change the bulb's behavior.
I have deleted my AiLight repository and the AiLight github repository and rebuilt everything from scratch to no avail.
I am getting a blue light with intermittent brief flashing when turning on the light bulb, regardless of the 'default' state that I specify in my config.h
file.
I have ordered another bulb to test against as well.
I am wondering if there is a section of the esp8266 flash that PlatformIO is not writing to that is somehow corrupted.
Is there a simple way to pull the bin back off the esp8266 so that I can compare it to the compiled file?
Verbose output of successful upload:
opening bootloader [32/1885]
resetting board
trying to connect
espcomm_send_command: sending command header
espcomm_send_command: sending command payload
trying to connect
espcomm_send_command: sending command header
espcomm_send_command: sending command payload
espcomm_send_command: receiving 2 bytes of data
espcomm_send_command: receiving 2 bytes of data
espcomm_send_command: receiving 2 bytes of data
espcomm_send_command: receiving 2 bytes of data
espcomm_send_command: receiving 2 bytes of data
espcomm_send_command: receiving 2 bytes of data
espcomm_send_command: receiving 2 bytes of data
espcomm_send_command: receiving 2 bytes of data
Uploading 395808 bytes from .pioenvs/dev/firmware.bin to flash at 0x00000000
erasing flash
size: 060a20 address: 000000
first_sector_index: 0
total_sector_count: 97
head_sector_count: 16
adjusted_sector_count: 81
erase_size: 051000
espcomm_send_command: sending command header
espcomm_send_command: sending command payload
setting timeout 15000
setting timeout 100
espcomm_send_command: receiving 2 bytes of data
writing flash
................................................................................ [ 20% ]
................................................................................ [ 41% ]
................................................................................ [ 62% ]
................................................................................ [ 82% ]
................................................................... [ 100% ]
starting app without reboot
espcomm_send_command: sending command header
espcomm_send_command: sending command payload
espcomm_send_command: receiving 2 bytes of data
closing bootloader
======================================================== [SUCCESS] Took 52.26 seconds ========================================================
Are there any plans for a homebridge plugin?
I flashed the code on to one of these, but it just caused boot loops.
http://tinkerman.cat/yet-another-wifi-light-bulb/#more-2127
I'm going to try Espurna, but is there anything I might be able to change in your code to make it compatible?
Is there any planned support for:
LC01 | RGB | 5-28V | None | ~$8
LC02 | RGBW | 9-12V | None | ~$11
LC03 | RGB | 5-28V | IR | ~$12
LC04 | RGBW | 9-12V | IR | ~$13
LC08 | RGBWW | 5-28V | None | ~$12
LC09 | RGB | 5-28V | RF | ~$12
LC10 | RGBW | 9-28V | RF | ~$14
LC11 | RGBWW | 9-28V | RF | ~$15
I just wanted to let you know that the "Emwel 7W Smart WiFi Bulb Light B22 Led Bulbs Works with Amazon Alexa Echo Remote Control by Smartphone IOS and Android 60W Equivalent [White, Energy Class A+]" bulb on amazon (which is currently on sale for £15) works with your firmware. Incase you wanted to add it to your compatible list.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.