|
|
@ -68,6 +68,7 @@ async def async_setup(hass, config):
|
|
|
|
|
|
|
|
|
|
|
|
def connect_socket(hass, component):
|
|
|
|
def connect_socket(hass, component):
|
|
|
|
"""subscribe to georide socket"""
|
|
|
|
"""subscribe to georide socket"""
|
|
|
|
|
|
|
|
_LOGGER.info("Run socket connexion tread")
|
|
|
|
context = hass.data[DOMAIN]["context"]
|
|
|
|
context = hass.data[DOMAIN]["context"]
|
|
|
|
|
|
|
|
|
|
|
|
socket = GeorideSocket()
|
|
|
|
socket = GeorideSocket()
|
|
|
@ -206,6 +207,11 @@ class GeorideContext:
|
|
|
|
"""set the georide socket"""
|
|
|
|
"""set the georide socket"""
|
|
|
|
self._socket = socket
|
|
|
|
self._socket = socket
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def fire_event(self, type):
|
|
|
|
|
|
|
|
self._hass.bus.fire('georide-refresh', {
|
|
|
|
|
|
|
|
'type': type
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@callback
|
|
|
|
@callback
|
|
|
|
def on_lock_callback(self, data):
|
|
|
|
def on_lock_callback(self, data):
|
|
|
@ -216,6 +222,7 @@ class GeorideContext:
|
|
|
|
tracker.locked_latitude = data['lockedLatitude']
|
|
|
|
tracker.locked_latitude = data['lockedLatitude']
|
|
|
|
tracker.locked_longitude = data['lockedLongitude']
|
|
|
|
tracker.locked_longitude = data['lockedLongitude']
|
|
|
|
tracker.is_locked = data['isLocked']
|
|
|
|
tracker.is_locked = data['isLocked']
|
|
|
|
|
|
|
|
self.fire_event('on_lock')
|
|
|
|
return
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
@callback
|
|
|
|
@callback
|
|
|
@ -225,6 +232,7 @@ class GeorideContext:
|
|
|
|
for tracker in self._georide_trackers:
|
|
|
|
for tracker in self._georide_trackers:
|
|
|
|
if tracker.tracker_id == data['trackerId']:
|
|
|
|
if tracker.tracker_id == data['trackerId']:
|
|
|
|
tracker.status = data['status']
|
|
|
|
tracker.status = data['status']
|
|
|
|
|
|
|
|
self.fire_event('on_device')
|
|
|
|
return
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
@callback
|
|
|
|
@callback
|
|
|
@ -238,6 +246,7 @@ class GeorideContext:
|
|
|
|
tracker.moving = data['moving']
|
|
|
|
tracker.moving = data['moving']
|
|
|
|
tracker.speed = data['speed']
|
|
|
|
tracker.speed = data['speed']
|
|
|
|
tracker.fixtime = data['fixtime']
|
|
|
|
tracker.fixtime = data['fixtime']
|
|
|
|
|
|
|
|
self.fire_event('on_position')
|
|
|
|
return
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|