Skip to content

Commit

Permalink
Fix deprecation warnings in the log
Browse files Browse the repository at this point in the history
Closes #12
  • Loading branch information
sebr committed May 21, 2020
1 parent 9c8ce77 commit 816afdd
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
10 changes: 8 additions & 2 deletions custom_components/bhyve/binary_sensor.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
"""Support for Orbit BHyve binary sensors ()."""
import logging

from homeassistant.components.binary_sensor import BinarySensorDevice
try:
from homeassistant.components.binary_sensor import BinarySensorEntity
except ImportError:
from homeassistant.components.binary_sensor import (
BinarySensorDevice as BinarySensorEntity,
)

from homeassistant.helpers.event import async_call_later

from . import BHyveEntity
Expand Down Expand Up @@ -39,7 +45,7 @@ async def async_setup_platform(hass, config, async_add_entities, _discovery_info
async_add_entities(binary_sensors, True)


class BHyveRainDelayBinarySensor(BHyveEntity, BinarySensorDevice):
class BHyveRainDelayBinarySensor(BHyveEntity, BinarySensorEntity):
"""Define a BHyve binary sensor."""

def _setup(self, device):
Expand Down
12 changes: 10 additions & 2 deletions custom_components/bhyve/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@
import logging

from datetime import timedelta
from homeassistant.components.switch import DEVICE_CLASS_SWITCH, SwitchDevice

try:
from homeassistant.components.switch import DEVICE_CLASS_SWITCH, SwitchEntity
except ImportError:
from homeassistant.components.switch import (
DEVICE_CLASS_SWITCH,
SwitchDevice as SwitchEntity,
)

from homeassistant.util import dt

from . import BHyveEntity
Expand Down Expand Up @@ -49,7 +57,7 @@ async def async_setup_platform(hass, config, async_add_entities, _discovery_info
async_add_entities(switches, True)


class BHyveZoneSwitch(BHyveEntity, SwitchDevice):
class BHyveZoneSwitch(BHyveEntity, SwitchEntity):
"""Define a BHyve switch."""

def __init__(self, hass, bhyve, device, zone, name, programs, icon):
Expand Down

0 comments on commit 816afdd

Please sign in to comment.