Added whitelist option to InfluxDB to select the only entities that will be logged on InfluxDB (#2727)
This commit is contained in:
parent
792154a6a7
commit
ef3e7b28a9
1 changed files with 5 additions and 0 deletions
|
@ -33,6 +33,7 @@ CONF_PASSWORD = 'password'
|
||||||
CONF_SSL = 'ssl'
|
CONF_SSL = 'ssl'
|
||||||
CONF_VERIFY_SSL = 'verify_ssl'
|
CONF_VERIFY_SSL = 'verify_ssl'
|
||||||
CONF_BLACKLIST = 'blacklist'
|
CONF_BLACKLIST = 'blacklist'
|
||||||
|
CONF_WHITELIST = 'whitelist'
|
||||||
CONF_TAGS = 'tags'
|
CONF_TAGS = 'tags'
|
||||||
|
|
||||||
|
|
||||||
|
@ -57,6 +58,7 @@ def setup(hass, config):
|
||||||
verify_ssl = util.convert(conf.get(CONF_VERIFY_SSL), bool,
|
verify_ssl = util.convert(conf.get(CONF_VERIFY_SSL), bool,
|
||||||
DEFAULT_VERIFY_SSL)
|
DEFAULT_VERIFY_SSL)
|
||||||
blacklist = conf.get(CONF_BLACKLIST, [])
|
blacklist = conf.get(CONF_BLACKLIST, [])
|
||||||
|
whitelist = conf.get(CONF_WHITELIST, [])
|
||||||
tags = conf.get(CONF_TAGS, {})
|
tags = conf.get(CONF_TAGS, {})
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -79,6 +81,9 @@ def setup(hass, config):
|
||||||
return
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
if len(whitelist) > 0 and state.entity_id not in whitelist:
|
||||||
|
return
|
||||||
|
|
||||||
_state = state_helper.state_as_number(state)
|
_state = state_helper.state_as_number(state)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
_state = state.state
|
_state = state.state
|
||||||
|
|
Loading…
Add table
Reference in a new issue