diff --git a/homeassistant/components/automation/time.py b/homeassistant/components/automation/time.py index 0197ae07d29..3d590ea8cfa 100644 --- a/homeassistant/components/automation/time.py +++ b/homeassistant/components/automation/time.py @@ -45,7 +45,7 @@ def trigger(hass, config, action): and not convert(seconds.lstrip('/'), int) % 60 == 0: _LOGGER.warning('Periodic seconds should be divisible with 60' 'there will be an offset every minute') - if isinstance(minutes, str) and hours.startswith('/') \ + if isinstance(hours, str) and hours.startswith('/') \ and not convert(hours.lstrip('/'), int) % 24 == 0: _LOGGER.warning('Periodic hours should be divisible with 24' 'there will be an offset every midnight') diff --git a/homeassistant/helpers/event.py b/homeassistant/helpers/event.py index 42d182b77da..6ca186a1744 100644 --- a/homeassistant/helpers/event.py +++ b/homeassistant/helpers/event.py @@ -215,4 +215,5 @@ def _matcher(subject, pattern): return subject % float(pattern[0].lstrip('/')) == 0 except ValueError: return False + return MATCH_ALL == pattern or subject in pattern diff --git a/tests/helpers/test_event.py b/tests/helpers/test_event.py index 0442fe9e2a0..2f760ee1382 100644 --- a/tests/helpers/test_event.py +++ b/tests/helpers/test_event.py @@ -299,3 +299,13 @@ class TestEventHelpers(unittest.TestCase): self._send_time_changed(datetime(2016, 5, 2, 0, 0, 0)) self.hass.pool.block_till_done() self.assertEqual(2, len(specific_runs)) + + def test_periodic_task_wrong_input(self): + specific_runs = [] + + track_utc_time_change( + self.hass, lambda x: specific_runs.append(1), year='/two') + + self._send_time_changed(datetime(2014, 5, 2, 0, 0, 0)) + self.hass.pool.block_till_done() + self.assertEqual(1, len(specific_runs))