Giter Site home page Giter Site logo

stelgenhof / ailight Goto Github PK

View Code? Open in Web Editor NEW
256.0 17.0 41.0 1.48 MB

AiLight is a custom firmware for the esp8266 based Ai-Thinker (or equivalent) RGBW WiFi light bulbs

License: MIT License

C++ 26.05% C 53.68% Python 0.20% JavaScript 8.90% HTML 8.33% SCSS 2.84%
esp8266 led rgbw-device firmware bulb ailight-library mqtt light custom-firmware my9291

ailight's People

Contributors

ahcvolle avatar darkfiberiru avatar dependabot[bot] avatar donkawechico avatar olekenneth avatar stelgenhof avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ailight's Issues

[Violation] Added non-passive event listener to a scroll-blocking 'touchmove' event.

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.

Losing config after powering off

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?

Cannot accept empty wifi password?

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.

AiLight entering config mode when MQTT unreachable

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.

Color Temperature setting is not retained after restart

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).

The REST API examples doesn't work

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'

Compatible bulbs?

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. :) 👍

Support for color temperature

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?

Gamma setting

First, gamma correction is awesome. Loving it.

On/Off state does not seem to be preserved across device reboots. Always switches to Off.

Thanks.

AiLight not working with provided binaries.

(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.

Flash example

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.

behaviour on wifi disconnect

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?

problem with OTA update

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

Errors during compile 'WIFI_SSID' was not declared in this scope

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:


[Wed Mar 7 13:20:34 2018] Processing dev (extra_scripts: build.py; build_flags: -DDEBUG -g -Wall -Wl,-Tesp8266.flash.1m128.ld; lib_deps: ArduinoJson, AsyncMqttClient, xoseperez/my9291, ESPAsyncTCP, ESP Async WebServer; platform: espressif8266; board: esp8285; framework: arduino)

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

  • (https://www.sachatelgenhof.nl)

  • Copyright (c) 2016 - 2018 Sacha Telgenhof
    */

/**

  • Light

  • Use the below variables to set the default behaviour of your Ai-Thinker RGBW
  • Light. These will be used as the factory defaults of your device.
    */
    #define LIGHT_STATE false
    #define LIGHT_BRIGHTNESS 0
    #define LIGHT_COLOR_TEMPERATURE 0
    #define LIGHT_COLOR_RED 64
    #define LIGHT_COLOR_GREEN 64
    #define LIGHT_COLOR_BLUE 64
    #define LIGHT_COLOR_WHITE 0

#define HOSTNAME "AiLight"
#define ADMIN_PASSWORD "hinotori"

/**

  • OTA (Over The Air) Updates

*/
#define OTA_PORT 8266

/**

  • WiFi

  • Use the below variables to set the default WiFi settings of your Ai-Thinker
  • RGBW Light. These will be used as the factory defaults of your device. If no
  • SSID/PSK are provided, your Ai-Thinker RGBW light will start in AP mode.
    */
    define WIFI_SSID "Asgard2"
    define WIFI_PSK "secret"
    #define WIFI_OUTPUT_POWER 1.0 // 20.5 is the maximum output power

/**

  • MQTT

  • Use the below variables to set the default MQTT settings of your Ai-Thinker
  • RGBW Light. These will be used as the factory defaults of your device and
  • making the connection to your Home Assistant instance. Most of these settings
  • can also be changed in the UI environment.
    */
    define MQTT_PORT 1883
    define MQTT_SERVER "192.168.1.81"
    #define MQTT_USER ""
    #define MQTT_PASSWORD ""
    #define MQTT_RECONNECT_TIME 10000
    #define MQTT_QOS_LEVEL 0
    #define MQTT_RETAIN false
    #define MQTT_KEEPALIVE 30

#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"

/**

  • HTTP

  • Use the below variables to set the default HTTP settings of your Ai-Thinker
  • RGBW Light. These will be used as the factory defaults of your device.
    */
    #define REST_API_ENABLED false`
    Build i

`******************************************************************************************************************************************************
If you like PlatformIO, please:


[Wed Mar 7 13:20:34 2018] Processing dev (extra_scripts: build.py; build_flags: -DDEBUG -g -Wall -Wl,-Tesp8266.flash.1m128.ld; lib_deps: ArduinoJson, AsyncMqttClient, xoseperez/my9291, ESPAsyncTCP, ESP Async WebServer; platform: espressif8266; board: esp8285; framework: arduino)

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

  • (https://www.sachatelgenhof.nl)

  • Copyright (c) 2016 - 2018 Sacha Telgenhof
    */

/**

  • Light

  • Use the below variables to set the default behaviour of your Ai-Thinker RGBW
  • Light. These will be used as the factory defaults of your device.
    */
    #define LIGHT_STATE false
    #define LIGHT_BRIGHTNESS 0
    #define LIGHT_COLOR_TEMPERATURE 0
    #define LIGHT_COLOR_RED 64
    #define LIGHT_COLOR_GREEN 64
    #define LIGHT_COLOR_BLUE 64
    #define LIGHT_COLOR_WHITE 0

#define HOSTNAME "AiLight"
#define ADMIN_PASSWORD "hinotori"

/**

  • OTA (Over The Air) Updates

*/
#define OTA_PORT 8266

/**

  • WiFi

  • Use the below variables to set the default WiFi settings of your Ai-Thinker
  • RGBW Light. These will be used as the factory defaults of your device. If no
  • SSID/PSK are provided, your Ai-Thinker RGBW light will start in AP mode.
    */
    define WIFI_SSID "Asgard2"
    define WIFI_PSK "secret"
    #define WIFI_OUTPUT_POWER 1.0 // 20.5 is the maximum output power

/**

  • MQTT

  • Use the below variables to set the default MQTT settings of your Ai-Thinker
  • RGBW Light. These will be used as the factory defaults of your device and
  • making the connection to your Home Assistant instance. Most of these settings
  • can also be changed in the UI environment.
    */
    define MQTT_PORT 1883
    define MQTT_SERVER "192.168.1.81"
    #define MQTT_USER ""
    #define MQTT_PASSWORD ""
    #define MQTT_RECONNECT_TIME 10000
    #define MQTT_QOS_LEVEL 0
    #define MQTT_RETAIN false
    #define MQTT_KEEPALIVE 30

#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"

/**

  • HTTP

  • Use the below variables to set the default HTTP settings of your Ai-Thinker
  • RGBW Light. These will be used as the factory defaults of your device.
    */
    #define REST_API_ENABLED false`

Lost the ability to interact with the device via the web UI after flashing

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)

LOHAS bulb support

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 !

HA MQTT auto discovery problem

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?

Impressed all over again

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.

[Request] Rainbow effect

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.

Unable to flash lightbulb

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!

OTA to latest version seems to have corrupted saved settings

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.

screen shot 2017-05-08 at 9 41 16 pm

Domoticz support in the future?

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

Freezes for a couple of mins when firing quick MQTT

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!

Use an input type='color' instead of sliders?

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.

[Request] Candle Effect

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! :)

Undefined Variable Errors Save Function

Tried making a PR, but don't have permission.

In line 449 in app.js, var s should be initialized as an empty object var s ={}, msg = {};. Otherwise an error ensues preventing saving any user settings.

undefined-bug

"mqtt_json" platform no longer supported by Home Assistant

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:
image

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 favicon

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.

Add support for DIY devices

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.

Question. Qube light bulb

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

img_8405
img_8406
img_8407
img_8410
img_8411
img_8414
img_8413
img_8412

Gamma boolean can not be set via REST or mqtt

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.

gamma-repro.txt

Backing up OEM firmware

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.

What happens if the Network changes? Any way to re-enter AP mode / Reset

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.

Upon power on, light turns on.

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!

OTA doesn't seem to be working.

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

Firmware Uploads - No change to bulb

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 ========================================================

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.