mirror of
https://github.com/home-assistant/core.git
synced 2025-07-26 06:37:52 +00:00
Hide proximity updates in logbook (#7549)
This commit is contained in:
parent
76675a54f8
commit
b805d8a844
@ -50,6 +50,8 @@ CONFIG_SCHEMA = vol.Schema({
|
|||||||
|
|
||||||
GROUP_BY_MINUTES = 15
|
GROUP_BY_MINUTES = 15
|
||||||
|
|
||||||
|
CONTINUOUS_DOMAINS = ['proximity', 'sensor']
|
||||||
|
|
||||||
ATTR_NAME = 'name'
|
ATTR_NAME = 'name'
|
||||||
ATTR_MESSAGE = 'message'
|
ATTR_MESSAGE = 'message'
|
||||||
ATTR_DOMAIN = 'domain'
|
ATTR_DOMAIN = 'domain'
|
||||||
@ -190,7 +192,8 @@ def humanify(events):
|
|||||||
if entity_id is None:
|
if entity_id is None:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if entity_id.startswith('sensor.'):
|
if entity_id.startswith(tuple('{}.'.format(
|
||||||
|
domain) for domain in CONTINUOUS_DOMAINS)):
|
||||||
last_sensor_event[entity_id] = event
|
last_sensor_event[entity_id] = event
|
||||||
|
|
||||||
elif event.event_type == EVENT_HOMEASSISTANT_STOP:
|
elif event.event_type == EVENT_HOMEASSISTANT_STOP:
|
||||||
@ -222,12 +225,12 @@ def humanify(events):
|
|||||||
domain = to_state.domain
|
domain = to_state.domain
|
||||||
|
|
||||||
# Skip all but the last sensor state
|
# 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]:
|
event != last_sensor_event[to_state.entity_id]:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Don't show continuous sensor value changes in the logbook
|
# 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'):
|
to_state.attributes.get('unit_of_measurement'):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user