Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

min_dli and max_dli derived from openplantbook not the same #52

Open
appiekap653 opened this issue Nov 12, 2022 · 9 comments
Open

min_dli and max_dli derived from openplantbook not the same #52

appiekap653 opened this issue Nov 12, 2022 · 9 comments
Labels
bug Something isn't working

Comments

@appiekap653
Copy link

appiekap653 commented Nov 12, 2022

I think the conversion from the openplantbook values for min_light_mmol and max_light_mmol to your min_dli and max_dli are not corresponding. Please correct me if I'm wrong.

For example my plant: Pellaea Rotundifolia
Min_light_mmol: 400
Max_light_mmol: 700

Converting millimol to mol would result in 0,4 mol and 0,7 mol

Your values:

Min_dli: 1 mol
Max_dli: 3 mol

With these differences my flower care app states that my plant have already accumulated enough sunlight while your integration still states not nearly enough.

Screenshot_20221112-131400_Firefox

Screenshot_20221112-130219_Firefox

Screenshot_20221112-130101_Flower Care

Screenshot_20221112-125859_Home Assistant

Screenshot_20221112-125908_Home Assistant

Converting your current dli value from the utility meter and the integral meter from mol to millimol it comes close to the accumulated value from the flower care app, so that is not the problem.

Flower care app: 459 millimol
Your dli: 0,51 mol = 510 millimol

It's just the min_dli and max_dli that don't compare.

Can it be that you misread the openplantbook values for umol (micromol)?

@Olen
Copy link
Owner

Olen commented Nov 12, 2022

I think you misunderstand what DLI is.
The value for mol (and mmol and umol) is the current value (how much light does tha plant receive right now).
Whereas the DLI is the daily light integral - e.g how much light is accumulated on a certain area (m²) over a whole day.

To calculate the max/min DLI from max/min mol, you need to also factor in the number of light hours, which is why the PPFD-value (mol) is multiplied with a constant to to find the DLI.

PPFD_DLI_FACTOR = 0.0036

https://en.wikipedia.org/wiki/Daily_light_integral

I don't know what numbers the app is using, and why, but it does not look like it is DLI.

@appiekap653
Copy link
Author

#21 your calculation is based on the value from the app being umol while it is mmol.

I have looked some more on the numbers and formulas here, and I am still slightly confused, but I MIGHT have gotten an idea about how it works.

One example plant from OPB has the following thresholds:
**Max LX: 120,000**
**Min LX: 3,500**

**Max Mol: 18,000**
**Min Mol 4,400**

Just naively converting these numbers using the table here does not make any sense:
https://www.apogeeinstruments.com/conversion-ppfd-to-lux/

120000 * 0.0185 = 2220
3500 * 0.0185 = 64

So the idea I am looking at is if max/min mol in OPB is based on per hour averages over a total of 24 hours. 

For example - let's say we have 10 hours of light in a day for simplicity.

That gives us for instance 100000 lx * 0.0185 * 10 hours = 18500 µmol => To much light in total according to OPB, even if it was never above _max_lx_ 
Or 4000 lx * 0.0185 * 10 hours  = 740 => To little light in total even if it has been above _min_lx_ all the time.

Here you are calculating your example with an outcome of 18500 micromol and saying it is too high for the app value of 18000 millimol while it is instead far under because 18500 micromol=18,5 millimol.

When I compare your calculation of the dli through your ppfd sensor, the integral sensor and the meter utility, that value is roughly the same number of mmol compared to what the app is showing for accumulated sunlight in the day.

Your calculation: 510 mmol accumulated today.
App calculation: 459 mmol accumulated today.

The only difference is the min and max values.

0,4 mol min in the app (400mmol is shown converting that to mol will give 0,4 mol per day)
1 mol min in your integration (derived from your conversation from the 400mmol app value to your min_dli value)

The app is showing that the value it is showing is in fact the ppfd calculation for sunlight accumulated over the day. You can even view a bar graph with every mmol accumulated in the hour in the app.
Therefore the min max values the app is showing (in this case 400 mmol per day) are also the ppfd calculated sunlight accumulated over the day.

@appiekap653
Copy link
Author

appiekap653 commented Nov 12, 2022

It is true that the notation the app is using for dli is not the commonly used one: moles per square meter per day.
In case with the app the min / max and current dli is displayed in: millimol per square meter per day

Now in your app you are calculating the min / max dli expressed in moles per square meter per day with the formula: value from app * 0,0036 =

In my plant example from above you calculate:
400 (min_value_from app) * 0,0036 = 1,44 mol per square meter per day.
Because you are using int as placeholder it is rounded to 1, therefore in my screenshot from HA it shows 1 mol per square meter per day.

Your sensor value for current dli is the same value as in the app (0,51 mol per square meter per day while in the app 459 mmol (converting the units to be the same gives 0,459 mol per square meter per day)

Your sensor value for minimal dli is way higher than in the app (1,44 mol per square meter per day while in the app 400 mmol (converting the units to be the same gives 0,4 mol per square meter per day)

In this case the app will show that I have accumulated enough sunlight for the day while your integration is showing that I'm just over the half of what is needed.

https://en.m.wikipedia.org/wiki/Daily_light_integral

usually expressed as moles of light (mol photons) per square meter (m−2) per day (d−1), or: mol·m−2·d

@Olen
Copy link
Owner

Olen commented Nov 13, 2022

I am not sure I follow all your numbers here, but are you basically saying that max_light_mmol and min_light_mmol from openplantbook is in fact a daily light integral (just with another factor than the usual DLI) and NOT a "current momentary value" as I thought it was?
I don't have the same app as you, so i have never seen the graphs you are refering to.

@appiekap653
Copy link
Author

appiekap653 commented Nov 13, 2022

Yes :)

I believe it is, I'm not 100% sure but close to 90% sure ;)

The sensor has some historic storage where it stores all values every hour.
The app will download this history when connecting to the device.

In the app main screen, you can view:

  • Current moisture in %
  • current fertility / conductivity in us/cm
  • current sunlight in lux
  • current temperature in *C

When you go to the historic value screen you can view:

  • Graph bar view of accumulated sunlight per hour in mmol
  • Graph bar view of moisture value per hour in %
  • etc. for all other sensors

When you click on the separate hourly bars for sunlight you see for example in the night: 2 mmol per bar, in the morning the bars go up and after midday the bars go down.

My values per bar for yesterday: 2,3,4,51,177,208,69,38,14,8,4,3,2

when you swipe the bar, you get two values:

  • Accumulated in mmol
  • Suitable licht levels in min~max mmol

Those suitable min max mmol values are the ones you read from openplantbook.
When I sum all the hourly bar values, I get the same number presented under Accumulated in mmol.

When I compare the number under Accumulated with the DLI number in HA from your integration it almost matches.
I believe some difference in those two numbers can be caused because HA is given new sensor values every 10 minutes while the app only stores the values every hour.
Therefor HA will calculate the DLI more precise than the app.
It could be that the difference in number is also caused because you calculate the DLI with the integral sensor and reset daily,
while the app calculates the accumulation and resets hourly and then sums up the value from every hour.
When I compare the app value and your value in HA every hour you see that your value is more linear.

Example of yesterday:

9:00 AM
App: 19 mmol
HA: 0.09 mol = 90 mmol

10:00 AM
App: 23 mmol
HA: 0.12 mol = 120 mmol

11:00 AM
App: 74 mmol
HA: 0.28 mol = 280 mmol

12:00 AM
App: 251 mmol
HA: 0.44 mol = 440 mmol

1:00 PM
App: 459 mmol
HA: 0.53 mol = 530 mmol

2:00 PM
App: 528 mmol
HA: 0.59 mol = 590 mmol

In the app the suitable sunlight minimal value = 400 for my plant.
At one o'clock, my plant had already accumulated enough sunlight according to the app.
But your integration is getting the value 400 from plantbook and multiply that by 0.0036 which gives 1,44 for the min_dli value.
Therefor in HA my plant will never be able to receive enough sunlight while it is a plant that likes shade.
Yesterday at 11:55 PM I had a DLI value in HA off: 0,71, still too low for the min_dli.
Therefor my plant is still showing the state problem for DLI.
It was standing in full sunlight for a couple of hours and the plant doesn't even like to be in full sunlight, it likes shade places.

@appiekap653
Copy link
Author

appiekap653 commented Nov 13, 2022

I found this text in the app explaining their numbers:

Screenshot_20221113-142437_Flower Care

App version: Flower care v5.7.1 (build 3074)
Sensor: Xiaomi flower care fw: 3.3.5

@appiekap653
Copy link
Author

appiekap653 commented Nov 13, 2022

Here an example of an other plant.
Your integration is saying it has accumulated just over the minimum while the app states way over the max.

Screenshot_20221113-143650_Home Assistant

Minimum:

Screenshot_20221113-143636_Home Assistant

Screenshot_20221113-144840_Flower Care

@Olen Olen added the bug Something isn't working label Aug 1, 2023
@Olen
Copy link
Owner

Olen commented Aug 1, 2023

I realy need to dig into this, but please feel free to look at the code and come up with suggestions.

@sm-Fifteen
Copy link

sm-Fifteen commented Apr 6, 2024

I'm getting the same issue here. Plants that are supposed to like indirect light and partial shade apparently only get past the minimum DLI (according to automatically fetched values from OPB by this integration) when placed next to sunny windows, while Flower Care says they've already recieved well above the maximum amounts reccomended.

EDIT: Then again, that might be Flower Care doing the calculations wrong, or being overly conservative with its values, because most sources I'm reading seem to say that a lemon tree (citrus limon), for example, should get a DLI of at least 12 mol/m²/d and aim for 20~28 mol/m²/d, but both Flower Care and Open Plant Book give "3.5~8 mol" (whereas your integration calculates 13~29 mol/s*m²*s), meaning you may actually be in the right, here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants