This commit is contained in:
Paulus Schoutsen committed 2019-07-31 12:25:30 -07:00
1 parent da05dfe708
commit 4de97abc3a
2676 files changed
+163166 -140084

No files matched your search

+11 -8
View File
@@ -13,16 +13,18 @@ from homeassistant.helpers.entity import Entity
_LOGGER = logging.getLogger(__name__)
CONF_ID = 'id'
CONF_ID = "id"
DEFAULT_NAME = 'OhmConnect Status'
DEFAULT_NAME = "OhmConnect Status"
MIN_TIME_BETWEEN_UPDATES = timedelta(minutes=1)
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
vol.Required(CONF_ID): cv.string,
vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
})
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
{
vol.Required(CONF_ID): cv.string,
vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
}
)
def setup_platform(hass, config, add_entities, discovery_info=None):
@@ -65,8 +67,9 @@ class OhmconnectSensor(Entity):
import defusedxml.ElementTree as ET
try:
url = ("https://login.ohmconnect.com"
"/verify-ohm-hour/{}").format(self._ohmid)
url = ("https://login.ohmconnect.com" "/verify-ohm-hour/{}").format(
self._ohmid
)
response = requests.get(url, timeout=10)
root = ET.fromstring(response.text)