Update to hole to 0.3.0 (#15014)

This commit is contained in:
Fabian Affolter 2018-06-17 15:38:56 +02:00 committed by Paulus Schoutsen
parent c871e8da5d
commit ca2712506b
2 changed files with 9 additions and 9 deletions

View file

@ -18,7 +18,7 @@ import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entity
from homeassistant.util import Throttle
REQUIREMENTS = ['pihole==0.1.2']
REQUIREMENTS = ['hole==0.3.0']
_LOGGER = logging.getLogger(__name__)
@ -65,7 +65,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
vol.Optional(CONF_LOCATION, default=DEFAULT_LOCATION): cv.string,
vol.Optional(CONF_VERIFY_SSL, default=DEFAULT_VERIFY_SSL): cv.boolean,
vol.Optional(CONF_MONITORED_CONDITIONS,
default=list(MONITORED_CONDITIONS)):
default=['ads_blocked_today']):
vol.All(cv.ensure_list, [vol.In(MONITORED_CONDITIONS)]),
})
@ -73,7 +73,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
async def async_setup_platform(
hass, config, async_add_devices, discovery_info=None):
"""Set up the Pi-hole sensor."""
from pihole import PiHole
from hole import Hole
name = config.get(CONF_NAME)
host = config.get(CONF_HOST)
@ -82,7 +82,7 @@ async def async_setup_platform(
verify_tls = config.get(CONF_VERIFY_SSL)
session = async_get_clientsession(hass)
pi_hole = PiHoleData(PiHole(
pi_hole = PiHoleData(Hole(
host, hass.loop, session, location=location, tls=use_tls,
verify_tls=verify_tls))
@ -164,11 +164,11 @@ class PiHoleData(object):
@Throttle(MIN_TIME_BETWEEN_UPDATES)
async def async_update(self):
"""Get the latest data from the Pi-hole."""
from pihole.exceptions import PiHoleError
from hole.exceptions import HoleError
try:
await self.api.get_data()
self.available = True
except PiHoleError:
except HoleError:
_LOGGER.error("Unable to fetch data from Pi-hole")
self.available = False

View file

@ -406,6 +406,9 @@ hikvision==0.4
# homeassistant.components.notify.hipchat
hipnotify==1.0.8
# homeassistant.components.sensor.pi_hole
hole==0.3.0
# homeassistant.components.binary_sensor.workday
holidays==0.9.5
@ -651,9 +654,6 @@ pifacedigitalio==3.0.5
# homeassistant.components.light.piglow
piglow==1.2.4
# homeassistant.components.sensor.pi_hole
pihole==0.1.2
# homeassistant.components.pilight
pilight==0.1.1