Hide proximity updates in logbook (#7549)

pull/7563/head
Adam Mills 2017-05-11 19:37:32 -07:00 committed by Paulus Schoutsen
parent 76675a54f8
commit b805d8a844
1 changed files with 6 additions and 3 deletions

View File

@ -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