Circadian Lighting / calculate colortemp and brightness according to circadian rythm

Thanks for posting, this is really excellent stuff.

I’ve a few suggestions that should make it even easier for others to use. Creating libraries takes a certain type of thinking and it can be harder than you might expect.

Some ideas:

  • This could be made into a library (see OH 3 Examples: Writing and using JavaScript Libraries in MainUI created Rules) function and you can pass the data it needs in as arguments. That way you don’t have to hard code the names of Items into it which will allow those who use the code won’t have to modify it to do so.

  • It might be more flexible for users if the Astro Action were used to get sunrise and sunset instead of from Items directly. However, I like the idea of passing in the start times as then users can get the sunrise and sunset from any source, not just Astro and not just Items.

  • If you post this to a repo somewhere then you can continue to develop and add to it over time and users can contribute to it as well. If you don’t want to create your own repo, there are a few other repos you could submit it to including Pull requests · openhab-scripters/openhab-helper-libraries · GitHub or, if you want to get it located somewhere faster I’d accept it as a PR at GitHub - rkoshak/openhab-rules-tools: Library functions, classes, and examples to reuse in the development of new Rules.. At some point we will have a marketplace where we can put stuff like this and users can install them which will be great!

  • If you use a Group:Color to hold your Color Items, you can send the command to the Group and it will be forwarded to the Items. Then users can add as many Color lights as they want to the Group and won’t need to edit the code.

  • You can store some of those values currently in Items as local variables. the less you rely on Items the easier it will be for users to use the code without needing to create new Items or modify the code.

These are just some ideas. Thanks again for posting!

3 Likes