Improve Logbook device tracker locations handling

pull/479/head
Paulus Schoutsen 2015-10-03 11:20:22 -07:00
parent 8490d6126a
commit 8c5759e460
1 changed files with 5 additions and 3 deletions

View File

@ -10,7 +10,7 @@ import re
from homeassistant.core import State, DOMAIN as HA_DOMAIN from homeassistant.core import State, DOMAIN as HA_DOMAIN
from homeassistant.const import ( from homeassistant.const import (
EVENT_STATE_CHANGED, STATE_HOME, STATE_ON, STATE_OFF, EVENT_STATE_CHANGED, STATE_NOT_HOME, STATE_ON, STATE_OFF,
EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP, HTTP_BAD_REQUEST) EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP, HTTP_BAD_REQUEST)
from homeassistant import util from homeassistant import util
import homeassistant.util.dt as dt_util import homeassistant.util.dt as dt_util
@ -222,8 +222,10 @@ def _entry_message_from_state(domain, state):
# We pass domain in so we don't have to split entity_id again # We pass domain in so we don't have to split entity_id again
if domain == 'device_tracker': if domain == 'device_tracker':
return '{} home'.format( if state.state == STATE_NOT_HOME:
'arrived' if state.state == STATE_HOME else 'left') return 'is away'
else:
return 'is at {}'.format(state.state)
elif domain == 'sun': elif domain == 'sun':
if state.state == sun.STATE_ABOVE_HORIZON: if state.state == sun.STATE_ABOVE_HORIZON: