mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Sorry, I was wrong they are needed
This commit is contained in:
parent
9a79ecf2d3
commit
1f6f2de9c6
@ -8,6 +8,7 @@ at https://home-assistant.io/components/automation/#time-trigger
|
||||
"""
|
||||
import logging
|
||||
|
||||
from homeassistant.util import convert
|
||||
import homeassistant.util.dt as dt_util
|
||||
from homeassistant.helpers.event import track_time_change
|
||||
|
||||
@ -36,6 +37,18 @@ def trigger(hass, config, action):
|
||||
hours = config.get(CONF_HOURS)
|
||||
minutes = config.get(CONF_MINUTES)
|
||||
seconds = config.get(CONF_SECONDS)
|
||||
if isinstance(minutes, str) and minutes.startswith('/') \
|
||||
and not convert(minutes.lstrip('/'), int) % 60 == 0:
|
||||
_LOGGER.warning('Periodic minutes should be divisible with 60'
|
||||
'there will be an offset every hour')
|
||||
if isinstance(seconds, str) and seconds.startswith('/') \
|
||||
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('/') \
|
||||
and not convert(hours.lstrip('/'), int) % 24 == 0:
|
||||
_LOGGER.warning('Periodic hours should be divisible with 24'
|
||||
'there will be an offset every midnight')
|
||||
else:
|
||||
_LOGGER.error('One of %s, %s, %s OR %s needs to be specified',
|
||||
CONF_HOURS, CONF_MINUTES, CONF_SECONDS, CONF_AFTER)
|
||||
|
Loading…
x
Reference in New Issue
Block a user