Added host variable to Splunk.py and updated tox tests (#8052)

* Added host variable to Splunk.py and updated tox tests

* Update splunk.py

* Update splunk.py
This commit is contained in:
boojew authored and Paulus Schoutsen committed 2017-06-15 20:41:19 -07:00
1 parent a3a702b269
commit c478f2c7d0
2 files changed
+7 -1

No files matched your search

+5 -1
View File
@@ -11,7 +11,7 @@ import requests
import voluptuous as vol
from homeassistant.const import (
CONF_HOST, CONF_PORT, CONF_SSL, CONF_TOKEN, EVENT_STATE_CHANGED)
CONF_NAME, CONF_HOST, CONF_PORT, CONF_SSL, CONF_TOKEN, EVENT_STATE_CHANGED)
from homeassistant.helpers import state as state_helper
import homeassistant.helpers.config_validation as cv
@@ -22,6 +22,7 @@ DOMAIN = 'splunk'
DEFAULT_HOST = 'localhost'
DEFAULT_PORT = 8088
DEFAULT_SSL = False
DEFAULT_NAME = 'HASS'
CONFIG_SCHEMA = vol.Schema({
DOMAIN: vol.Schema({
@@ -29,6 +30,7 @@ CONFIG_SCHEMA = vol.Schema({
vol.Optional(CONF_HOST, default=DEFAULT_HOST): cv.string,
vol.Optional(CONF_PORT, default=DEFAULT_PORT): cv.port,
vol.Optional(CONF_SSL, default=False): cv.boolean,
vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
}),
}, extra=vol.ALLOW_EXTRA)
@@ -40,6 +42,7 @@ def setup(hass, config):
port = conf.get(CONF_PORT)
token = conf.get(CONF_TOKEN)
use_ssl = conf.get(CONF_SSL)
name = conf.get(CONF_NAME)
if use_ssl:
uri_scheme = 'https://'
@@ -69,6 +72,7 @@ def setup(hass, config):
'attributes': dict(state.attributes),
'time': str(event.time_fired),
'value': _state,
'host': name,
}
]