diff --git a/cherry/bedtime/__init__.py b/cherry/bedtime/__init__.py index 0f9d4e7..2991705 100644 --- a/cherry/bedtime/__init__.py +++ b/cherry/bedtime/__init__.py @@ -149,7 +149,6 @@ async def periodic_rule_check(client, chain, timezone, scene, state, mutex): """ Periodically checks for a matching rule to apply. - nstalling collected packages: cherry-hue :param client: mqtt client :param chain: the head of a rule chain :param timezone: local time zone object @@ -157,14 +156,14 @@ async def periodic_rule_check(client, chain, timezone, scene, state, mutex): :param state: shared state dictionary :param mutex: lock for making changes to shared state """ - midnight = timezone.localize( - datetime.combine(now(timezone), datetime.min.time())) - logging.debug(f'Setting time zone to {midnight.tzname()}') - while True: logging.debug('Begin rule check') await mutex.acquire() + midnight = timezone.localize( + datetime.combine(now(timezone), datetime.min.time())) + logging.debug(f'Setting time zone to {midnight.tzname()}') + if now(timezone) >= midnight: for rule in chain.walk(): if now(timezone).time() < rule.time: diff --git a/setup.py b/setup.py index a9ac319..2a7af96 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import setup, find_namespace_packages setup(name='cherry-bedtime', - version='0.2', + version='0.3', description='Simulates a sunset as bedtime approaches', author='Bob Carroll', author_email='bob.carroll@alum.rit.edu',