From b805d8a844974123a4ba871215b1e5ae37d332c1 Mon Sep 17 00:00:00 2001
From: Adam Mills <adam@armills.info>
Date: Thu, 11 May 2017 19:37:32 -0700
Subject: [PATCH] Hide proximity updates in logbook (#7549)

---
 homeassistant/components/logbook.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/homeassistant/components/logbook.py b/homeassistant/components/logbook.py
index bdc3fa3dce3..053648e3428 100644
--- a/homeassistant/components/logbook.py
+++ b/homeassistant/components/logbook.py
@@ -50,6 +50,8 @@ CONFIG_SCHEMA = vol.Schema({
 
 GROUP_BY_MINUTES = 15
 
+CONTINUOUS_DOMAINS = ['proximity', 'sensor']
+
 ATTR_NAME = 'name'
 ATTR_MESSAGE = 'message'
 ATTR_DOMAIN = 'domain'
@@ -190,7 +192,8 @@ def humanify(events):
                 if entity_id is None:
                     continue
 
-                if entity_id.startswith('sensor.'):
+                if entity_id.startswith(tuple('{}.'.format(
+                        domain) for domain in CONTINUOUS_DOMAINS)):
                     last_sensor_event[entity_id] = event
 
             elif event.event_type == EVENT_HOMEASSISTANT_STOP:
@@ -222,12 +225,12 @@ def humanify(events):
                 domain = to_state.domain
 
                 # Skip all but the last sensor state
-                if domain == 'sensor' and \
+                if domain in CONTINUOUS_DOMAINS and \
                    event != last_sensor_event[to_state.entity_id]:
                     continue
 
                 # Don't show continuous sensor value changes in the logbook
-                if domain == 'sensor' and \
+                if domain in CONTINUOUS_DOMAINS and \
                    to_state.attributes.get('unit_of_measurement'):
                     continue