From 8c5759e460cc319eb29d22e03b69492e0e22d925 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Sat, 3 Oct 2015 11:20:22 -0700 Subject: [PATCH] Improve Logbook device tracker locations handling --- homeassistant/components/logbook.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/logbook.py b/homeassistant/components/logbook.py index 0d5ef7f3867..19a5803853b 100644 --- a/homeassistant/components/logbook.py +++ b/homeassistant/components/logbook.py @@ -10,7 +10,7 @@ import re from homeassistant.core import State, DOMAIN as HA_DOMAIN 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) from homeassistant import 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 if domain == 'device_tracker': - return '{} home'.format( - 'arrived' if state.state == STATE_HOME else 'left') + if state.state == STATE_NOT_HOME: + return 'is away' + else: + return 'is at {}'.format(state.state) elif domain == 'sun': if state.state == sun.STATE_ABOVE_HORIZON: