Fluval Aquasky BLE RGB-Light

@Wheemer

Please update to ESPHome 2023.6.1 if possible.

Background: 2023.6 introduced a breaking change in the ESPTime component. As the fluval led thingy is still an external component, it’s hard to support both versions (before and after the change), so I’m afraid the current version only works with 2023.6 and onwards.

If you require an older version, I have to create a branch with the state of the component before the breaking change. I can do that, but it will take some time.

I have created the branch fluval_ble_led_pre2023.6 you can use as ref in the external component section. This contains the code before the breaking change, if you want to stick to ESPHome before 2023.6 for now.

Best regard
mrzottel

1 Like

Hi mrzottel,
yes I have also an issue getting both lights connected at the same time.
I always get connection issues if both are in the yaml file defined.

cu

Michael

I had to switch mine from Arduino to
esp32:
board: esp32dev
framework:
type: esp-idf
version: recommended

That fixed my multiple lights issue.

It’s been working like a champ.
I just updated after the HA timing stopped working.

Sidenote to others updating, I had to add an exception to update.

git config --global --add safe.directory /path/to/esphome/config/.espho me/external_components/7f010557

For some reason, (probably because I’m running it in a docker) I had to chown the folder to root.

sudo chown -R root /path/to/esphome/config/.espho me/external_components/7f010557

Hi mrzottel,

I have a couple of Plant 3.0 lights I am trying to get your awesome component to control and update time for.

I am testing using 1 light with auto mode configured and connecting to an ESP32DevKitC v4 board.

I have been able to establish a connection and I am able to control the mode of the light and read the current mode it is in, however it doesn’t seem to be actually updating the time correctly.

When I unplug the light and plug it back in, it reverts to the midnight state like normal, ESPHome reestablishes connection and says that it successfully wrote the time but I don’t see any change in the light. The time that is says was written appears to be correct as well.

I have also tried using the fluval_ble_led.sync_time method you added but that doesn’t change the light either.

Any idea on what could be happening?

Could the DS1307 time component I am also using be messing it up somehow?

Edit:

I am now getting errors trying to compile my yaml.

src/esphome/components/fluval_ble_led/fluval_ble_led.h:6:10: fatal error: esphome/components/sensor/sensor.h: No such file or directory
 #include "esphome/components/sensor/sensor.h"

Hi Cyberblues,

sorry for the late answer, had some issues logging into the forums.

The issue with time is strange. I have no plant 3.0 light to test, but from the app/protocol, there was no difference in syncing time with this light. I did not use a DS1307 either, because with using HA time, my time gets synced by HA anyway, so no need for additional hardware.

You cloud enable debug logging for the fluval component, it should then print out the time it sends to the light like this:

[02:49:15][D][fluval_ble_led:476]: Year: 23 / Month: 0 / Day: 10 / Day of week: 1 / Hour: 2 / Minute: 49 / Second: 14 / Checksumm: 71

To enable debug, add this to the yaml:

logger:
  level: DEBUG

About the compilation error: Please try “Clean Build Files” from the ESPHome burger menu of the device and try again. It will do a fresh compilation though, which might take a while.

Best regards
mrzottel

@mrzottel

Thanks for the response.

I tried “Clean Build Files” and I am still getting an error.

It is really weird because it worked totally fine for me the day before.

I am on ESPHome 2023.6.4 now but I was also getting the error before updating.

Thanks again for the help.

In file included from src/esphome/components/fluval_ble_led/button/fluval_ble_led_select_mode_button.h:5,
                 from src/esphome/components/fluval_ble_led/button/fluval_ble_led_select_mode_button.cpp:1:
src/esphome/components/fluval_ble_led/fluval_ble_led.h:6:10: fatal error: esphome/components/sensor/sensor.h: No such file or directory
 #include "esphome/components/sensor/sensor.h"
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
*** [/data/esphome-web-bd500c/.pioenvs/esphome-web-bd500c/src/esphome/components/fluval_ble_led/button/fluval_ble_led_select_mode_button.cpp.o] Error 1
========================= [FAILED] Took 16.71 seconds =========================

@Cyberblues

Thats odd - almost looks like a broken ESPHome installation. The missing file (esphome/components/sensor/sensor.h) is not part of the fluval component but a core part of esphome. I guess it will be included by many other components as well.

@3dgeb

Where in Home Assistant/ESPHome did you put the update exception?

Sorry if that is dumb question I am newer to HA and ESPHome.

FYI: For those who could not use esp-idf because of the missing webserver component, which was only available for arduino-framework:

With ESPHome 2023.7, webserver has been implemented as a beta for esp-idf. So if you have two LEDs and could not get them to work using arduino, esp-idf might be an alternative now. (But beware, still beta)

Best regards
mrzottel

Just started playing with this. Great work @mrzottel.

1 Like

Hi mrzottel,

I finally had time to play with this again and I figured out what was causing the compilation error.

All I had to do was add an empty “sensor:” block to the yaml and everything compiled again.

I am now back to the situation where I can connect to my Plant 3.0 lights and the log show the time was sent correctly but the lights don’t seem to update correctly.

They work correctly with the app. Both Plant 3.0 lights have firmware 1.03.

A sample of what I see in the logs when connected to one of the lights is below.

Any ideas on what the check next?

[12:12:47][D][fluval_ble_led:476]: Year: 23 / Month: 0 / Day: 20 / Day of week: 7 / Hour: 12 / Minute: 12 / Second: 47 / Checksumm: 77
[12:12:47][D][fluval_ble_led:321]: [44:A6:E5:68:C3:31] ESP_GATTC_WRITE_CHAR_EVT (Write confirmed)
[12:13:47][D][fluval_ble_led:476]: Year: 23 / Month: 0 / Day: 20 / Day of week: 7 / Hour: 12 / Minute: 13 / Second: 47 / Checksumm: 76
[12:13:47][D][fluval_ble_led:321]: [44:A6:E5:68:C3:31] ESP_GATTC_WRITE_CHAR_EVT (Write confirmed)
[12:14:47][D][fluval_ble_led:476]: Year: 23 / Month: 0 / Day: 20 / Day of week: 7 / Hour: 12 / Minute: 14 / Second: 47 / Checksumm: 79
[12:14:47][D][fluval_ble_led:321]: [44:A6:E5:68:C3:31] ESP_GATTC_WRITE_CHAR_EVT (Write confirmed)

Great work guys!

I’m almost setup. I’m getting Cannot write to BLE characteristic - not connected when I try to interact? Was there a github link anywhere with a complete yaml example by chance?

@Cyberblues

Hi Cyberblues,
sorry for the late answer - the forum used to send me notifications on new posts - I wonder why this did not happen this time…

I am starting to wonder, if this might be a 12 vs. 24 hours issue. Here we use the 24 hours system, and I guess that’s what the Fluval LED expects, as there is no am/pm field. Do you use am/pm by chance?

Best regards
mrzottel

@MustangMatt

Hi MustangMatt,

there is a preliminary documentation available here: Fluval BLE LED — ESPHome (deploy-preview-2653–esphome.netlify.app)

It’s not a complete yaml, so if it does not help please say so, and I will try to extract a complete yaml from my device and PM it to you.

Best regards,
mrzottel

I ended up flashing a new device (esp32-solo-1) and I’m getting what looks like success messages but it isn’t actually working:


|14:51:51|[D]|[switch:016]|'LED Switch' Turning OFF.|
| --- | --- | --- | --- |
|14:51:51|[D]|[fluval_ble_led:193]|Turning LED off|
|14:51:51|[D]|[switch:055]|'LED Switch': Sending state OFF|
|14:51:51|[D]|[fluval_ble_led:321]|[44:A6:E5:6D:D3:19] ESP_GATTC_WRITE_CHAR_EVT (Write confirmed)|
|14:52:47|[D]|[switch:012]|'LED Switch' Turning ON.|
|14:52:47|[D]|[fluval_ble_led:189]|Turning LED on|
|14:52:47|[D]|[switch:055]|'LED Switch': Sending state ON|
|14:52:47|[D]|[fluval_ble_led:321]|[44:A6:E5:6D:D3:19] ESP_GATTC_WRITE_CHAR_EVT (Write confirmed)|

It’s kind of working. If I switch to manual I definitely see the light change. The sliders don’t seem to affect anything. I’ll play around with it a bit more.

@mrzottel

Hi mrzottel thank you for the response.

I do live in the USA but it looks like the ESPHome is sending time in 24H form. See the log text.

I did try changing Home Assistant to English(GB) because I read somewhere that the time format was associated with language. Unfortunately it did not help.

Mode switching and reading the current light mode seem to be working correctly.

Maybe the Plant 3.0 uses a different time message?

I am happy to do some packet sniffing if you point me in the right direction of a program to use.

[19:15:15][D][fluval_ble_led:476]: Year: 23 / Month: 0 / Day: 7 / Day of week: 4 / Hour: 19 / Minute: 15 / Second: 14 / Checksumm: 96
[19:15:15][D][fluval_ble_led:321]: [44:A6:E5:68:C3:31] ESP_GATTC_WRITE_CHAR_EVT (Write confirmed)
[19:16:15][D][fluval_ble_led:476]: Year: 23 / Month: 0 / Day: 7 / Day of week: 4 / Hour: 19 / Minute: 16 / Second: 14 / Checksumm: 127
[19:16:15][D][fluval_ble_led:321]: [44:A6:E5:68:C3:31] ESP_GATTC_WRITE_CHAR_EVT (Write confirmed)
[19:17:15][D][fluval_ble_led:476]: Year: 23 / Month: 0 / Day: 7 / Day of week: 4 / Hour: 19 / Minute: 17 / Second: 14 / Checksumm: 126
[19:17:15][D][fluval_ble_led:321]: [44:A6:E5:68:C3:31] ESP_GATTC_WRITE_CHAR_EVT (Write confirmed)

EDIT:

So I managed to capture the bluetooth packets heading to my light using the build in Bluetooth HCI snoop log on my android phone. After opening the log in Wireshark, I was able to find the time sync message thanks to all your awesome work earlier in this thread.

The command is sending to 0x1000 > 0x1001 just like you found earlier as well.

The message below was sent at 22:00:49 on Sept 7th

Encrypted including the header: 54 5f 80 bc da c3 dc d3 d0 c2 d4 e5 89

Decrypted without the header: 68 0E 17 08 07 04 16 00 31 5d

One thing I noticed is that the fluval app is sending the month as (month - 1) to my light rather than just 0.

I also noticed that there is a “Write Request” command sent before the time sync.
I think this could be the notify part of the hand shake you mention in your post from Jan 26, only here it is happening before the time sync.

Let me know if you would like to see the full bluetooth log.

@Cyberblues

Hi Cyberblues,

thanks for the packet sniffing! This is indeed quite interesting - as a quit test, I created the “plant3” branch and changed the time sent to month - 1. Not sure how it would affect the light, as always sending “0” just would mean that it is “forever January” - but who knows, maybe it changes things.
I tested it with my Aquasky and it still worked, so it should be safe to try.

So feel free to test this branch:

external_components:
  - source: github://mrzottel/esphome@plant3
    components:
      - fluval_ble_led

If this will not fix it, I will try to reverse the order of Write Request / Notify and time sync in this branch to see what happens.

Btw, the fluval module is quite verbose and prints out packets it sends and receives when configuring the logger. My config for logging looks like this:

logger:
  level: VERY_VERBOSE
  logs:
    i2c.arduino: INFO
    i2c.idf: DEBUG
    esp32_ble_tracker: DEBUG
    esp32_ble: DEBUG
    component: ERROR
    api.service: DEBUG
    scheduler: DEBUG
    fluval_ble_led: VERY_VERBOSE

Of course, feel free to PM me the logs - I do really want to get the Plant 3.0 working. My wife is constantly nagging me when I am going to order a Plant 3.0 nano for her aquascape - I mean for research of course :wink:

Best regards,
mrzottel

@mrzottel - Thank you so much for doing all this! I just got my Fluval Plant Nano and will now be able to make sure the light is one when it’s supposed to be.

@Cyberblues - The issue you were/are having, just so I’m clear, is that when you the light is unplugged (or loses power), the time does not get set correctly? How do you determine this? Wait for the light not to come on at the correct time? I would like to try to duplicate the issue.

That is correct. So, when my power goes out, the time defaults to 00:00. So, in other words, my lights immediately think it is midnight when the power is restored. That being said, it is easy for me to troubleshoot because my lights will be on at night when they should not be.

If my power flickers in the middle of the day, I will have my night settings restored, and the schedule will continue as normal, but with the wrong starting time.