[APP][Pro] Circadian Lighting

Hi,

Thank you for creating such a great project!

I’m looking to enhance the application with the ability to manually set temperature and brightness within specific time intervals. For instance, in the morning, I want to utilize full brightness even though it might still be dark outside, and the same applies during working hours.

To this end, I’ve been experimenting with extending the functionality of the application. In my fork, I’ve introduced a new device type: “Circadian Timing Zone”.
This addition provides three options to the original “Circadian Zone”:

  • Fade Duration
  • Timing JSON
  • Timing JSON for Night Mode

Within the JSON, adjustments can be made for the given intervals.

Here’s a JSON configuration example:

{
    "01:00": {
        "temperature": "circadian",
        "brightness": 0.05
    },
    "06:00": {
        "temperature": 0,
        "brightness": 1
    },
    "19:00": {
        "temperature": 0.65,
        "brightness": 0.9
    },
    "20:00": {
        "temperature": 0.75,
        "brightness": 0.85
    },
    "21:00": {
        "temperature": "circadian",
        "brightness": 0.73
    },
    "22:00": {
        "temperature": "circadian",
        "brightness": "circadian"
    }
}

In this configuration, from 01:00, the device will utilize 5% brightness (0.05), maintaining the circadian temperature. From 06:00, it will operate at maximum brightness and the coolest temperature. Starting from 21:00, the device will use circadian temperature with 73% brightness, and from 22:00, it will fully revert to the original circadian options.

If the JSON fields are left empty, the device will operate as initially implemented, with only circadian lighting.

The “Fade Duration” option is introduced to prevent abrupt transitions or blinking when it’s time to switch. The light will gradually adjust during this duration. For instance, if “Fade Duration” is set to 60 (minutes), the light will begin to increase in brightness from 0.05 to 1 starting at 05:00, reaching full brightness at 06:00 (±3 minutes).

I’m interested in your thoughts on this. I could create a PR to merge these changes upstream (some refinements would still be needed in that case). I’m also willing to refactor the code to integrate these options with the original device. It will continue to operate as is if the JSONs are left empty.

What do you think?