A general question to the professionals here. I guess the rule section is the best section for my question at the moment.
I’m currently working on a fish tank solution. Now I have to make some general design decisions. Especially for the light control. The water exchange/refill and all the other stuff can be solved with onboard tools.
I control my light with the pca9685 module. The module is actually distributed as a servo driver, but it is indeed a LED driver. I already wrote the binding for the PCA9685 module using the I2C bus because there was no working/satisfying solution
The light has a course of the day. In the morning the sun rises and at noon the light is brightest… Everybody knows what I’m talking about…
But how do I do that? This is a very basic decision and that’s the reason I’m asking.
I could calculate the dimming curves with rules (as said already). Too complicated and inflexible
I could store the dimming curves in a table and read them in. Inflexible and the tables have to be created first.
I could build a webpage to create the dimming curves and store them in OpenHAB. Still too complicated.
I would like to have it in OpenHAB solution with drag and drop. Could one integrate using the frame widget… Is there a better solution? Better Ideas?
There is no drag and drop with openHAB.
And since openHAB is primarily home automation centric, doing a more industrial automation task like this is going to usually require you to do things that are “too complicated and inflexible.”
I believe most people who control their lights based on sunrise/sunset (usually controlling the color temperature) is by using the Astro binding and the sun elevation Channel.
But I would guess you want to simulate sunrise/sunset independently of what the sun is doing in your specific location. For this, you can create a separate Astro Thing with any location you choose. So if the creatures in the tank are from off the coast of Indonesia, set the Astro Thing’s location there. Then use the sun elevation Channel and a simple Rule/calculation to convert the angle to a brightness.
The sun elevation goes between 0 (sunrise/sunset) to a max of 90 degrees at lower latitudes.
rule "Sun elevation for tank changed:"
Item TankSunElevation changed
val elevation = (TankSunElevation.state as QuantityType<Number>).intValue
val brightness = <some calculation goes here that relates sun elevation to brightness>
With this approach the light will follow the changes in day length as the seasons change and the calculation is relatively simple. No need for tables or or anything like that.
Yes, sir! You are not an aquarium person. You have completely misunderstood me. I mean a given course of light over the day. Nature should be simulated. You won’t need that much in home automation. With Drag and Drop I meant to create the course courses. The curves must be individually createable, because hardcore aquarists use many lights. And only those will use such a control.
you may find a something suitable here http://www.flong.com/texts/code/shapers_exp/ with each channel individually parameterised. I do remember a frenchman, krikroff, posted a nice sunrise sunset for a RGB controller on the fibaro forum but can’t find it that might have given you some ideas.
you may be right Gabriel, but he is a master rule writer. Tell @rlkoshak what you need and he’ll whip it off the top of his head
Well, like I said, this is home automation software, not aquarium software or industrial control software or office building controls. If you need to do something outside the typical home automation tasks then you will have to do something “too complicated and inflexible”.
But I don’t think you give me enough credit. First of all you expressly stated “at noon the light is brightest…” which mentioned nothing about color. But I still don’t see why you can’t calculate the individual color values based on the sun elevation or azimuth. I purposefully did not enter a calculation in the example above because I know full well that it won’t be a simple linear function on the elevation or azimuth.
My main point is you need to create a formula to calculate these curves for you based on time or sun elevation or sun azimuth. Or you need to generate a chart of the values by hand. Or find some aquarium focused software that does this for you and pipe those values into OH.
Thank you so much for your friendly help Rich.
And thanks @robmac and @Andrew_Rowe.
I thought to myself that this problem probably can only solved by rules. No problem. I will program something.
This software - by the way - is ideal for aquariums. I thought that I still have to do something for the light. But not more. An I wanted to ask just to avoid unnecessary work.
For your understanding: An auqarian doesn’t want to have his light calculated (better not only). Maybe he wants to see the aquarium slightly bluish in the early morning and yellowish in the evening. That’s why one needs the curves which are devined by the user. He also needs to calculate. Because many fish depend on the moon. And the moonlight is calculated.
You could calculate and create your dimming curves with python in HABApp and then just call a script that writes the new values to I²C. If you plot the created dimming curves with matplotlib you can show them in the gui and check that they are to your liking.