Light accumulation for xiaomi flower sensor

Hi all,

xiaomi flower sensor integrated in HA reports lux values while in xiaomi app you can see also light accumutation (useful if you want to see if plant position is good or not)

Can someone please support me to create a sensor that combine single values in a new one?

I don’t know exactly what mmol is calculated.

Thank you in advance

That’s a measure of amount of substance (1 mol = 6.023*10^23 atoms). Not sun accumulation.


Uhm, you sure?

Positive. Thtat’s a weird unit to measure illumination in.

Uhm, can you suggest me another measure more in line?

μmol/m²/s.

See PPFD https://fluence.science/science/par-ppf-ppfd-dli/

2 Likes

mmol = micro moles per square meter
I guess the app developer took decision to abbreviate (incorrectly) the units.

This may be useful:

wow.

That’s very difficult to me.

I have been looking into the same thing. As far as I understand the most difficult step is to calculate the integral of the graph; that is to calculate the area under the curve (of the lux sensor). But we need to do it numerically and with nonumiform spacing between data points.
I’m thinking there must be some python libraries that can be used.

Well I’m not an expert and I don’t have skills on math. So I you find something that would be great!

Ok so I did some research and experiments.
The first problem is that I don’t have a quantum sensor, which is required to get accurate measurements.
Instead I have to make an assumption that my lux readings matches a pre calibrated light source.
So to convert my lux measurements to PPFD (Photosynthetic Photon Flux Density) as if it was sunlight I use this table: PPFD to Lux conversion
Next step is to calculate the integral of all measured values over a whole day.
For this I found a python library called scipy which has numerical integration functions, of which I used the integrate.trapz function. It takes two arrays (here PPFD values and timestamps from HA) as input and gives a single number as output.
Because the timestamp includes microseconds I divide by 1000000 which should give me the unit μmol/day-m^2 and then by 1000000 again to get mol/day-m^2 which is the unit for DLI.

I am not sure how accurate all of this is but here are the results for two of my plants.

Plant 1 which is standing outside near an east facing wall:
DLI = 27.17
image

Plant 2 which is standing a bit inside from an east facing window:
DLI = 2.36
image

1 Like

to check for accuracy have you looked at values inside flower care app?

FYI, HomeAssistant already has a integration sensor capable of both the Riemann sum or trapezoidal method.

You might just be able to throw the Lux sensor into the integration sensor and get a reasonable output. Or use a template sensor to convert Lux to PPFD, and integrate that.

2 Likes

Well that makes things a lot easier :slight_smile: Thanks @Silicon_Avatar!

No @Jokerigno not yet.

I can now see that the Integration Sensor is a cumulative sensor that does not reset every day. So some combination of Statistics Sensor and History Statistics Sensor would also be needed. I might look into a custom version of the Integration Sensor when I get the time again.
Edit: Maybe the Utility Meter component could be used instead to get daily peak values of the Integration Sensor.

Or treat it as a Utility sensor? It allows daily reset

1 Like

So it’s been running a few days with this sequence of sensors on one plant:

  1. template sensor to convert from lux to ppfd in μmol/s⋅m²
  2. integration sensor to get the accumulated ppfd
  3. template sensor to convert from μmol/d⋅m² to mol/d⋅m² (I guess this could be included in step 1)
  4. utility meter to reset the sensor daily.

Now I am missing a good way to visualise it. A graph like this is not really ideal:
image
And with a bar graph I can’t control which time of the day it takes the value from:
image

Why don’t use custom plant card?

Thanks @Jokerigno! I had not seen that card before. I will look into it :slight_smile:

1 Like