From 6daef8e53c8b22c7da200c5a29fa3251587b8990 Mon Sep 17 00:00:00 2001 From: David White Date: Fri, 20 Dec 2024 15:49:18 -0700 Subject: [PATCH 1/5] Update README.md --- README.md | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6f1a05f7982e..ce17f442e433 100644 --- a/README.md +++ b/README.md @@ -3,17 +3,26 @@ # Aquarium LED Controller The project implements a custom driver for Tasmota that turns an ESP8266-based device into an aquarium light controller for RGBW LED strips. The custom functionality is fairly simple, implementing only two main features: -- **Onboard Brightness Ramping**: Brightness smoothly ramps from 0 to a specified full brightness value for each RGBW channel and back down to 0 over the course of a day between specified sunrise and sunset times following a sine-squared function. Implementing brightness ramping directly on the controller makes it more robust against wireless connectivity issues associated with controlling the light via a central home automation server and relieves such a server from having to execute updates at the rates required to produce a smooth lighting curve. +- **Onboard Brightness Ramping**: Brightness smoothly ramps from 0 to a specified full brightness value for each RGBW channel and back down to 0 over each day. Implementing brightness ramping directly on the controller makes it more robust against wireless connectivity issues associated with controlling the light via a central home automation server and relieves such a server from having to execute updates at the rates required to produce a smooth lighting curve. +- **Custom Ramp Configuration**: Users can configure the ramp shape, ramp time, peak hold time, and steepness for precise control over their lighting schedule. - **Override of Default Functionality**: The ramping functionality described previously is the default for the device but can be overridden, if desired, to make the light essentially just a normal LED smart light. ## Custom Commands The following commands can be executed either in the Tasmota web console or via MQTT to update lighting parameters: - `UpdateSunriseTime {hh}:{mm}`: Sets the `sunrise_hour` and `sunrise_minute` parameters to hour (`hh`) and minute (`mm`) respectively. -- `UpdateSunsetTime {hh}:{mm}`: Sets the `sunset_hour` and `ssunset_minute` parameters to hour (`hh`) and minute (`mm`) respectively. - `UpdatePeakBrightness {r},{g},{b},{w}`: Sets the maximum brightness (0-255) reached by each of the light channels (R, G, B, and W(cold white or warm white depending on your LED strip)). - `ToggleOverride`: Toggles the parameter which determines whether or not the default functionality is overridden. +- `UpdateRampShape {0-2}`: Sets the ramp shape. 0 = sine, 1 = S-curve, 2 = linear. +- `UpdateSteepness {0.0-65.0}`: Adjusts the steepness parameter used by the S-curve ramp. +- `UpdateRampTime {minutes}`: Sets the length for each ramp cycle (up and down) in minutes. Accepts values between 0 and 1440 (24 hours). +- `UpdatePeakHoldTime {minutes}`: Sets the length of time (in minutes) that the light is held at peak brightness between ramp cycles. Accepts values between 0 and 1440 (24 hours). - `UpdateOverrideColor {r},{g},{b},{w}`: Sets the brightness (0-255) for each channel when the default functionality is overridden. - `UpdateOverride`: Mainly used when implementing MQTT-based controls in smart home systems like Home Assistant. Updates the override parameters (on-off and channel brightnesses) but expects a JSON object of the form:

`{"status": "ON|OFF", "color": {"r":{0-255}, "g": {0-255}, "b": {0-255}, "w": {0-255}}}`

+- `UpdateUpdateFrequency {0-3}`: Adjusts the light update frequency setting. Changing this is not advised. The default setting (every 250 seconds) currently provides the best results in transition smoothing tests. 0 = every second, 1 = every 250 milliseconds, 2 = every 100 milliseconds, 3 = every 50 milliseconds. + +## Ramp Shape Playground +I've created interactive graphs for each of the available ramp shapes to help dial in the best lighting schedule. +![ramp_shape_playground_screenshot](https://github.com/user-attachments/assets/42abe918-a608-4242-a14e-d5ed3fd3439f) ## Flashing Firmware and Initial Configuration To install the firmware on your device and connect it to your home network, download the latest build [here](https://github.com/dwight9339/aquarium_light_led_controller/releases) and follow the instructions provided [here](https://tasmota.github.io/docs/Getting-Started/). From 2badab533442cf5090f3de5070062b9a46f66693 Mon Sep 17 00:00:00 2001 From: David White Date: Fri, 20 Dec 2024 15:51:39 -0700 Subject: [PATCH 2/5] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ce17f442e433..0524aec10ee1 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ The following commands can be executed either in the Tasmota web console or via ## Ramp Shape Playground I've created interactive graphs for each of the available ramp shapes to help dial in the best lighting schedule. -![ramp_shape_playground_screenshot](https://github.com/user-attachments/assets/42abe918-a608-4242-a14e-d5ed3fd3439f) +![ramp_shape_playground_screenshot(1)](https://github.com/user-attachments/assets/3ca96f93-9ad0-457e-9949-47ad255f9460) ## Flashing Firmware and Initial Configuration To install the firmware on your device and connect it to your home network, download the latest build [here](https://github.com/dwight9339/aquarium_light_led_controller/releases) and follow the instructions provided [here](https://tasmota.github.io/docs/Getting-Started/). From 19517f92726531f1ee687b2eef22c068c5d63670 Mon Sep 17 00:00:00 2001 From: David White Date: Fri, 20 Dec 2024 15:53:54 -0700 Subject: [PATCH 3/5] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0524aec10ee1..7d6ba73f2471 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ The following commands can be executed either in the Tasmota web console or via - `UpdateUpdateFrequency {0-3}`: Adjusts the light update frequency setting. Changing this is not advised. The default setting (every 250 seconds) currently provides the best results in transition smoothing tests. 0 = every second, 1 = every 250 milliseconds, 2 = every 100 milliseconds, 3 = every 50 milliseconds. ## Ramp Shape Playground -I've created interactive graphs for each of the available ramp shapes to help dial in the best lighting schedule. +I've created a [playground](https://www.desmos.com/calculator/vqs9qccxtg) with interactive graphs for each of the available ramp shapes to help dial in the best lighting schedule. ![ramp_shape_playground_screenshot(1)](https://github.com/user-attachments/assets/3ca96f93-9ad0-457e-9949-47ad255f9460) ## Flashing Firmware and Initial Configuration From 0e1dd001d6869fb08f81cc0b4caaa34ba34c21c1 Mon Sep 17 00:00:00 2001 From: David White Date: Sat, 21 Dec 2024 12:35:42 -0700 Subject: [PATCH 4/5] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 7d6ba73f2471..e4905774fe81 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,7 @@ You can then follow the instructions provided [here](https://tasmota.github.io/d ## Home Assistant Override Entity Controller To implement an entity that can override the aquarium light in Home Assistant, make sure that you have set the light up as an MQTT client as described in the previous sections then add the following code to your `configuration.yaml` file: ``` +# Aquarium light override controls mqtt: - light: schema: json From 105582fb2a53b5ddc5cd960b69fa0004bfbc1d5f Mon Sep 17 00:00:00 2001 From: David White Date: Sat, 21 Dec 2024 14:12:30 -0700 Subject: [PATCH 5/5] Fixed white channel unexpected dimming bug --- tasmota/tasmota_xdrv_driver/xdrv_100_aquarium.ino | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tasmota/tasmota_xdrv_driver/xdrv_100_aquarium.ino b/tasmota/tasmota_xdrv_driver/xdrv_100_aquarium.ino index 8f7f5c6a2a53..000aa3f80db5 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_100_aquarium.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_100_aquarium.ino @@ -318,7 +318,7 @@ void UpdateChannelsSmooth(uint8_t peak_color[4], float brightness_factor, float (uint8_t)current_G, (uint8_t)current_B, (uint8_t)current_W, - (uint8_t)current_W + 0 }; light_controller.changeChannels(channels, false); @@ -370,7 +370,7 @@ void UpdateAquariumBrightness() { // If inside peak hold phase... if (i > ramp_time_ms && i <= ramp_time_ms + peak_hold_time_ms) { // Set channels to peak brightness - uint8_t channels[5] = {peak_color[0], peak_color[1], peak_color[2], peak_color[3], peak_color[3]}; + uint8_t channels[5] = {peak_color[0], peak_color[1], peak_color[2], peak_color[3], 0}; light_controller.changeChannels(channels, false); AddLog(LOG_LEVEL_DEBUG, PSTR("Holding at peak brightness.")); return;