Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions homeassistant/components/tahoma/lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,14 @@
_LOGGER = logging.getLogger(__name__)

SCAN_INTERVAL = timedelta(seconds=120)
TAHOMA_STATE_LOCKED = "locked"
TAHOMA_STATE_UNLOCKED = "unlocked"
Comment thread
vlebourl marked this conversation as resolved.
Outdated


def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the Tahoma lock."""
if discovery_info is None:
return
controller = hass.data[TAHOMA_DOMAIN]["controller"]
devices = []
for device in hass.data[TAHOMA_DOMAIN]["devices"]["lock"]:
Expand All @@ -37,13 +41,9 @@ def update(self):
self.controller.get_states([self.tahoma_device])
self._battery_level = self.tahoma_device.active_states["core:BatteryState"]
self._name = self.tahoma_device.active_states["core:NameState"]
if self._battery_level == "low":
_LOGGER.warning("Lock %s has low battery", self._name)
if self._battery_level == "verylow":
_LOGGER.error("Lock %s has very low battery", self._name)
if (
self.tahoma_device.active_states.get("core:LockedUnlockedState")
== STATE_LOCKED
== TAHOMA_STATE_LOCKED
):
self._lock_status = STATE_LOCKED
else:
Expand Down