Skip to content

Commit

Permalink
debug logs
Browse files Browse the repository at this point in the history
  • Loading branch information
wtadler committed Oct 30, 2021
1 parent 1d81d32 commit 25bacfc
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions notify.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def send_message(self, message="", **kwargs):
time = data.get(CONF_TIME)
data.pop(CONF_TIME)

_LOGGER.debug('IqNotify: using mode: ' + mode)
_LOGGER.debug('IqNotify: using mode: ' + mode + ' and message: ' + message)

looking_since = dt_util.utcnow() - timedelta(minutes=time)

Expand Down Expand Up @@ -136,9 +136,7 @@ def send_message(self, message="", **kwargs):
state = self.hass.states.get(entity)
cur_state = state.state
state_since = state.last_changed
_LOGGER.debug('Entity: ' + entity + ' current state: ' +
str(cur_state) + ' since: ' + str(state_since))


if cur_state == STATE_ON or cur_state == STATE_HOME:
user_is_home = True
else:
Expand Down Expand Up @@ -177,8 +175,14 @@ def send_message(self, message="", **kwargs):
if looking_since < state_since:
notify = True

_LOGGER.debug('\nentity: ' + entity)
_LOGGER.debug('cur_state: ' + str(cur_state))
_LOGGER.debug('looking_since: ' + str(looking_since))
_LOGGER.debug('state_since: ' + str(state_since))
_LOGGER.debug('looking_since < state_since: ' + str(looking_since < state_since))
_LOGGER.debug('user_is_home: ' + str(user_is_home))
_LOGGER.debug('anyone_just_left: ' + str(anyone_just_left))

if notify:
self.hass.services.call('notify', service, service_data)
_LOGGER.info('Notifying notify.' + service +
' via ' + mode + ' mode')
_LOGGER.info('Notifying notify.' + service + ' via ' + mode + ' mode' + '\n');

0 comments on commit 25bacfc

Please sign in to comment.