Skip to content

Commit

Permalink
Logging fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
zabuldon committed Sep 19, 2017
1 parent da19170 commit 7e1d9f6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from setuptools import setup
setup(
name='teslajsonpy',
version='0.0.14',
version='0.0.15',
packages=['teslajsonpy'],
include_package_data=True,
python_requires='>=3',
Expand Down
14 changes: 1 addition & 13 deletions teslajsonpy/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,9 @@ def __init__(self, email, password, update_interval, logger):
self.__vehicles.append(GPS(car, self))

def post(self, vehicle_id, command, data={}):
self.__logger.debug('vehicles/%i/%s' % (vehicle_id, command))
return self.__connection.post('vehicles/%i/%s' % (vehicle_id, command), data)

def get(self, vehicle_id, command):
self.__logger.debug('vehicles/%i/%s' % (vehicle_id, command))
return self.__connection.get('vehicles/%i/%s' % (vehicle_id, command))

def data_request(self, vehicle_id, name):
Expand All @@ -53,12 +51,12 @@ def list_vehicles(self):
return self.__vehicles

def wake_up(self, vehicle_id):
self.__logger.debug('{} {}'.format(vehicle_id, 'wake_up'))
self.post(vehicle_id, 'wake_up')

def update(self, car_id):
cur_time = time.time()
self.__lock.acquire()
self.__logger.debug('Update requested, Car ID: %s', car_id)
if cur_time - self.__last_update_time[car_id] > self.update_interval:
self.wake_up(car_id)
data = self.get(car_id, 'data')['response']
Expand All @@ -67,16 +65,6 @@ def update(self, car_id):
self.__state[car_id] = data['vehicle_state']
self.__driving[car_id] = data['drive_state']
self.__last_update_time[car_id] = time.time()
self.__logger.debug(
'Update requested:\n\t'
'Cat_ID: {}\n\t'
'TS: \n\t\t'
'Last Update:{}\n\t\t'
'Current: {} \n\t\t'
'Delta: {}\n\t'
'Data: {}'.format(
car_id, self.__last_update_time[car_id], cur_time, cur_time - self.__last_update_time[car_id],
dumps(data)))
self.__lock.release()

def get_climate_params(self, car_id):
Expand Down

0 comments on commit 7e1d9f6

Please sign in to comment.