mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 13:47:35 +00:00
Use global variable and merge two if in one
This commit is contained in:
parent
4d5e9f2931
commit
d7094b996a
@ -31,6 +31,7 @@ CONF_USERNAME = 'username'
|
||||
CONF_PASSWORD = 'password'
|
||||
CONF_SSL = 'ssl'
|
||||
CONF_VERIFY_SSL = 'verify_ssl'
|
||||
CONF_BLACKLIST = 'blacklist'
|
||||
|
||||
|
||||
# pylint: disable=too-many-locals
|
||||
@ -53,7 +54,7 @@ def setup(hass, config):
|
||||
ssl = util.convert(conf.get(CONF_SSL), bool, DEFAULT_SSL)
|
||||
verify_ssl = util.convert(conf.get(CONF_VERIFY_SSL), bool,
|
||||
DEFAULT_VERIFY_SSL)
|
||||
blacklist = conf.get('blacklist', [])
|
||||
blacklist = conf.get(CONF_BLACKLIST, [])
|
||||
|
||||
try:
|
||||
influx = InfluxDBClient(host=host, port=port, username=username,
|
||||
@ -69,9 +70,8 @@ def setup(hass, config):
|
||||
def influx_event_listener(event):
|
||||
"""Listen for new messages on the bus and sends them to Influx."""
|
||||
state = event.data.get('new_state')
|
||||
if state is None or state.state in (STATE_UNKNOWN, ''):
|
||||
return
|
||||
if state.entity_id in blacklist:
|
||||
if state is None or state.state in (STATE_UNKNOWN, '') \
|
||||
or state.entity_id in blacklist:
|
||||
return
|
||||
|
||||
try:
|
||||
|
Loading…
x
Reference in New Issue
Block a user