|
|
@ -53,39 +53,37 @@ class GeorideLockSwitchEntity(SwitchDevice):
|
|
|
|
self._state = {}
|
|
|
|
self._state = {}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async def async_turn_on(self, **kwargs):
|
|
|
|
def turn_on(self, **kwargs):
|
|
|
|
""" lock the georide tracker """
|
|
|
|
""" lock the georide tracker """
|
|
|
|
_LOGGER.info('async_turn_on %s', kwargs)
|
|
|
|
_LOGGER.info('async_turn_on %s', kwargs)
|
|
|
|
success = GeorideApi.lock_tracker(self._get_token_callback(), self._tracker_id)
|
|
|
|
success = GeorideApi.lock_tracker(self._get_token_callback(), self._tracker_id)
|
|
|
|
if success:
|
|
|
|
if success:
|
|
|
|
|
|
|
|
self._data.is_locked = True
|
|
|
|
self._is_on = True
|
|
|
|
self._is_on = True
|
|
|
|
|
|
|
|
|
|
|
|
async def async_turn_off(self, **kwargs):
|
|
|
|
def turn_off(self, **kwargs):
|
|
|
|
""" unlock the georide tracker """
|
|
|
|
""" unlock the georide tracker """
|
|
|
|
_LOGGER.info('async_turn_off %s', kwargs)
|
|
|
|
_LOGGER.info('async_turn_off %s', kwargs)
|
|
|
|
success = GeorideApi.unlock_tracker(self._get_token_callback(), self._tracker_id)
|
|
|
|
success = GeorideApi.unlock_tracker(self._get_token_callback(), self._tracker_id)
|
|
|
|
if success:
|
|
|
|
if success:
|
|
|
|
|
|
|
|
self._data.is_locked = False
|
|
|
|
self._is_on = False
|
|
|
|
self._is_on = False
|
|
|
|
|
|
|
|
|
|
|
|
async def async_toggle(self, **kwargs):
|
|
|
|
async def async_toggle(self, **kwargs):
|
|
|
|
""" toggle lock the georide tracker """
|
|
|
|
""" toggle lock the georide tracker """
|
|
|
|
_LOGGER.info('async_toggle %s', kwargs)
|
|
|
|
_LOGGER.info('async_toggle %s', kwargs)
|
|
|
|
self._is_on = GeorideApi.toogle_lock_tracker(self._get_token_callback(),
|
|
|
|
result = GeorideApi.toogle_lock_tracker(self._get_token_callback(),
|
|
|
|
self._tracker_id)
|
|
|
|
self._tracker_id)
|
|
|
|
|
|
|
|
self._data.is_locked = result
|
|
|
|
|
|
|
|
self._is_on = result
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
def update(self):
|
|
|
|
def should_poll(self):
|
|
|
|
|
|
|
|
"""No polling needed."""
|
|
|
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async def async_update(self):
|
|
|
|
|
|
|
|
""" update the current tracker"""
|
|
|
|
""" update the current tracker"""
|
|
|
|
_LOGGER.info('async_update ')
|
|
|
|
_LOGGER.info('async_update ')
|
|
|
|
self._data = self._get_tracker_callback(self._tracker_id)
|
|
|
|
self._data = self._get_tracker_callback(self._tracker_id)
|
|
|
|
self._name = self._data.tracker_name
|
|
|
|
self._name = self._data.tracker_name
|
|
|
|
self._is_on = self._data.is_locked
|
|
|
|
self._is_on = self._data.is_locked
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
@property
|
|
|
|
def unique_id(self):
|
|
|
|
def unique_id(self):
|
|
|
|