Skip to content

Commit

Permalink
Switches to base class BinarySensorEntity
Browse files Browse the repository at this point in the history
Old base class BinarySensorDevice is deprecated and will be
removed in a future release of home assistant.
  • Loading branch information
HazardDede committed Jun 19, 2020
1 parent 708ee5a commit bf52cee
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions custom_components/ferienapidotde/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import voluptuous as vol

import homeassistant.helpers.config_validation as cv
from homeassistant.components.binary_sensor import BinarySensorDevice
from homeassistant.components.binary_sensor import BinarySensorEntity
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import CONF_NAME
from homeassistant.exceptions import PlatformNotReady
Expand Down Expand Up @@ -64,7 +64,9 @@
SCAN_INTERVAL = timedelta(minutes=1)


async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
async def async_setup_platform(
hass, config, async_add_entities, discovery_info=None
):
"""Setups the ferienapidotde platform."""
_, _ = hass, discovery_info # Fake usage
state_code = config.get(CONF_STATE)
Expand All @@ -82,7 +84,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
async_add_entities([VacationSensor(name, data_object)], True)


class VacationSensor(BinarySensorDevice):
class VacationSensor(BinarySensorEntity):
"""Implementation of the vacation sensor."""

def __init__(self, name, data_object):
Expand Down Expand Up @@ -158,4 +160,6 @@ async def async_update(self):
except Exception: # pylint: disable=broad-except
if self.data is None:
raise
_LOGGER.error("Failed to update the vacation data." "Re-using an old state")
_LOGGER.error(
"Failed to update the vacation data. Re-using an old state"
)

0 comments on commit bf52cee

Please sign in to comment.