From 73d2ea117e1374094608a7af8ce0090a7b33f315 Mon Sep 17 00:00:00 2001 From: John Lancaster <32917998+jsl12@users.noreply.github.com> Date: Mon, 17 Jul 2023 17:36:09 -0500 Subject: [PATCH] added sleeping_active property --- apps/continuous.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/apps/continuous.py b/apps/continuous.py index af817d0..67c431e 100755 --- a/apps/continuous.py +++ b/apps/continuous.py @@ -21,7 +21,6 @@ class Continuous(Hass): longitude: float def initialize(self): - # self.log(f'Brightness Range: {self.brightness_rng}, {self.current_adjuster.get_brightness()}') # self.run_daily(self.refresh_daylight_times, '00:00:00') # self.run_every(self.create_img, 'now', int(timedelta(minutes=5).total_seconds())) @@ -90,10 +89,17 @@ class Continuous(Hass): def adjuster(self): return DaylightAdjuster(self.latitude, self.longitude, self.args['periods']) + @property + def sleeping_active(self) -> bool: + if 'sleep_var' in self.args: + return self.get_state(self.args['sleep_var']) == 'on' + else: + return False + def adjust(self, kwargs): self.log(f'Adjusting...') self.log(self.adjuster.current_settings) - if self.light_state: + if self.light_state and not self.sleeping_active: self.light_state = self.adjuster.current_settings def create_img(self, kwargs):