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

Implement a time scheduler with precise light settings #15

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Vitaliy-Yakovchuk
Copy link
Contributor

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.

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 (this is probably over engineering and needs to be removed)

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

Here’s a JSON configuration example (this is just for example purpose):

{
    "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).

What do you think?

In my opinion, there is no need for a separate device, as the modification will not affect the original Circadian Zone device, provided the JSON is empty.

If you consider such a refinement mergeable, I will need to enhance the code quality in both scenarios:

  • If this is intended to be a singular device, to integrate the code with the 'Circadian Zone.'
  • If it will be a distinct device, to add documentation and possibly extract a superclass.
    Originally, my code aimed to minimize alterations to your existing code, anticipating a scenario where the changes may not be accepted into the mainstream. This would allow me to maintain my fork in the event of any updates to your repository.

* Fix night temperature settings refresh

* Add circadian plus timing device support

* Fix prev circadian case

* Make CircadianTimingDriver methods private

* Fix typo/more validations

* Fix search for the prev item
@owenselles
Copy link

Will this ever get implemented @alistairg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants