Remove Heartbeat Filter (#393)

* Remove Heartbeat Filter

* Fix tests
This commit is contained in:
Otto Winter 2019-01-29 16:45:50 +01:00 committed by GitHub
parent 92e909568c
commit 7b26ecc0dc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 2 additions and 6 deletions

View file

@ -60,8 +60,9 @@ FILTERS_SCHEMA = cv.ensure_list({
vol.Optional(CONF_INVERT): None, vol.Optional(CONF_INVERT): None,
vol.Optional(CONF_DELAYED_ON): cv.positive_time_period_milliseconds, vol.Optional(CONF_DELAYED_ON): cv.positive_time_period_milliseconds,
vol.Optional(CONF_DELAYED_OFF): cv.positive_time_period_milliseconds, vol.Optional(CONF_DELAYED_OFF): cv.positive_time_period_milliseconds,
vol.Optional(CONF_HEARTBEAT): cv.positive_time_period_milliseconds,
vol.Optional(CONF_LAMBDA): cv.lambda_, vol.Optional(CONF_LAMBDA): cv.lambda_,
vol.Optional(CONF_HEARTBEAT): cv.invalid("The heartbeat filter has been removed in 1.11.0"),
}, cv.has_exactly_one_key(*FILTER_KEYS)) }, cv.has_exactly_one_key(*FILTER_KEYS))
MULTI_CLICK_TIMING_SCHEMA = vol.Schema({ MULTI_CLICK_TIMING_SCHEMA = vol.Schema({
@ -205,8 +206,6 @@ def setup_filter(config):
yield App.register_component(DelayedOffFilter.new(config[CONF_DELAYED_OFF])) yield App.register_component(DelayedOffFilter.new(config[CONF_DELAYED_OFF]))
elif CONF_DELAYED_ON in config: elif CONF_DELAYED_ON in config:
yield App.register_component(DelayedOnFilter.new(config[CONF_DELAYED_ON])) yield App.register_component(DelayedOnFilter.new(config[CONF_DELAYED_ON]))
elif CONF_HEARTBEAT in config:
yield App.register_component(HeartbeatFilter.new(config[CONF_HEARTBEAT]))
elif CONF_LAMBDA in config: elif CONF_LAMBDA in config:
for lambda_ in process_lambda(config[CONF_LAMBDA], [(bool_, 'x')], for lambda_ in process_lambda(config[CONF_LAMBDA], [(bool_, 'x')],
return_type=optional.template(bool_)): return_type=optional.template(bool_)):

View file

@ -161,7 +161,6 @@ def setup_filter(config):
def setup_filters(config): def setup_filters(config):
filters = [] filters = []
for conf in config: for conf in config:
filter = None
for filter in setup_filter(conf): for filter in setup_filter(conf):
yield None yield None
filters.append(filter) filters.append(filter)
@ -178,7 +177,6 @@ def setup_sensor_core_(sensor_var, mqtt_var, config):
if CONF_ACCURACY_DECIMALS in config: if CONF_ACCURACY_DECIMALS in config:
add(sensor_var.set_accuracy_decimals(config[CONF_ACCURACY_DECIMALS])) add(sensor_var.set_accuracy_decimals(config[CONF_ACCURACY_DECIMALS]))
if CONF_FILTERS in config: if CONF_FILTERS in config:
filters = None
for filters in setup_filters(config[CONF_FILTERS]): for filters in setup_filters(config[CONF_FILTERS]):
yield yield
add(sensor_var.set_filters(filters)) add(sensor_var.set_filters(filters))

View file

@ -481,7 +481,6 @@ binary_sensor:
- invert: - invert:
- delayed_on: 40ms - delayed_on: 40ms
- delayed_off: 40ms - delayed_off: 40ms
- heartbeat: 1s
on_press: on_press:
then: then:
- lambda: >- - lambda: >-