Compare commits
2 Commits
7fb39bcb2a
...
0.4.0
| Author | SHA1 | Date | |
|---|---|---|---|
| e69b2dfab9 | |||
| f168ad9e47 |
@@ -9,8 +9,6 @@ from georideapilib.objects import GeorideAccount
|
|||||||
import georideapilib.api as GeorideApi
|
import georideapilib.api as GeorideApi
|
||||||
from georideapilib.socket import GeorideSocket
|
from georideapilib.socket import GeorideSocket
|
||||||
|
|
||||||
from threading import Thread
|
|
||||||
|
|
||||||
_LOGGER = logging.getLogger('example')
|
_LOGGER = logging.getLogger('example')
|
||||||
|
|
||||||
|
|
||||||
@@ -24,21 +22,12 @@ def example():
|
|||||||
print("token 1: ", account.auth_token)
|
print("token 1: ", account.auth_token)
|
||||||
_LOGGER.info("token 1: %s", account.auth_token)
|
_LOGGER.info("token 1: %s", account.auth_token)
|
||||||
# pylint: disable=W0105
|
# pylint: disable=W0105
|
||||||
|
|
||||||
def locked_locked(data):
|
# socket = GeorideSocket()
|
||||||
_LOGGER.info("Locke received")
|
# socket.init()
|
||||||
|
# socket.connect(account.auth_token)
|
||||||
|
# time.sleep(10)
|
||||||
def connect_socket(account):
|
# socket.disconnect()
|
||||||
socket = GeorideSocket()
|
|
||||||
socket.subscribe_locked(locked_locked)
|
|
||||||
socket.init()
|
|
||||||
socket.connect(account.auth_token)
|
|
||||||
time.sleep(10)
|
|
||||||
socket.disconnect()
|
|
||||||
|
|
||||||
thread = Thread(target=connect_socket, args=(account))
|
|
||||||
thread.start()
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
account.auth_token = GeorideApi.renewToken(account.auth_token)
|
account.auth_token = GeorideApi.renewToken(account.auth_token)
|
||||||
|
|||||||
@@ -63,21 +63,21 @@ class GeorideSocket():
|
|||||||
""" on_message """
|
""" on_message """
|
||||||
_LOGGER.debug('Message received: %s', data)
|
_LOGGER.debug('Message received: %s', data)
|
||||||
if self._on_message_callback is not None:
|
if self._on_message_callback is not None:
|
||||||
self._on_message_callback(data)
|
self._on_message_callback()
|
||||||
|
|
||||||
@sio.on('device')
|
@sio.on('device')
|
||||||
def on_device(data):
|
def on_device(data):
|
||||||
""" on_device """
|
""" on_device """
|
||||||
_LOGGER.debug('Device received: %s', data)
|
_LOGGER.debug('Device received: %s', data)
|
||||||
if self._on_device_callback is not None:
|
if self._on_device_callback is not None:
|
||||||
self._on_device_callback(data)
|
self._on_device_callback()
|
||||||
|
|
||||||
@sio.on('position')
|
@sio.on('position')
|
||||||
def on_position(data):
|
def on_position(data):
|
||||||
""" on_position """
|
""" on_position """
|
||||||
_LOGGER.debug('Position received:%s', data)
|
_LOGGER.debug('Position received:%s', data)
|
||||||
if self._on_position_callback is not None:
|
if self._on_position_callback is not None:
|
||||||
self._on_position_callback(data)
|
self._on_position_callback()
|
||||||
|
|
||||||
@sio.on('alarm')
|
@sio.on('alarm')
|
||||||
def on_alarm(data):
|
def on_alarm(data):
|
||||||
@@ -98,9 +98,7 @@ class GeorideSocket():
|
|||||||
""" on_locked """
|
""" on_locked """
|
||||||
_LOGGER.debug('Locked received: %s', data)
|
_LOGGER.debug('Locked received: %s', data)
|
||||||
if self._on_locked_callback is not None:
|
if self._on_locked_callback is not None:
|
||||||
self._on_locked_callback(data)
|
self._on_locked_callback()
|
||||||
else:
|
|
||||||
_LOGGER.debug('Lallback is none')
|
|
||||||
|
|
||||||
self._initialised = True
|
self._initialised = True
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user